Commit 33af787d authored by Balint Marton's avatar Balint Marton Committed by Michael Niedermayer

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: 's avatarMans Rullgard <mans@mansr.com>
(cherry picked from commit 22ec6b73)
parent 20bc55ce
...@@ -2529,7 +2529,7 @@ int av_find_best_stream(AVFormatContext *ic, ...@@ -2529,7 +2529,7 @@ int av_find_best_stream(AVFormatContext *ic,
if (best_count >= st->codec_info_nb_frames) if (best_count >= st->codec_info_nb_frames)
continue; continue;
best_count = st->codec_info_nb_frames; best_count = st->codec_info_nb_frames;
ret = i; ret = program ? program[i] : i;
best_decoder = decoder; best_decoder = decoder;
if (program && i == nb_streams - 1 && ret < 0) { if (program && i == nb_streams - 1 && ret < 0) {
program = NULL; program = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment