[FFmpeg-devel] [PATCH] round-robin like scheduling for multichannel inputs. Important in case of capture devices. Else the first channel is preferred always.
Roman Sidler
sidse007 at gmail.com
Tue Nov 6 14:15:10 EET 2018
---
fftools/ffmpeg.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index da4259a9a8..fa54421d73 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3869,12 +3869,14 @@ static int need_output(void)
*/
static OutputStream *choose_output(void)
{
- int i;
+ int i,_i;
+ static int last_i;
int64_t opts_min = INT64_MAX;
OutputStream *ost_min = NULL;
for (i = 0; i < nb_output_streams; i++) {
- OutputStream *ost = output_streams[i];
+ _i = (last_i + 1 + i) %nb_output_streams;
+ OutputStream *ost = output_streams[_i];
int64_t opts = ost->st->cur_dts == AV_NOPTS_VALUE ? INT64_MIN :
av_rescale_q(ost->st->cur_dts, ost->st->time_base,
AV_TIME_BASE_Q);
@@ -3889,6 +3891,8 @@ static OutputStream *choose_output(void)
ost_min = ost->unavailable ? NULL : ost;
}
}
+ if (ost_min)
+ last_i = ost_min->file_index;
return ost_min;
}
--
2.14.1.windows.1
More information about the ffmpeg-devel
mailing list