On Mon, Feb 16, 2015 at 10:22:17PM +0100, Nicolas George wrote: > The current value, 8, is too low to be really useful. > The heuristic tries to allocate enough room for 10 seconds. > > Signed-off-by: Nicolas George <geo...@nsup.org> > --- > ffmpeg.c | 26 ++++++++++++++++++++++++-- > 1 file changed, 24 insertions(+), 2 deletions(-) > > > On my hardware, recording from v4l2 and ALSA produces ALSA underruns if the > message queue is below ~256-512. > > > diff --git a/ffmpeg.c b/ffmpeg.c > index a52de20..990ce9e 100644 > --- a/ffmpeg.c > +++ b/ffmpeg.c > @@ -3412,9 +3412,29 @@ static void free_input_threads(void) > } > } > > +static int eval_thread_queue_size(InputFile *f) > +{ > + int i, s; > + int64_t sec = 10, fps = 0; > + > + for (i = 0; i < f->ctx->nb_streams; i++) { > + AVStream *st = f->ctx->streams[i]; > + AVCodecContext *c = st->codec; > + if (c->sample_rate && c->frame_size) { > + fps += sec * (c->sample_rate / c->frame_size + 1); > + } else if (st->avg_frame_rate.num && st->avg_frame_rate.den) { > + fps += 1 + av_rescale(sec, st->avg_frame_rate.num, > st->avg_frame_rate.den); > + } else { > + fps += 25 * sec; > + } > + } > + s = FFMAX(3, FFMIN(20, av_log2(fps) + 1));
iam a bit concerned about the possibility of this unneccesarily allocating a million packets i think IIUC this amount will actually be alloated no matter if its needed or not [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is dangerous to be right in matters on which the established authorities are wrong. -- Voltaire
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel