On Wed, Jun 28, 2017 at 03:02:42PM +0300, ffm...@a.legko.ru wrote: > > subject: when input sample stops, input thread stops too (withous > restart), thus, breaking the streaming and loop mode does not affect > this. touches only multistream (multiprog) mode, when threads are > used. >
> ffmpeg.c | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) > 0884edd00a6d3466d157519a0d48763545f44087 > 0001-add-support-for-samples-looping-threaded-mode-thread.patch > From d8310311a3c1a1828eacd4b45b31f9a723b5ee2b Mon Sep 17 00:00:00 2001 > From: root <ffm...@scil.sinp.msu.ru> Missing name (unless you do not want to have your name in the Author field) > Date: Wed, 28 Jun 2017 14:53:40 +0300 > Subject: [PATCH 1/3] add support for samples looping (threaded mode; thread > stops after decoding input) > > --- > ffmpeg.c | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) > > diff --git a/ffmpeg.c b/ffmpeg.c > index a783e6e..2866754 100644 > --- a/ffmpeg.c > +++ b/ffmpeg.c > @@ -4013,6 +4013,29 @@ static void free_input_threads(void) > } > } > > +static int init_input_thread(int i) > +{ > + int ret; > + > + if (nb_input_files == 1) > + return 0; > + > + InputFile *f = input_files[i]; mixing declaration and statment > + if (f->ctx->pb ? !f->ctx->pb->seekable : > + strcmp(f->ctx->iformat->name, "lavfi")) > + f->non_blocking = 1; > + ret = av_thread_message_queue_alloc(&f->in_thread_queue, > + f->thread_queue_size, sizeof(AVPacket)); > + if (ret < 0) > + return ret; > + if ((ret = pthread_create(&f->thread, NULL, input_thread, f))) { > + av_log(NULL, AV_LOG_ERROR, "pthread_create failed: %s. Try to > increase `ulimit -v` or decrease `ulimit -s`.\n", strerror(ret)); > + av_thread_message_queue_free(&f->in_thread_queue); > + return AVERROR(ret); > + } > +return 0; the indention is inconsistent > +} > + > static int init_input_threads(void) > { > int i, ret; > @@ -4191,9 +4214,13 @@ static int process_input(int file_index) > ifile->eagain = 1; > return ret; > } > + > if (ret < 0 && ifile->loop) { > if ((ret = seek_to_start(ifile, is)) < 0) > return ret; > +#if HAVE_PTHREADS > + init_input_thread(file_index); The function returns an error code which is never used > +#endif > ret = get_input_packet(ifile, &pkt); > if (ret == AVERROR(EAGAIN)) { > ifile->eagain = 1; > -- > 2.7.4 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The worst form of inequality is to try to make unequal things equal. -- Aristotle
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel