summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorBalint Marton <cus@passwd.hu>2011-02-16 00:17:13 +0000
committerMichael Niedermayer <michaelni@gmx.at>2011-02-16 23:00:50 +0100
commit33af787d8a892b51b7386a051f0cc0174c7e34ea (patch)
treec8d4568d7de4b915f3f168da3feba25c11e45f2b /libavformat
parent20bc55ce5c01662a50bd9081914244b714294e84 (diff)
Fix av_find_best_stream when using a program
The current implementation has a bug, it is returning the stream index in the found program, and not the stream index in the list of all streams. The attached patch fixes this issue. Signed-off-by: Mans Rullgard <mans@mansr.com> (cherry picked from commit 22ec6b738f1608e4b959fb655cf37c3343ec7e9f)
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 2827930737..73f26b39c2 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2529,7 +2529,7 @@ int av_find_best_stream(AVFormatContext *ic,
if (best_count >= st->codec_info_nb_frames)
continue;
best_count = st->codec_info_nb_frames;
- ret = i;
+ ret = program ? program[i] : i;
best_decoder = decoder;
if (program && i == nb_streams - 1 && ret < 0) {
program = NULL;