Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg: add option to hide vsync warnings

2018-06-26 Thread Gyan Doshi



On 27-06-2018 06:33 AM, Marton Balint wrote:



Maybe we should disable the message for CFR only?


First question is, who is the message meant for? End-users can't do 
anything with it. At most, a one-time message is fine, similar to the 
"More than 1000 frames duplicated" message.


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


Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg: add option to hide vsync warnings

2018-06-26 Thread Marton Balint



On Wed, 27 Jun 2018, Michael Niedermayer wrote:


On Tue, Jun 26, 2018 at 05:13:36PM +0530, Gyan Doshi wrote:



On 26-06-2018 04:29 PM, Marton Balint wrote:


Many users have queried/complained about the 'Past duration too large'
messages.


If the message is useless, then why not remove it entirely?


Good question. Don't see the point but Michael added it (4e20e94921) so may
have some use for it that I'm missing.

Thoughts, Michael?


I think, the condition shouldnt happen really


Why not? For CFR output frames are dropped if delta0 < -1.1, but an error 
is reported if delta0 < -0.6. So delta0 can remain indefinitely between 
-1.1 and -0.6 spamming the console endlessly.


Or am I missing something?


its a while ago i worked with this part but if when the previous frame
is processed the code thinks it it will last at minimum till X and then
when processing the next frame that starts significantgly before X.
It would seem that something somewhere isnt working correctly


Maybe we should disable the message for CFR only?

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


Re: [FFmpeg-devel] [FFmpeg-cvslog] lavfi: add opencl tonemap filter

2018-06-26 Thread Michael Niedermayer
On Tue, Jun 26, 2018 at 04:22:42AM +, Song, Ruiling wrote:
> 
> 
> > -Original Message-
> > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> > Michael Niedermayer
> > Sent: Friday, June 22, 2018 2:32 AM
> > To: ffmpeg-devel@ffmpeg.org
> > Subject: Re: [FFmpeg-devel] [FFmpeg-cvslog] lavfi: add opencl tonemap filter
> > 
> > On Thu, Jun 21, 2018 at 12:23:26AM +, Ruiling Song wrote:
> > > ffmpeg | branch: master | Ruiling Song  | Tue Jun 
> > > 19
> > 09:57:31 2018 +0800| [8b8b0e2cd26cf1f522c630859fcbcc62b6493fb9] |
> > committer: Mark Thompson
> > >
> > > lavfi: add opencl tonemap filter
> > >
> > > This filter does HDR(HDR10/HLG) to SDR conversion with tone-mapping.
> > >
> > > An example command to use this filter with vaapi codecs:
> > > FFMPEG -init_hw_device vaapi=va:/dev/dri/renderD128 -init_hw_device \
> > > opencl=ocl@va -hwaccel vaapi -hwaccel_device va -hwaccel_output_format \
> > > vaapi -i INPUT -filter_hw_device ocl -filter_complex \
> > > '[0:v]hwmap,tonemap_opencl=t=bt2020:tonemap=linear:format=p010[x1]; \
> > > [x1]hwmap=derive_device=vaapi:reverse=1' -c:v hevc_vaapi -profile 2
> > OUTPUT
> > >
> > > Signed-off-by: Ruiling Song 
> > >
> > > >
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8b8b0e2cd26cf1f5
> > 22c630859fcbcc62b6493fb9
> > > ---
> > >
> > >  configure   |   1 +
> > >  libavfilter/Makefile|   2 +
> > >  libavfilter/allfilters.c|   1 +
> > >  libavfilter/colorspace.c|  90 +
> > >  libavfilter/colorspace.h|  41 +++
> > >  libavfilter/opencl/colorspace_common.cl | 220 +++
> > >  libavfilter/opencl/tonemap.cl   | 272 ++
> > >  libavfilter/opencl_source.h |   2 +
> > >  libavfilter/vf_tonemap_opencl.c | 624
> > 
> > >  9 files changed, 1253 insertions(+)
> > >
> > > diff --git a/configure b/configure
> > > index 8ca258691d..6ad5ce8eaf 100755
> > > --- a/configure
> > > +++ b/configure
> > > @@ -3412,6 +3412,7 @@ tinterlace_filter_deps="gpl"
> > >  tinterlace_merge_test_deps="tinterlace_filter"
> > >  tinterlace_pad_test_deps="tinterlace_filter"
> > >  tonemap_filter_deps="const_nan"
> > > +tonemap_opencl_filter_deps="opencl const_nan"
> > >  unsharp_opencl_filter_deps="opencl"
> > >  uspp_filter_deps="gpl avcodec"
> > >  vaguedenoiser_filter_deps="gpl"
> > > diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> > > index 552499558d..589682f353 100644
> > > --- a/libavfilter/Makefile
> > > +++ b/libavfilter/Makefile
> > > @@ -358,6 +358,8 @@ OBJS-$(CONFIG_TINTERLACE_FILTER) +=
> > vf_tinterlace.o
> > >  OBJS-$(CONFIG_TLUT2_FILTER)  += vf_lut2.o framesync.o
> > >  OBJS-$(CONFIG_TMIX_FILTER)   += vf_mix.o framesync.o
> > >  OBJS-$(CONFIG_TONEMAP_FILTER)+= vf_tonemap.o
> > > +OBJS-$(CONFIG_TONEMAP_OPENCL_FILTER) += vf_tonemap_opencl.o
> > colorspace.o opencl.o \
> > > +opencl/tonemap.o 
> > > opencl/colorspace_common.o
> > >  OBJS-$(CONFIG_TRANSPOSE_FILTER)  += vf_transpose.o
> > >  OBJS-$(CONFIG_TRIM_FILTER)   += trim.o
> > >  OBJS-$(CONFIG_UNPREMULTIPLY_FILTER)  += vf_premultiply.o
> > framesync.o
> > > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> > > index 2b44626028..e07fe67ec5 100644
> > > --- a/libavfilter/allfilters.c
> > > +++ b/libavfilter/allfilters.c
> > > @@ -346,6 +346,7 @@ extern AVFilter ff_vf_tinterlace;
> > >  extern AVFilter ff_vf_tlut2;
> > >  extern AVFilter ff_vf_tmix;
> > >  extern AVFilter ff_vf_tonemap;
> > > +extern AVFilter ff_vf_tonemap_opencl;
> > >  extern AVFilter ff_vf_transpose;
> > >  extern AVFilter ff_vf_trim;
> > >  extern AVFilter ff_vf_unpremultiply;
> > > diff --git a/libavfilter/colorspace.c b/libavfilter/colorspace.c
> > > new file mode 100644
> > > index 00..7fd7bdf0d9
> > > --- /dev/null
> > > +++ b/libavfilter/colorspace.c
> > > @@ -0,0 +1,90 @@
> > > +/*
> > > + * Copyright (c) 2016 Ronald S. Bultje 
> > > + * This file is part of FFmpeg.
> > > + *
> > > + * FFmpeg is free software; you can redistribute it and/or
> > > + * modify it under the terms of the GNU Lesser General Public
> > > + * License as published by the Free Software Foundation; either
> > > + * version 2.1 of the License, or (at your option) any later version.
> > > + *
> > > + * FFmpeg is distributed in the hope that it will be useful,
> > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> > > + * Lesser General Public License for more details.
> > > + *
> > > + * You should have received a copy of the GNU Lesser General Public
> > > + * License along with FFmpeg; if not, write to the Free Software
> > > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 

Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg: add option to hide vsync warnings

2018-06-26 Thread Michael Niedermayer
On Tue, Jun 26, 2018 at 05:13:36PM +0530, Gyan Doshi wrote:
> 
> 
> On 26-06-2018 04:29 PM, Marton Balint wrote:
> 
> >>Many users have queried/complained about the 'Past duration too large'
> >>messages.
> >
> >If the message is useless, then why not remove it entirely?
> 
> Good question. Don't see the point but Michael added it (4e20e94921) so may
> have some use for it that I'm missing.
> 
> Thoughts, Michael?

I think, the condition shouldnt happen really

its a while ago i worked with this part but if when the previous frame
is processed the code thinks it it will last at minimum till X and then
when processing the next frame that starts significantgly before X.
It would seem that something somewhere isnt working correctly

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Take away the freedom of one citizen and you will be jailed, take away
the freedom of all citizens and you will be congratulated by your peers
in Parliament.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [FFmpeg-cvslog] lavfi: add opencl tonemap filter

2018-06-26 Thread Carl Eugen Hoyos
2018-06-26 6:22 GMT+02:00, Song, Ruiling :

> Basically I think we have three ways to handle it:
> a.) ignore the warning.

This is the worst solution as it may hide other, useful warnings.

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


Re: [FFmpeg-devel] [PATCH] libavcodec: v4l2m2m: make sure to unref avpkt

2018-06-26 Thread Jorge Ramirez-Ortiz

On 06/26/2018 11:36 PM, Lukas Rusak wrote:

This was found using valgrind. Using this patch there is no more memleak 
present.
---
  libavcodec/v4l2_m2m_dec.c | 5 -
  1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
index 598dc10781..710e40efd8 100644
--- a/libavcodec/v4l2_m2m_dec.c
+++ b/libavcodec/v4l2_m2m_dec.c
@@ -149,11 +149,14 @@ static int v4l2_receive_frame(AVCodecContext *avctx, 
AVFrame *frame)
  
  if (avpkt.size) {

  ret = v4l2_try_start(avctx);
-if (ret)
+if (ret) {
+av_packet_unref(&avpkt);
  return 0;
+}
  }
  
  dequeue:

+av_packet_unref(&avpkt);
  return ff_v4l2_context_dequeue_frame(capture, frame);
  }
  


ack'd and tested

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


[FFmpeg-devel] [PATCH] libavcodec: v4l2m2m: make sure to unref avpkt

2018-06-26 Thread Lukas Rusak
This was found using valgrind. Using this patch there is no more memleak 
present.
---
 libavcodec/v4l2_m2m_dec.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
index 598dc10781..710e40efd8 100644
--- a/libavcodec/v4l2_m2m_dec.c
+++ b/libavcodec/v4l2_m2m_dec.c
@@ -149,11 +149,14 @@ static int v4l2_receive_frame(AVCodecContext *avctx, 
AVFrame *frame)
 
 if (avpkt.size) {
 ret = v4l2_try_start(avctx);
-if (ret)
+if (ret) {
+av_packet_unref(&avpkt);
 return 0;
+}
 }
 
 dequeue:
+av_packet_unref(&avpkt);
 return ff_v4l2_context_dequeue_frame(capture, frame);
 }
 
-- 
2.17.0

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


Re: [FFmpeg-devel] [PATCH] avutil/encryption_info: Fix documentation problem.

2018-06-26 Thread Carl Eugen Hoyos
2018-06-26 18:32 GMT+02:00, Jacob Trimble :
> Signed-off-by: Jacob Trimble 
> ---
>  libavutil/encryption_info.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavutil/encryption_info.h b/libavutil/encryption_info.h
> index 9140968fde..8fe7ebfe43 100644
> --- a/libavutil/encryption_info.h
> +++ b/libavutil/encryption_info.h
> @@ -129,7 +129,7 @@ typedef struct AVEncryptionInitInfo {
>   *
>   * @param subsample_count The number of subsamples.
>   * @param key_id_size The number of bytes in the key ID, should be 16.
> - * @param key_id_size The number of bytes in the IV, should be 16.
> + * @param iv_size The number of bytes in the IV, should be 16.

Unrelated to this patch but since you work on this code:
Could you add a comment to the existing documentation
that our security function were written with performance
in mind (as makes sense for multimedia usage) but no
precautions against side-channel attacks were taken?

Thank you, Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [FFmpeg-cvslog] lavf/amr: Make the heuristic for auto-detection even stricter.

2018-06-26 Thread Carl Eugen Hoyos
2018-06-26 1:45 GMT+02:00, Michael Niedermayer :
> On Mon, Jun 25, 2018 at 11:22:31PM +0200, Carl Eugen Hoyos wrote:
>> 2018-06-23 14:43 GMT+02:00, Michael Niedermayer :
>> > On Thu, Jun 21, 2018 at 10:09:14PM +, Carl Eugen Hoyos wrote:
>> >> ffmpeg | branch: master | Carl Eugen Hoyos  | Fri
>> >> Jun
>> >> 22 00:08:13 2018 +0200| [40b7e6071815fc416a4efc5dc1616f5460a3aacb] |
>> >> committer: Carl Eugen Hoyos
>> >>
>> >> lavf/amr: Make the heuristic for auto-detection even stricter.
>> >>
>> >> Fixes ticket #7270.
>> >>
>> >> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=40b7e6071815fc416a4efc5dc1616f5460a3aacb
>> >> ---
>> >>
>> >>  libavformat/amr.c | 6 +++---
>> >>  1 file changed, 3 insertions(+), 3 deletions(-)
>> >>
>> >> diff --git a/libavformat/amr.c b/libavformat/amr.c
>> >> index f954803d46..6cc06bceac 100644
>> >> --- a/libavformat/amr.c
>> >> +++ b/libavformat/amr.c
>> >> @@ -201,7 +201,7 @@ static int amrnb_probe(AVProbeData *p)
>> >>  i++;
>> >>  }
>> >>  }
>> >> -if (valid > 100 && valid > invalid)
>> >> +if (valid > 100 && valid >> 4 > invalid)
>> >>  return AVPROBE_SCORE_EXTENSION / 2 + 1;
>> >>  return 0;
>> >>  }
>> >> @@ -258,8 +258,8 @@ static int amrwb_probe(AVProbeData *p)
>> >>  i++;
>> >>  }
>> >>  }
>> >> -if (valid > 100 && valid > invalid)
>> >> -return AVPROBE_SCORE_EXTENSION / 2 - 1;
>> >> +if (valid > 100 && valid >> 4 > invalid)
>> >> +return AVPROBE_SCORE_EXTENSION / 2 + 1;
>> >
>> > This breaks detecting the h263 file:
>> >
>> > https://samples.ffmpeg.org/V-codecs/h263/h263-raw/messenger.h263
>>
>> Attached patch fixes the existing heuristic to avoid detection of files
>> like this one.
>>
>> Sorry, Carl Eugen
>
>>  amr.c |6 ++
>>  1 file changed, 2 insertions(+), 4 deletions(-)
>> 4b51c43bba3a8a286dc8d8239936d615ab733ec5
>> 0001-lavf-amr-Fix-heuristic-to-avoid-detection-of-repeate.patch
>> From 3bfac3c9a525e8ce92c025ee2853a600d71e64d5 Mon Sep 17 00:00:00 2001
>> From: Carl Eugen Hoyos 
>> Date: Mon, 25 Jun 2018 23:20:09 +0200
>> Subject: [PATCH] lavf/amr: Fix heuristic to avoid detection of repeated
>>  bytes.
>
> LGTM

Patch applied.

Thank you, Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avdevice/xcbgrab: check return values of xcb query functions

2018-06-26 Thread Carl Eugen Hoyos
2018-06-26 17:42 GMT+02:00, Moritz Barsnick :

> @@ -425,8 +435,9 @@ static int xcbgrab_read_packet
>  xcbgrab_draw_mouse(s, pkt, p, geo);
>  #endif
>
> -free(p);
> -free(geo);
> +fail:
> +av_free(p);
> +av_free(geo);

I suspect this is incorrect, if it is correct, it should be a separate patch.

Thank you, Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] tests/fate/demux: Add test for d25c945247979a88fac6bb3b7a26370262b96ef1

2018-06-26 Thread Michael Niedermayer
Sample provided by Thierry for fate

Signed-off-by: Michael Niedermayer 
---
 tests/fate/demux.mak  |  3 ++
 tests/ref/fate/ts-small-demux | 80 +++
 2 files changed, 83 insertions(+)
 create mode 100644 tests/ref/fate/ts-small-demux

diff --git a/tests/fate/demux.mak b/tests/fate/demux.mak
index ef9e677821..eb8d8c3655 100644
--- a/tests/fate/demux.mak
+++ b/tests/fate/demux.mak
@@ -76,6 +76,9 @@ fate-mov-mp3-demux: CMD = framecrc -i 
$(TARGET_SAMPLES)/mpegaudio/packed_maindat
 FATE_SAMPLES_DEMUX-$(CONFIG_MPEGTS_DEMUXER) += fate-ts-opus-demux
 fate-ts-opus-demux: CMD = framecrc -i 
$(TARGET_SAMPLES)/opus/test-8-7.1.opus-small.ts -c copy
 
+FATE_SAMPLES_DEMUX-$(CONFIG_MPEGTS_DEMUXER) += fate-ts-small-demux
+fate-ts-small-demux: CMD = framecrc -i $(TARGET_SAMPLES)/mpegts/h264small.ts 
-c copy
+
 FATE_SAMPLES_DEMUX-$(CONFIG_MTV_DEMUXER) += fate-mtv
 fate-mtv: CMD = framecrc -i $(TARGET_SAMPLES)/mtv/comedian_auto-partial.mtv -c 
copy
 
diff --git a/tests/ref/fate/ts-small-demux b/tests/ref/fate/ts-small-demux
new file mode 100644
index 00..cdd7c09f27
--- /dev/null
+++ b/tests/ref/fate/ts-small-demux
@@ -0,0 +1,80 @@
+#extradata 0:   35, 0x83f4073d
+#tb 0: 1/9
+#media_type 0: video
+#codec_id 0: h264
+#dimensions 0: 82x144
+#sar 0: 1/1
+0,  0,  0, 6000, 1290, 0x4684e0ab, S=1,1, 
0x00e000e0
+0,   6000,   6000, 6000,   21, 0x267504dc, F=0x0, S=1,
1, 0x00e000e0
+0,  12000,  12000, 6000,   15, 0x0f9402f6, F=0x0, S=1,
1, 0x00e000e0
+0,  18000,  18000, 6000,   15, 0x0ff40316, F=0x0, S=1,
1, 0x00e000e0
+0,  24000,  24000, 6000,   15, 0x10540336, F=0x0, S=1,
1, 0x00e000e0
+0,  3,  3, 6000,   15, 0x10b40356, F=0x0, S=1,
1, 0x00e000e0
+0,  36000,  36000, 6000,   15, 0x11140376, F=0x0, S=1,
1, 0x00e000e0
+0,  42000,  42000, 6000,   15, 0x11740396, F=0x0, S=1,
1, 0x00e000e0
+0,  48000,  48000, 6000,   15, 0x0ed802b7, F=0x0, S=1,
1, 0x00e000e0
+0,  54000,  54000, 6000,   15, 0x0f3802d7, F=0x0, S=1,
1, 0x00e000e0
+0,  6,  6, 6000,   15, 0x0f9802f7, F=0x0, S=1,
1, 0x00e000e0
+0,  66000,  66000, 6000,   15, 0x0ff80317, F=0x0, S=1,
1, 0x00e000e0
+0,  72000,  72000, 6000,   15, 0x10580337, F=0x0, S=1,
1, 0x00e000e0
+0,  78000,  78000, 6000,   15, 0x10b80357, F=0x0, S=1,
1, 0x00e000e0
+0,  84000,  84000, 6000,   15, 0x11180377, F=0x0, S=1,
1, 0x00e000e0
+0,  9,  9, 6000,   15, 0x11780397, F=0x0, S=1,
1, 0x00e000e0
+0,  96000,  96000, 6000,   15, 0x0ed402b6, F=0x0, S=1,
1, 0x00e000e0
+0, 102000, 102000, 6000,   15, 0x0f3402d6, F=0x0, S=1,
1, 0x00e000e0
+0, 108000, 108000, 6000,   15, 0x0f9402f6, F=0x0, S=1,
1, 0x00e000e0
+0, 114000, 114000, 6000,   15, 0x0ff40316, F=0x0, S=1,
1, 0x00e000e0
+0, 12, 12, 6000,   15, 0x10540336, F=0x0, S=1,
1, 0x00e000e0
+0, 126000, 126000, 6000,   15, 0x10b40356, F=0x0, S=1,
1, 0x00e000e0
+0, 132000, 132000, 6000,   15, 0x11140376, F=0x0, S=1,
1, 0x00e000e0
+0, 138000, 138000, 6000,   15, 0x11740396, F=0x0, S=1,
1, 0x00e000e0
+0, 144000, 144000, 6000,   15, 0x0ed802b7, F=0x0, S=1,
1, 0x00e000e0
+0, 15, 15, 6000,   15, 0x0f3802d7, F=0x0, S=1,
1, 0x00e000e0
+0, 156000, 156000, 6000,   15, 0x0f9802f7, F=0x0, S=1,
1, 0x00e000e0
+0, 162000, 162000, 6000,   15, 0x0ff80317, F=0x0, S=1,
1, 0x00e000e0
+0, 168000, 168000, 6000,   15, 0x10580337, F=0x0, S=1,
1, 0x00e000e0
+0, 174000, 174000, 6000,   15, 0x10b80357, F=0x0, S=1,
1, 0x00e000e0
+0, 18, 18, 6000,   15, 0x11180377, F=0x0, S=1,
1, 0x00e000e0
+0, 186000, 186000, 6000,   15, 0x11780397, F=0x0, S=1,
1, 0x00e000e0
+0, 192000, 192000, 6000,   15, 0x0ed402b6, F=0x0, S=1,
1, 0x00e000e0
+0, 198000, 198000, 6000,   15, 0x0f3402d6, F=0x0, S=1,
1, 0x00e000e0
+0, 204000, 204000, 6000,   15, 0x0f9402f6, F=0x0, S=1,
1, 0x00e000e0
+0, 21, 21, 6000,   15, 0x0ff40316, F=0x0, S=1,
1, 0x00e000e0
+0, 216000, 216000, 6000,   15, 0x10540336, F=0x0, S=1,
1, 0x00e000e0
+0, 222000, 222000, 6000,   15, 0x10b40356, F=0x0, S=1,
1, 0x00e000e0
+0, 228000, 228000, 6000,   15, 0x11140376, F=0x0, S=1,
1, 0x00e000e0
+0, 234000, 234000, 60

Re: [FFmpeg-devel] [PATCH] Fix heap buffer overflow in ff_combine_frame

2018-06-26 Thread Michael Niedermayer
On Tue, Jun 26, 2018 at 07:02:38PM +0800, Baozeng Ding wrote:
> Signed-off-by: Baozeng Ding 
> ---
>  libavcodec/parser.c | 10 +++---
>  1 file changed, 7 insertions(+), 3 deletions(-)

This looks wrong. The input must have AV_INPUT_BUFFER_PADDING_SIZE
allocated at the end.

Is the buffer you pass into the parser large enough ?
this and the source code ive seen looked like it is too small

thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavutil/encryption_info: Add unit tests.

2018-06-26 Thread Jacob Trimble
On Mon, Jun 25, 2018 at 5:30 PM Michael Niedermayer
 wrote:
>
> On Fri, Jun 01, 2018 at 12:51:48PM -0700, Jacob Trimble wrote:
> > Signed-off-by: Jacob Trimble 
> > ---
> >  libavutil/Makefile|   1 +
> >  libavutil/encryption_info.h   |   2 +-
> >  libavutil/tests/.gitignore|   2 +
> >  libavutil/tests/encryption_info.c | 176 ++
> >  tests/fate/libavutil.mak  |   4 +
> >  tests/ref/fate/encryption-info|   0
> >  6 files changed, 184 insertions(+), 1 deletion(-)
> >  create mode 100644 libavutil/tests/encryption_info.c
> >  create mode 100644 tests/ref/fate/encryption-info
> >
> > diff --git a/libavutil/Makefile b/libavutil/Makefile
> > index d0632f16a6..9ed24cfc82 100644
> > --- a/libavutil/Makefile
> > +++ b/libavutil/Makefile
> > @@ -200,6 +200,7 @@ TESTPROGS = adler32 
> > \
> >  des \
> >  dict\
> >  display \
> > +encryption_info \
> >  error   \
> >  eval\
> >  file\
>
> > diff --git a/libavutil/encryption_info.h b/libavutil/encryption_info.h
> > index 9140968fde..8fe7ebfe43 100644
> > --- a/libavutil/encryption_info.h
> > +++ b/libavutil/encryption_info.h
> > @@ -129,7 +129,7 @@ typedef struct AVEncryptionInitInfo {
> >   *
> >   * @param subsample_count The number of subsamples.
> >   * @param key_id_size The number of bytes in the key ID, should be 16.
> > - * @param key_id_size The number of bytes in the IV, should be 16.
> > + * @param iv_size The number of bytes in the IV, should be 16.
> >   *
> >   * @return The new AVEncryptionInfo structure, or NULL on error.
> >   */
>
> How is this related to adding a test ?
>

I guess it's unrelated, created a separate patch for it.

>
>
> > diff --git a/libavutil/tests/.gitignore b/libavutil/tests/.gitignore
> > index 71f75a8ee9..9d90827954 100644
> > --- a/libavutil/tests/.gitignore
> > +++ b/libavutil/tests/.gitignore
> > @@ -17,6 +17,7 @@
> >  /dict
> >  /display
> >  /error
> > +/encryption_info
> >  /eval
> >  /fifo
> >  /file
>
> > @@ -24,6 +25,7 @@
> >  /hmac
> >  /hwdevice
> >  /imgutils
> > +/integer
> >  /lfg
> >  /lls
> >  /log
>
> this also looks unrelated

Same.

>
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Opposition brings concord. Out of discord comes the fairest harmony.
> -- Heraclitus
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
From c97e44904020944e469faec18b9c279cb6d89b46 Mon Sep 17 00:00:00 2001
From: Jacob Trimble 
Date: Fri, 1 Jun 2018 11:38:05 -0700
Subject: [PATCH] libavutil/encryption_info: Add unit tests.

Signed-off-by: Jacob Trimble 
---
 libavutil/Makefile|   1 +
 libavutil/tests/.gitignore|   1 +
 libavutil/tests/encryption_info.c | 176 ++
 tests/fate/libavutil.mak  |   4 +
 tests/ref/fate/encryption-info|   0
 5 files changed, 182 insertions(+)
 create mode 100644 libavutil/tests/encryption_info.c
 create mode 100644 tests/ref/fate/encryption-info

diff --git a/libavutil/Makefile b/libavutil/Makefile
index d0632f16a6..9ed24cfc82 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -200,6 +200,7 @@ TESTPROGS = adler32 \
 des \
 dict\
 display \
+encryption_info \
 error   \
 eval\
 file\
diff --git a/libavutil/tests/.gitignore b/libavutil/tests/.gitignore
index 71f75a8ee9..d7de295617 100644
--- a/libavutil/tests/.gitignore
+++ b/libavutil/tests/.gitignore
@@ -17,6 +17,7 @@
 /dict
 /display
 /error
+/encryption_info
 /eval
 /fifo
 /file
diff --git a/libavutil/tests/encryption_info.c b/libavutil/tests/encryption_info.c
new file mode 100644
index 00..d489612b7d
--- /dev/null
+++ b/libavutil/tests/encryption_info.c
@@ -0,0 +1,176 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free

[FFmpeg-devel] [PATCH] avutil/gitignore: Ignore integer test binary.

2018-06-26 Thread Jacob Trimble
Signed-off-by: Jacob Trimble 
---
 libavutil/tests/.gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavutil/tests/.gitignore b/libavutil/tests/.gitignore
index 71f75a8ee9..bf07c57b75 100644
--- a/libavutil/tests/.gitignore
+++ b/libavutil/tests/.gitignore
@@ -24,6 +24,7 @@
 /hmac
 /hwdevice
 /imgutils
+/integer
 /lfg
 /lls
 /log
-- 
2.18.0.rc2.346.g013aa6912e-goog

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


[FFmpeg-devel] [PATCH] avutil/encryption_info: Fix documentation problem.

2018-06-26 Thread Jacob Trimble
Signed-off-by: Jacob Trimble 
---
 libavutil/encryption_info.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/encryption_info.h b/libavutil/encryption_info.h
index 9140968fde..8fe7ebfe43 100644
--- a/libavutil/encryption_info.h
+++ b/libavutil/encryption_info.h
@@ -129,7 +129,7 @@ typedef struct AVEncryptionInitInfo {
  *
  * @param subsample_count The number of subsamples.
  * @param key_id_size The number of bytes in the key ID, should be 16.
- * @param key_id_size The number of bytes in the IV, should be 16.
+ * @param iv_size The number of bytes in the IV, should be 16.
  *
  * @return The new AVEncryptionInfo structure, or NULL on error.
  */
-- 
2.18.0.rc2.346.g013aa6912e-goog

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


[FFmpeg-devel] [PATCH] avdevice/xcbgrab: check return values of xcb query functions

2018-06-26 Thread Moritz Barsnick
xcb_query_pointer_reply() and xcb_get_geometry_reply() return NULL
when the display drops. This needs to be checked in order to cleanly
exit, because the returned pointers are dereferenced later.

Signed-off-by: Moritz Barsnick 
---
 libavdevice/xcbgrab.c | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c
index 6d142abd4f..609445918b 100644
--- a/libavdevice/xcbgrab.c
+++ b/libavdevice/xcbgrab.c
@@ -404,7 +404,17 @@ static int xcbgrab_read_packet(AVFormatContext *s, 
AVPacket *pkt)
 pc  = xcb_query_pointer(c->conn, c->screen->root);
 gc  = xcb_get_geometry(c->conn, c->screen->root);
 p   = xcb_query_pointer_reply(c->conn, pc, NULL);
+if (!p) {
+av_log(c, AV_LOG_ERROR, "Could not get xcb pointer\n");
+ret = AVERROR(EIO);
+goto fail;
+}
 geo = xcb_get_geometry_reply(c->conn, gc, NULL);
+if (!geo) {
+av_log(c, AV_LOG_ERROR, "Could not get xcb geometry\n");
+ret = AVERROR_EOF;
+goto fail;
+}
 }
 
 if (c->follow_mouse && p->same_screen)
@@ -425,8 +435,9 @@ static int xcbgrab_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 xcbgrab_draw_mouse(s, pkt, p, geo);
 #endif
 
-free(p);
-free(geo);
+fail:
+av_free(p);
+av_free(geo);
 
 return ret;
 }
@@ -537,6 +548,10 @@ static int create_stream(AVFormatContext *s)
 
 gc  = xcb_get_geometry(c->conn, c->screen->root);
 geo = xcb_get_geometry_reply(c->conn, gc, NULL);
+if (!geo) {
+av_log(c, AV_LOG_ERROR, "Could not get xcb geometry\n");
+return AVERROR(EIO);
+}
 
 if (c->x + c->width > geo->width ||
 c->y + c->height > geo->height) {
-- 
2.14.4

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


Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg: add option to hide vsync warnings

2018-06-26 Thread Gyan Doshi



On 26-06-2018 04:29 PM, Marton Balint wrote:

Many users have queried/complained about the 'Past duration too large' 
messages.


If the message is useless, then why not remove it entirely?


Good question. Don't see the point but Michael added it (4e20e94921) so 
may have some use for it that I'm missing.


Thoughts, Michael?

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


[FFmpeg-devel] [libavformat/avio.c] how to handle small FLV packets with LIBRTMP integration enabled

2018-06-26 Thread Albert Andaluz Gonzalez
Hello everyone,
we use ffmpeg libraries to ingest our video streams using the RTMP protocol . 
So far we use the librtmp backend instead of the built-in implementation  since 
we  require  Flash url Autentication parameters  (needed for many CDN's ), 
Until now, we were using ffmpeg 2.7.0 successfully to do this  but as we 
upgraded to newer master builds (i.e, 387464b) we found that many times 
av_interleaved_write calls would be stuck when writing small audio or video 
packets .

Since we could not find a definitive cause for this , we built ffmpeg & librmtp 
libraries in debug mode to review the call stack. We have discovered that when 
our program hangs the retry_transfer_wrapper (avio.c) loop never breaks:

https://github.com/FFmpeg/FFmpeg/blob/4ac88ba5487e026bf81da565f97cfcf8f920657d/libavformat/avio.c#L376

while (len < size_min) { 
[...]
ret = transfer_func(h, buf + len, size - len);
[...]

 else if (ret == AVERROR_EOF)
return (len > 0) ? len : AVERROR_EOF;
else if (ret < 0)
return ret;
 [...]
len += ret; //loop counter
}
Further debugging showed us that transfer_func actually calls RTMP_Write  from 
Librtmp (rtmp.c. 
https://git.ffmpeg.org/gitweb/rtmpdump.git/blob_plain/HEAD:/librtmp/rtmp.c)
 This callback returns 0 when packet size is less than 11 bytes (size-len) 
[...]
    if (size < 11) {
  /* FLV pkt too small */
  return 0;
    }
[...]

So, if transfer_func = 0, there is no way to break the loop since this special 
case is not handled (ret ==0).

We reviewed history for avio.c and we found that in commit 
858db4b01fa2b55ee55056c033054ca54ac9b0fd  , the error handling mechanism was 
changed so that  0 was no longer threated as an EOF:
https://github.com/FFmpeg/FFmpeg/commit/858db4b01fa2b55ee55056c033054ca54ac9b0fd

 According to commit message, "...In case of returning >= 0, url_read/url_write 
is retried until error is returned.". Ever since then, the code in master does 
not seem to handle "LIBRTMP: FLV special case for  packet too small (code =0)". 
Previously, in  ffmpeg 2.7.0,)  an error code 0 would return len (0) and break 
the loop:
https://github.com/FFmpeg/FFmpeg/blob/6e94e77632df457da03b5c27fff8a1b976f6994d/libavformat/avio.c#L324


We where thinking about adding a custom handler for ret =0 in avio.c to handle 
this case.
[.]
} else if (ret == AVERROR_EOF)
return (len > 0) ? len : AVERROR_EOF;
else if (ret < 0)
return ret;
else if (ret == 0) ///handle "LIBRTMP FLV packet too small code" here
return len;
if (ret) {
fast_retries = FFMAX(fast_retries, 2);
wait_since = 0;
}

However, we don't want to formally submit  this patch right now, since  we 
don't know how this could impact other protocols and parts of ffmpeg. Moreover, 
commit 858db4b also modified aviobuf.c cache.c  , so we would prefer to discuss 
with the ffmpeg community  if this is a valid approach.


Regards,
Albert Andaluz
Research Engineer


MEDIAPRO
Av. Diagonal 177, Planta 14
08018 Barcelona - Spain
Landline: +34 93 476 1551 (ext. 2327)
aandaluz (at) mediapro.tv
www.automatic.tv



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


[FFmpeg-devel] [PATCH] Fix heap buffer overflow in ff_combine_frame

2018-06-26 Thread Baozeng Ding
Signed-off-by: Baozeng Ding 
---
 libavcodec/parser.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index f43b197..a9786af 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -355,6 +355,7 @@ int ff_combine_frame(ParseContext *pc, int next,
 
 av_assert0(next >= 0 || pc->buffer);
 
+int origin_buf_size = *buf_size;
 *buf_size  =
 pc->overread_index = pc->index + next;
 
@@ -370,9 +371,12 @@ int ff_combine_frame(ParseContext *pc, int next,
 return AVERROR(ENOMEM);
 }
 pc->buffer = new_buffer;
-if (next > -AV_INPUT_BUFFER_PADDING_SIZE)
-memcpy(&pc->buffer[pc->index], *buf,
-   next + AV_INPUT_BUFFER_PADDING_SIZE);
+if (next > -AV_INPUT_BUFFER_PADDING_SIZE) {
+int copy_len = next + AV_INPUT_BUFFER_PADDING_SIZE;
+if (next + AV_INPUT_BUFFER_PADDING_SIZE > origin_buf_size)
+copy_len = origin_buf_size;
+memcpy(&pc->buffer[pc->index], *buf, copy_len);
+}
 pc->index = 0;
 *buf  = pc->buffer;
 }
-- 
2.7.4

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


Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg: add option to hide vsync warnings

2018-06-26 Thread Marton Balint



On Tue, 26 Jun 2018, Gyan Doshi wrote:

Many users have queried/complained about the 'Past duration too large' 
messages.


If the message is useless, then why not remove it entirely?

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


[FFmpeg-devel] [PATCH] fftools/ffmpeg: add option to hide vsync warnings

2018-06-26 Thread Gyan Doshi
Many users have queried/complained about the 'Past duration too large' 
messages.


Regards,
Gyan
From 9e265308865455c4a61b0cb65840466b4d575670 Mon Sep 17 00:00:00 2001
From: Gyan Doshi 
Date: Tue, 26 Jun 2018 15:42:04 +0530
Subject: [PATCH] fftools/ffmpeg: add option to hide vsync warnings

When transcoding a video stream with a lower-resolution encoding timebase,
ffmpeg log can get bloated with video sync warnings viz.
"Past duration %f too large". These are not actionable for end-users and
can also make the progress readout disappear at times, which is not
desirable, like during a live capture.

Added option -hide_vsync_warning suppresses these messages.
---
 doc/ffmpeg.texi  | 3 +++
 fftools/ffmpeg.c | 3 ++-
 fftools/ffmpeg.h | 1 +
 fftools/ffmpeg_opt.c | 3 +++
 4 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 3717f22d42..c3fc449a38 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -1407,6 +1407,9 @@ With -map you can select from which stream the timestamps 
should be
 taken. You can leave either video or audio unchanged and sync the
 remaining stream(s) to the unchanged one.
 
+@item -hide_vsync_warning (@emph{global})
+Don't print video sync warnings about frame duration during rate conversion.
+
 @item -frame_drop_threshold @var{parameter}
 Frame drop threshold, which specifies how much behind video frames can
 be before they are dropped. In frame rate units, so 1.0 is one frame.
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 8d311a9ac8..2e8450cece 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1121,7 +1121,8 @@ static void do_video_out(OutputFile *of,
 format_video_sync != VSYNC_PASSTHROUGH &&
 format_video_sync != VSYNC_DROP) {
 if (delta0 < -0.6) {
-av_log(NULL, AV_LOG_WARNING, "Past duration %f too large\n", 
-delta0);
+if (!hide_vsync_warning)
+av_log(NULL, AV_LOG_WARNING, "Past duration %f too 
large\n", -delta0);
 } else
 av_log(NULL, AV_LOG_DEBUG, "Clipping frame in rate conversion 
by %f\n", -delta0);
 sync_ipts = ost->sync_opts;
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index eb1eaf6363..aa46d683c8 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -606,6 +606,7 @@ extern int frame_bits_per_raw_sample;
 extern AVIOContext *progress_avio;
 extern float max_error_rate;
 extern char *videotoolbox_pixfmt;
+extern int hide_vsync_warning;
 
 extern int filter_nbthreads;
 extern int filter_complex_nbthreads;
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 58ec13e5a8..9a88f6d3e8 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -110,6 +110,7 @@ float max_error_rate  = 2.0/3;
 int filter_nbthreads = 0;
 int filter_complex_nbthreads = 0;
 int vstats_version = 2;
+int hide_vsync_warning = 0;
 
 
 static int intra_only = 0;
@@ -3382,6 +3383,8 @@ const OptionDef options[] = {
   "add timings for each task" },
 { "progress",   HAS_ARG | OPT_EXPERT,{ 
.func_arg = opt_progress },
   "write program-readable progress information", "url" },
+{ "hide_vsync_warning", OPT_BOOL | OPT_EXPERT,   { 
&hide_vsync_warning },
+"don't print video sync warnings" },
 { "stdin",  OPT_BOOL | OPT_EXPERT,   { 
&stdin_interaction },
   "enable or disable interaction on standard input" },
 { "timelimit",  HAS_ARG | OPT_EXPERT,{ 
.func_arg = opt_timelimit },
-- 
2.12.2.windows.2___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel