Re: [FFmpeg-devel] [PATCH] avformat/concatdec: port to the new bitstream filter API

2017-04-29 Thread James Almer
On 4/28/2017 9:16 PM, James Almer wrote:
> On 4/27/2017 10:59 PM, Michael Niedermayer wrote:
>> On Wed, Apr 26, 2017 at 04:40:55PM -0300, James Almer wrote:
>>> Signed-off-by: James Almer 
>>> ---
>>>  libavformat/concatdec.c | 86 
>>> +++--
>>>  1 file changed, 26 insertions(+), 60 deletions(-)
>>
>> breaks
>> ./ffmpeg -f concat -i ~/tickets/3108/concatfile.txt -codec copy test.avi
>> (output produces many warnings/errors on playback)
>> https://trac.ffmpeg.org/raw-attachment/ticket/3108/examplefiles.zip
> 
> Huh, this was more broken than i thought. Apparently, concatdec was
> never really filtering anything before this patch.
> 
> detect_stream_specific() frees up the stream's extradata before the code
> ever has the chance to call the bsf init function because, despite the
> name, the compat code in av_bitstream_filter_init() does not call it.
> That only happens in the first av_bitstream_filter_filter() call. The
> h264_mp4toannexb bsf looks at extradata during init to figure out if it
> needs to filter anything or just do a packet passthrough.
> That aside, concatdec was also copying the input file's stream extradata
> to the matched output stream extradata *before* it called
> detect_stream_specific(), so any filtered extradata would have been
> ignored anyway.
> 
> I don't know if this started happening after the new bsf API was
> introduced and the old converted into a wrapper for the new, or if it
> was always like this, but after this conversion it will not matter.

Commit 0cb19c30c6 essentially disabled the bsf.

The "fix" it mentions is because matroska stores avcc instead of annexb,
so it just muxed the stream untouched. This means actual filtering was
broken beforehand, probably by b8fa374fb6 (Letting unfiltered extradata
make it to the output file's matched stream while the actual h264 stream
was filtered).
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v3 2/2] avfilter/interlace: add complex vertical low-pass filter

2017-04-29 Thread Thomas Mundt
2017-04-20 23:54 GMT+02:00 Thomas Mundt :

> Patch attached...
>
> Ping
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2] avcodec/pthread_frame, decode: allow errors to happen on draining

2017-04-29 Thread Muhammad Faiz
On Sat, Apr 29, 2017 at 6:18 AM, Muhammad Faiz  wrote:
> On Sat, Apr 29, 2017 at 6:01 AM, Michael Niedermayer
>  wrote:
>> On Fri, Apr 28, 2017 at 11:23:10PM +0700, Muhammad Faiz wrote:
>>> On Fri, Apr 28, 2017 at 5:55 PM, Ronald S. Bultje  
>>> wrote:
>>> > Hi,
>>> >
>>> > On Fri, Apr 28, 2017 at 6:19 AM, Muhammad Faiz  wrote:
>>> >>
>>> >> So, all frames and errors are correctly reported in order.
>>> >> Also limit the numbers of error during draining to prevent infinite loop.
>>> >>
>>> >> This fix fate failure with THREADS>=4:
>>> >>   make fate-h264-attachment-631 THREADS=4
>>> >> This also reverts a755b725ec1d657609c8bd726ce37e7cf193d03f.
>>> >>
>>> >> Suggested-by: wm4, Ronald S. Bultje, Marton Balint
>>> >> Signed-off-by: Muhammad Faiz 
>>> >> ---
>>> >>  libavcodec/decode.c| 21 +++--
>>> >>  libavcodec/internal.h  |  3 +++
>>> >>  libavcodec/pthread_frame.c | 15 +++
>>> >>  3 files changed, 29 insertions(+), 10 deletions(-)
>>> >>
>>> >> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
>>> >> index 6ff3c40..edfae55 100644
>>> >> --- a/libavcodec/decode.c
>>> >> +++ b/libavcodec/decode.c
>>> >> @@ -568,8 +568,24 @@ FF_ENABLE_DEPRECATION_WARNINGS
>>> >>  avctx->time_base = av_inv_q(av_mul_q(avctx->framerate,
>>> >> (AVRational){avctx->ticks_per_frame, 1}));
>>> >>  #endif
>>> >>
>>> >> -if (avctx->internal->draining && !got_frame)
>>> >> -avci->draining_done = 1;
>>> >> +/* do not stop draining when got_frame != 0 or ret < 0 */
>>> >> +if (avctx->internal->draining && !got_frame) {
>>> >> +if (ret < 0) {
>>> >> +/* prevent infinite loop if a decoder wrongly always return
>>> >> error on draining */
>>> >> +/* reasonable nb_errors_max = maximum b frames + thread 
>>> >> count
>>> >> */
>>> >> +int nb_errors_max = 20 + (HAVE_THREADS &&
>>> >> avctx->active_thread_type & FF_THREAD_FRAME ?
>>> >> +avctx->thread_count : 1);
>>> >> +
>>> >> +if (avci->nb_draining_errors++ >= nb_errors_max) {
>>> >> +av_log(avctx, AV_LOG_ERROR, "Too many errors when
>>> >> draining, this is a bug. "
>>> >> +   "Stop draining and force EOF.\n");
>>> >> +avci->draining_done = 1;
>>> >> +ret = AVERROR_BUG;
>>> >> +}
>>> >> +} else {
>>> >> +avci->draining_done = 1;
>>> >> +}
>>> >> +}
>>> >
>>> >
>>> > Hm... I guess this is OK, it would be really nice to have a way of 
>>> > breaking
>>> > in developer builds (e.g. av_assert or so, although I guess technically 
>>> > this
>>> > could be enabled in prod builds also).
>>>
>>> Add av_assert2().
>>>
>>> >
>>> > Also, Marton suggested to return AVERROR_EOF, maybe handle that here also 
>>> > in
>>> > addition to ret=0?
>>>
>>> Modified.
>>>
>>> Updated patch attached.
>>>
>>> Thank's
>>
>>>  decode.c|   23 +--
>>>  internal.h  |3 +++
>>>  pthread_frame.c |   15 +++
>>>  3 files changed, 31 insertions(+), 10 deletions(-)
>>> d3049c52598070baa9566fc98a089111732595fa  
>>> 0001-avcodec-pthread_frame-decode-allow-errors-to-happen-.patch
>>> From f684770e016fa36d458d08383065815882cbc7f8 Mon Sep 17 00:00:00 2001
>>> From: Muhammad Faiz 
>>> Date: Fri, 28 Apr 2017 17:08:39 +0700
>>> Subject: [PATCH v3] avcodec/pthread_frame, decode: allow errors to happen on
>>>  draining
>>>
>>> So, all frames and errors are correctly reported in order.
>>> Also limit the number of errors during draining to prevent infinite loop.
>>> Also return AVERROR_EOF directly on EOF instead of only setting 
>>> draining_done.
>>>
>>> This fix fate failure with THREADS>=4:
>>>   make fate-h264-attachment-631 THREADS=4
>>> This also reverts a755b725ec1d657609c8bd726ce37e7cf193d03f.
>>>
>>> Suggested-by: wm4, Ronald S. Bultje, Marton Balint
>>> Signed-off-by: Muhammad Faiz 
>>> ---
>>>  libavcodec/decode.c| 23 +--
>>>  libavcodec/internal.h  |  3 +++
>>>  libavcodec/pthread_frame.c | 15 +++
>>>  3 files changed, 31 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
>>> index 6ff3c40..fb4d4af 100644
>>> --- a/libavcodec/decode.c
>>> +++ b/libavcodec/decode.c
>>> @@ -568,8 +568,26 @@ FF_ENABLE_DEPRECATION_WARNINGS
>>>  avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, 
>>> (AVRational){avctx->ticks_per_frame, 1}));
>>>  #endif
>>>
>>> -if (avctx->internal->draining && !got_frame)
>>> -avci->draining_done = 1;
>>> +/* do not stop draining when got_frame != 0 or ret < 0 */
>>> +if (avctx->internal->draining && !got_frame) {
>>> +if (ret < 0) {
>>> +/* prevent infinite loop if a decoder wrongly always return 
>>> error on draining */
>>> +/* reasonable nb_errors_max = maximum b frames + thread count 
>>> */
>>> +int nb_errors_max = 20 + (HAVE_T

[FFmpeg-devel] [PATCH] avfilter/decode: do not treat discarded frames as eof when draining

2017-04-29 Thread Muhammad Faiz
Fix fate failures:
  make fate-mov THREADS=32

Signed-off-by: Muhammad Faiz 
---
 libavcodec/decode.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index edfae55..6ec423b 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -557,9 +557,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
 avci->showed_multi_packet_warning = 1;
 }
 
-if (!got_frame)
-av_frame_unref(frame);
-
 if (ret >= 0 && avctx->codec->type == AVMEDIA_TYPE_VIDEO && !(avctx->flags 
& AV_CODEC_FLAG_TRUNCATED))
 ret = pkt->size;
 
@@ -568,8 +565,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
 avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, 
(AVRational){avctx->ticks_per_frame, 1}));
 #endif
 
-/* do not stop draining when got_frame != 0 or ret < 0 */
-if (avctx->internal->draining && !got_frame) {
+/* do not stop draining when frame->buf[0] != NULL or ret < 0 */
+/* at this point, got_frame == 0 when discarding frame */
+if (avctx->internal->draining && !frame->buf[0]) {
 if (ret < 0) {
 /* prevent infinite loop if a decoder wrongly always return error 
on draining */
 /* reasonable nb_errors_max = maximum b frames + thread count */
@@ -603,7 +601,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
 avci->last_pkt_props->dts = AV_NOPTS_VALUE;
 }
 
-if (got_frame)
+if (!got_frame)
+av_frame_unref(frame);
+else
 av_assert0(frame->buf[0]);
 
 return ret < 0 ? ret : 0;
-- 
2.9.3

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel