Re: [FFmpeg-devel] [PATCH v3] libavformat: Add ZeroMQ as a protocol option

2019-08-23 Thread Andriy Gelman
On Mon, 19. Aug 17:28, Andriy Gelman wrote:
> Minor changes in v3: 
> 1. Removed tab character from as per feedback 
> 2. Removed unused timeout variable from ZMQContext 
> 
> Andriy

> From 66c11c12fcfa8a7fbb3c8c09d23c017992229a99 Mon Sep 17 00:00:00 2001
> From: Andriy Gelman 
> Date: Tue, 30 Jul 2019 14:39:32 -0400
> Subject: [PATCH] libavformat: Add ZeroMQ as a protocol option
> 
> Currently multiple clients are only supported by using a multicast
> destination address. An alternative is to stream to a server which
> re-distributes the content. This commit adds ZeroMQ as a protocol
> option, which allows multiple clients to connect to a single ffmpeg
> instance.
> ---
>  configure   |   2 +
>  doc/general.texi|   1 +
>  doc/protocols.texi  |  32 
>  libavformat/Makefile|   1 +
>  libavformat/libzmq.c| 158 
>  libavformat/protocols.c |   1 +
>  6 files changed, 195 insertions(+)
>  create mode 100644 libavformat/libzmq.c
> 
> diff --git a/configure b/configure
> index c09c842809..a4134024c2 100755
> --- a/configure
> +++ b/configure
> @@ -3411,6 +3411,8 @@ libsrt_protocol_deps="libsrt"
>  libsrt_protocol_select="network"
>  libssh_protocol_deps="libssh"
>  libtls_conflict="openssl gnutls mbedtls"
> +libzmq_protocol_deps="libzmq"
> +libzmq_protocol_select="network"
>  
>  # filters
>  afftdn_filter_deps="avcodec"
> diff --git a/doc/general.texi b/doc/general.texi
> index 3c0c803449..b8e063268c 100644
> --- a/doc/general.texi
> +++ b/doc/general.texi
> @@ -1329,6 +1329,7 @@ performance on systems without hardware floating point 
> support).
>  @item TCP  @tab X
>  @item TLS  @tab X
>  @item UDP  @tab X
> +@item ZMQ  @tab E
>  @end multitable
>  
>  @code{X} means that the protocol is supported.
> diff --git a/doc/protocols.texi b/doc/protocols.texi
> index 3e4e7af3d4..174eaacd0f 100644
> --- a/doc/protocols.texi
> +++ b/doc/protocols.texi
> @@ -1728,4 +1728,36 @@ Timeout in ms.
>  Create the Unix socket in listening mode.
>  @end table
>  
> +@section libzmq
> +
> +ZeroMQ asynchronous messaging library.
> +
> +This library supports unicast streaming to multiple clients without relying 
> on
> +an external server.
> +
> +The required syntax for streaming or connecting to a stream is:
> +@example
> +zmq:tcp://ip-address:port
> +@end example
> +
> +Example:
> +Create a localhost stream on port :
> +@example
> +ffmpeg -re -i input -f mpegts zmq:tcp://127.0.0.1:
> +@end example
> +
> +Multiple clients may connect to the stream using:
> +@example
> +ffplay zmq:tcp://127.0.0.1:
> +@end example
> +
> +Streaming to multiple clients is implemented using a ZMQ Pub-Sub pattern.
> +The server binds to a port and publishes data. Clients connect to the
> +server (IP address/port) and subscribe to the stream. The order in which
> +the server and client start generally does not matter.
> +
> +ffmpeg must be compiled with the --enable-libzmq option to support
> +this protocol option. See the compilation guide 
> @url{https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu}
> +for an example on how this option may be set.
> +
>  @c man end PROTOCOLS
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index a434b005a4..efa3a112ae 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -631,6 +631,7 @@ OBJS-$(CONFIG_LIBRTMPTE_PROTOCOL)+= librtmp.o
>  OBJS-$(CONFIG_LIBSMBCLIENT_PROTOCOL) += libsmbclient.o
>  OBJS-$(CONFIG_LIBSRT_PROTOCOL)   += libsrt.o
>  OBJS-$(CONFIG_LIBSSH_PROTOCOL)   += libssh.o
> +OBJS-$(CONFIG_LIBZMQ_PROTOCOL)   += libzmq.o
>  
>  # libavdevice dependencies
>  OBJS-$(CONFIG_IEC61883_INDEV)+= dv.o
> diff --git a/libavformat/libzmq.c b/libavformat/libzmq.c
> new file mode 100644
> index 00..ac35c01cf8
> --- /dev/null
> +++ b/libavformat/libzmq.c
> @@ -0,0 +1,158 @@
> +/*
> + * ZMQ URLProtocol
> + *
> + * 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, MA 02110-1301 
> USA
> + */
> +
> +#include 
> +#include "url.h"
> +#include "network.h"
> +#include "libavutil/avstring.h"
> +#include "libavutil/opt.h"
> +
> +typedef struct ZMQContext {
> +const AVClass *class;
> +void *context;
> +

Re: [FFmpeg-devel] [PATCH] avformat/avidec: add support for recognizing HEVC fourcc when demuxing

2019-08-23 Thread Carl Eugen Hoyos
Am Sa., 24. Aug. 2019 um 01:47 Uhr schrieb Marton Balint :
>
> Some security cams generate this, as well as some versions of VirtualDub so
> support for _reading_ such files is justified.

Please also mention vlc.

>
> Fixes ticket #7110.
>
> See also this discussion: https://patchwork.ffmpeg.org/patch/8744/
>
> Signed-off-by: Marton Balint 
> ---
>  libavformat/avidec.c | 4 
>  libavformat/riff.c   | 5 +
>  libavformat/riff.h   | 2 ++
>  3 files changed, 11 insertions(+)
>
> diff --git a/libavformat/avidec.c b/libavformat/avidec.c
> index 1d887b1cc9..7946791fe4 100644
> --- a/libavformat/avidec.c
> +++ b/libavformat/avidec.c
> @@ -815,6 +815,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
>"mov tag found in avi (fourcc %s)\n",
>av_fourcc2str(tag1));
>  }

> +/* Finally try unofficial codec tags to support 
> non-standard files. */

The comment does not look useful.

> +if (!st->codecpar->codec_id)
> +st->codecpar->codec_id = 
> ff_codec_get_id(ff_codec_bmp_tags_unofficial, tag1);
> +
>  /* This is needed to get the pict type which is necessary
>   * for generating correct pts. */
>  st->need_parsing = AVSTREAM_PARSE_HEADERS;
> diff --git a/libavformat/riff.c b/libavformat/riff.c
> index e755ad8d5f..52b0bf8f03 100644
> --- a/libavformat/riff.c
> +++ b/libavformat/riff.c
> @@ -491,6 +491,11 @@ const AVCodecTag ff_codec_bmp_tags[] = {
>  { AV_CODEC_ID_NONE, 0 }
>  };
>
> +const AVCodecTag ff_codec_bmp_tags_unofficial[] = {
> +{ AV_CODEC_ID_HEVC, MKTAG('H', 'E', 'V', 'C') },
> +{ AV_CODEC_ID_NONE, 0 }
> +};
> +
>  const AVCodecTag ff_codec_wav_tags[] = {
>  { AV_CODEC_ID_PCM_S16LE,   0x0001 },
>  /* must come after s16le in this list */
> diff --git a/libavformat/riff.h b/libavformat/riff.h
> index 323aa38b4d..21078b77c8 100644
> --- a/libavformat/riff.h
> +++ b/libavformat/riff.h
> @@ -73,6 +73,8 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb, 
> AVCodecParameters *pa
>  extern const AVCodecTag ff_codec_bmp_tags[]; // exposed through 
> avformat_get_riff_video_tags()
>  extern const AVCodecTag ff_codec_wav_tags[];
>
> +extern const AVCodecTag ff_codec_bmp_tags_unofficial[];

Imo, this is far too complicated to avoid writing files
that all other relevant applications write happily.

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] avformat/avidec: add support for recognizing HEVC fourcc when demuxing

2019-08-23 Thread Marton Balint
Some security cams generate this, as well as some versions of VirtualDub so
support for _reading_ such files is justified.

Fixes ticket #7110.

See also this discussion: https://patchwork.ffmpeg.org/patch/8744/

Signed-off-by: Marton Balint 
---
 libavformat/avidec.c | 4 
 libavformat/riff.c   | 5 +
 libavformat/riff.h   | 2 ++
 3 files changed, 11 insertions(+)

diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 1d887b1cc9..7946791fe4 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -815,6 +815,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
   "mov tag found in avi (fourcc %s)\n",
   av_fourcc2str(tag1));
 }
+/* Finally try unofficial codec tags to support 
non-standard files. */
+if (!st->codecpar->codec_id)
+st->codecpar->codec_id = 
ff_codec_get_id(ff_codec_bmp_tags_unofficial, tag1);
+
 /* This is needed to get the pict type which is necessary
  * for generating correct pts. */
 st->need_parsing = AVSTREAM_PARSE_HEADERS;
diff --git a/libavformat/riff.c b/libavformat/riff.c
index e755ad8d5f..52b0bf8f03 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -491,6 +491,11 @@ const AVCodecTag ff_codec_bmp_tags[] = {
 { AV_CODEC_ID_NONE, 0 }
 };
 
+const AVCodecTag ff_codec_bmp_tags_unofficial[] = {
+{ AV_CODEC_ID_HEVC, MKTAG('H', 'E', 'V', 'C') },
+{ AV_CODEC_ID_NONE, 0 }
+};
+
 const AVCodecTag ff_codec_wav_tags[] = {
 { AV_CODEC_ID_PCM_S16LE,   0x0001 },
 /* must come after s16le in this list */
diff --git a/libavformat/riff.h b/libavformat/riff.h
index 323aa38b4d..21078b77c8 100644
--- a/libavformat/riff.h
+++ b/libavformat/riff.h
@@ -73,6 +73,8 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb, 
AVCodecParameters *pa
 extern const AVCodecTag ff_codec_bmp_tags[]; // exposed through 
avformat_get_riff_video_tags()
 extern const AVCodecTag ff_codec_wav_tags[];
 
+extern const AVCodecTag ff_codec_bmp_tags_unofficial[];
+
 void ff_parse_specific_params(AVStream *st, int *au_rate, int *au_ssize, int 
*au_scale);
 
 int ff_read_riff_info(AVFormatContext *s, int64_t size);
-- 
2.16.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avformat: Fix probing on some JPEGs

2019-08-23 Thread Niki Bowe
On Thu, Aug 22, 2019 at 2:30 AM Paul B Mahol  wrote:

> On Thu, Aug 22, 2019 at 11:19 AM Carl Eugen Hoyos 
> wrote:
>
> > Am Mi., 21. Aug. 2019 um 23:05 Uhr schrieb Niki Bowe
> > :
> > >
> > > On Mon, Aug 19, 2019 at 7:22 PM Carl Eugen Hoyos 
> > wrote:
> > >
> > > >
> > > > This score would mean that mjpeg can never be detected.
> > > > I suspect you have to reduce one of the demuxers to "- 1".
> > > >
> > > >
> > > Thanks Carl.
> > > Attached patch to reduce mpeg probe by -1, which also fixes the issue.
> >
> > Sorry, I misread the original report, it looked to me as if mJpeg was
> > the culprit.
> >
> > Imo, the mpeg probing should be fixed (return a smaller value) for your
> > sample
> > by detecting that it is not mpeg, not by returning a smaller value for
> > all samples.
> >
>
> 1000% agree.
>
>
It didn't return a smaller value for all samples, only the "invalid VDR
files and short PES streams" case.
Most mpegps files still return 26 immediately, because they have pack
headers.

However, here is another patch where I try to limit it to only changing
score for these jpegs.
I noticed that these jpegs had a lot of 0x0100 sequences, which matches
mpeg picture header start code. I added another heuristic which matches
these jpegs, but not any mpegps files I could find.

Alternatively I could make reduce score if it doesn't start with a start
code? At the moment its happy to search until it finds start codes.


Is everyone really sure the best approach is to modify mpegps_probe for
this?
The mpegps_probe function returns 25 in many instances where it may not be
mpegps. It does only minimal structural checking, and allows invalid data
to still classify as mpegps.
jpeg probing returns 25 in some cases where it is almost certainly a jpeg
(Has to go through multiple tags to get to SOS, many of which early out if
they find invalid data).
Note that 25 is still treated as "low confidence" for jpeg. It logs "Format
jpeg_pipe detected only with low score of 25, misdetection possible!" for
these jpegs.
So I still think a score of 25 is too low for these jpegs, and that a
better fix would be to return 26 for jpeg_pipe and mjpeg if it makes it
past multiple tags to SOS.

-- 

Nikolas Bowe |  SWE |  nb...@google.com |  408-565-5137
From 168485f954452de1e3ff78932c896cff01c2a303 Mon Sep 17 00:00:00 2001
From: Nikolas Bowe 
Date: Thu, 8 Aug 2019 15:32:51 -0700
Subject: [PATCH] avformat: Fix probing on some JPEGs

Fixes "Invalid data found when processing input" on some JPEGs.

Some large extensionless JPEGs can get probe score collisions with mpeg
eg
$ ffprobe -loglevel trace  /tmp/foo
[NULL @ 0x55c130ab04c0] Opening '/tmp/foo' for reading
[file @ 0x55c130ab0f40] Setting default whitelist 'file,crypto'
Probing jpeg_pipe score:6 size:2048
Probing jpeg_pipe score:6 size:4096
Probing jpeg_pipe score:6 size:8192
Probing jpeg_pipe score:6 size:16384
Probing jpeg_pipe score:25 size:32768
Probing jpeg_pipe score:25 size:65536
Probing jpeg_pipe score:25 size:131072
Probing jpeg_pipe score:25 size:262144
Probing jpeg_pipe score:25 size:524288
Probing mpeg score:25 size:1048576
Probing jpeg_pipe score:25 size:1048576
[AVIOContext @ 0x55c130ab9300] Statistics: 1048576 bytes read, 0 seeks
/tmp/foo: Invalid data found when processing input

This patch fixes this by reducing probe score for mpeg
---
 libavformat/mpeg.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index 3205f209e6..6dcaefb5de 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -68,7 +68,7 @@ static int mpegps_probe(const AVProbeData *p)
 {
 uint32_t code = -1;
 int i;
-int sys = 0, pspack = 0, priv1 = 0, vid = 0;
+int sys = 0, pspack = 0, priv1 = 0, vid = 0, pic = 0;
 int audio = 0, invalid = 0, score = 0;
 int endpes = 0;
 
@@ -92,18 +92,23 @@ static int mpegps_probe(const AVProbeData *p)
 else if ((code & 0xe0) == AUDIO_ID &&  pes) {audio++; i+=len;}
 else if (code == PRIVATE_STREAM_1  &&  pes) {priv1++; i+=len;}
 else if (code == 0x1fd &&  pes) vid++; //VC1
-
 else if ((code & 0xf0) == VIDEO_ID && !pes) invalid++;
 else if ((code & 0xe0) == AUDIO_ID && !pes) invalid++;
 else if (code == PRIVATE_STREAM_1  && !pes) invalid++;
+else if (code == 0x100) pic++;
 }
 }
 
+// If we don't find a pack header, and we have much more picture headers codes than 
+// mpeg video stream codes, then its probably not mpeg.
+if (pspack == 0 && vid > 0 && vid * 10 < pic)
+return AVPROBE_SCORE_EXTENSION / 2 - 1;
+
 if (vid + audio > invalid + 1) /* invalid VDR files nd short PES streams */
 score = AVPROBE_SCORE_EXTENSION / 2;
 
-// av_log(NULL, AV_LOG_ERROR, "vid:%d aud:%d sys:%d pspack:%d invalid:%d size:%d \n",
-//vid, audio, sys, pspack, invalid, p->buf_size);
+// av_log(NULL, AV_LOG_ERROR, "vid:%d aud:%d sys:%d 

[FFmpeg-devel] [PATCH] avformat/mpegts: fix teletext PTS when selecting teletext streams only

2019-08-23 Thread Marton Balint
After a1b4f120c031e6697bac9fd8c725d9c37ee36d13 the teletext PTS values were set
to AV_NOPTS_VALUE if the stream of the PCR pid was discarded.

What actually matters is that if we parse the PCR of the PCR PID or not, so
let's use the cached discard value of the actual PCR PID instead of the stream
discard value, which may be different.

Also fixes ticket #7567, which was caused by the fact that teletext PTS values
were not touched if the PCR pid was discarded even before
a1b4f120c031e6697bac9fd8c725d9c37ee36d13.

Signed-off-by: Marton Balint 
---
 libavformat/mpegts.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 47d8d5f877..58902527c5 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1303,15 +1303,17 @@ skip:
 st = pst;
 }
 }
-if (f->last_pcr != -1 && st && st->discard != 
AVDISCARD_ALL) {
+if (f->last_pcr != -1 && !f->discard) {
 // teletext packets do not always have 
correct timestamps,
 // the standard says they should be 
handled after 40.6 ms at most,
 // and the pcr error to this packet should 
be no more than 100 ms.
 // TODO: we should interpolate the PCR, 
not just use the last one
 int64_t pcr = f->last_pcr / 300;
 pcr_found = 1;
-pes->st->pts_wrap_reference = 
st->pts_wrap_reference;
-pes->st->pts_wrap_behavior = 
st->pts_wrap_behavior;
+if (st) {
+pes->st->pts_wrap_reference = 
st->pts_wrap_reference;
+pes->st->pts_wrap_behavior = 
st->pts_wrap_behavior;
+}
 if (pes->dts == AV_NOPTS_VALUE || pes->dts 
< pcr) {
 pes->pts = pes->dts = pcr;
 } else if (pes->st->codecpar->codec_id == 
AV_CODEC_ID_DVB_TELETEXT &&
-- 
2.16.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/7] lavf: add cue sheet demuxer

2019-08-23 Thread Reino Wijnsma
Hello ffmpeg-devel,

I've read through https://patchwork.ffmpeg.org/patch/4587/, 
https://ffmpeg.org/pipermail/ffmpeg-devel/2017-August/214360.html and all its 
replies. The discussion suddenly just stops, the path dropped and I can't seem 
to find the reason why. Can anyone tell me why this patch hasn't been applied? 
I was just wondering.

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avcodec/videotoolbox_hevc: avoid leaking cached_hw_frames_ctx

2019-08-23 Thread Aman Gupta
On Wed, Aug 14, 2019 at 3:53 AM Pavel Koshevoy  wrote:

> On Tue, Aug 6, 2019 at 8:50 PM Pavel Koshevoy  wrote:
> >
> > vtctx->cached_hw_frames_ctx is unref'd in videotoolbox_uninit,
> > but videotoolbox_hevc used ff_videotoolbox_uninit which
> > doesn't unref cache_hw_frames_ctx.
> > ---
> >  libavcodec/videotoolbox.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
> > index c718e82cc5..acaeef77dd 100644
> > --- a/libavcodec/videotoolbox.c
> > +++ b/libavcodec/videotoolbox.c
> > @@ -1143,7 +1143,7 @@ const AVHWAccel ff_hevc_videotoolbox_hwaccel = {
> >  .end_frame  = videotoolbox_hevc_end_frame,
> >  .frame_params   = videotoolbox_frame_params,
> >  .init   = videotoolbox_common_init,
> > -.uninit = ff_videotoolbox_uninit,
> > +.uninit = videotoolbox_uninit,
> >  .priv_data_size = sizeof(VTContext),
> >  };
> >
> > --
> > 2.16.4
> >
>
>
> Ping.  It's a 1-line leak fix ... is there any reason this should not
> be applied?
>

LGTM. Feel free to push it.


>
> Thank you,
> Pavel.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 2/4] avformat/mpegtsenc: add support for setting PCR interval for VBR streams

2019-08-23 Thread Marton Balint



On Fri, 23 Aug 2019, Marton Balint wrote:




On Fri, 16 Aug 2019, Andreas Håkon wrote:


Hi Marton,

Very good work with your series of patches on the mpegtsenc!

‐‐‐ Original Message ‐‐‐
On Thursday, 15 de August de 2019 1:51, Marton Balint  

wrote:



Also document the algorithm for the default PCR interval.



[...]



+   if (ts->mux_rate > 1 || ts->pcr_period_ms >= 0) {
+  int pcr_period_ms = ts->pcr_period_ms == -1 ? PCR_RETRANS_TIME 

: ts->pcr_period_ms;
+  ts_st->pcr_period = av_rescale(pcr_period_ms, PCR_TIME_BASE, 

1000);

} else {
/* For VBR we select the highest multiple of frame duration which is 

less than 100 ms. */


A simple aesthetic comment:
Please, change this to...
/* By default, for VBR we select the highest multiple of frame duration 

which is less than 100 ms. */

Ok, changed locally.

Will apply patchset soon.


Applied patchset.

Regards,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/3] libavutil: AVEncodeInfo data structures

2019-08-23 Thread Juan De León
On Fri, Aug 23, 2019 at 12:28 PM Nicolas George  wrote:

> Juan De León (12019-08-23):
> > I changed it to an inline function, returns SIZE_MAX if it fails to make
> > av_malloc() fail and return NULL.
>
> You neglected to check for SIZE_MAX afterwards. I suspect there are
> architectures where such a malloc could succeed.
>
I doubt it since av_malloc() checks for size > INT_MAX - 32.
Maybe in a 16 bit system.

But in this case, a macro would probably be the simplest.
>
I'm sending a new patch with a macro.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/3] libavutil: AVEncodeInfo data structures

2019-08-23 Thread Juan De León
AVEncodeInfoFrame data structure to store as AVFrameSideData of type
AV_FRAME_DATA_ENCODE_INFO.
The structure stores quantization index for each plane, DC/AC deltas
for luma and chroma planes, and an array of AVEncodeInfoBlock type
denoting position, size, and delta quantizer for each block in the
frame.
Can be extended to support extraction of other block information.

Signed-off-by: Juan De León 
---
 libavutil/Makefile  |   2 +
 libavutil/encode_info.c |  72 ++
 libavutil/encode_info.h | 110 
 libavutil/frame.c   |   1 +
 libavutil/frame.h   |   7 +++
 5 files changed, 192 insertions(+)
 create mode 100644 libavutil/encode_info.c
 create mode 100644 libavutil/encode_info.h

diff --git a/libavutil/Makefile b/libavutil/Makefile
index 57e6e3d7e8..37cfb099e9 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -24,6 +24,7 @@ HEADERS = adler32.h   
  \
   dict.h\
   display.h \
   downmix_info.h\
+  encode_info.h \
   encryption_info.h \
   error.h   \
   eval.h\
@@ -111,6 +112,7 @@ OBJS = adler32.o
\
dict.o   \
display.o\
downmix_info.o   \
+   encode_info.o\
encryption_info.o\
error.o  \
eval.o   \
diff --git a/libavutil/encode_info.c b/libavutil/encode_info.c
new file mode 100644
index 00..1048173e7f
--- /dev/null
+++ b/libavutil/encode_info.c
@@ -0,0 +1,72 @@
+/*
+ * 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, MA 02110-1301 USA
+ */
+#include 
+
+#include "libavutil/encode_info.h"
+#include "libavutil/mem.h"
+
+/**
+ * Get the size to allocate of AVEncodeInfoFrame and the array of 
AVEncodeInfoBlock.
+ * AVEncodeInfoFrame already allocates size for one element of 
AVEncodeInfoBlock.
+ */
+#define AV_ENCODE_INFO_GET_SIZE(SIZE, N) \
+if (N > (SIZE_MAX - sizeof(AVEncodeInfoFrame)) / sizeof(AVEncodeInfoBlock) 
+ 1) \
+return NULL; \
+SIZE = sizeof(AVEncodeInfoFrame) - sizeof(AVEncodeInfoBlock) \
++ FFMAX(1, N) * sizeof(AVEncodeInfoBlock)
+
+static int init_encode_info_data(AVEncodeInfoFrame *info, unsigned nb_blocks)
+{
+info->nb_blocks = nb_blocks;
+info->block_size = sizeof(AVEncodeInfoBlock);
+info->blocks_offset = offsetof(AVEncodeInfoFrame, blocks);
+
+for(int i = 0; i < AV_NUM_DATA_POINTERS; i++)
+info->plane_q[i] = -1;
+
+return 0;
+}
+
+AVEncodeInfoFrame *av_encode_info_alloc(unsigned nb_blocks)
+{
+size_t size;
+AV_ENCODE_INFO_GET_SIZE(size, nb_blocks);
+AVEncodeInfoFrame *ptr = av_mallocz(size);
+if (!ptr)
+return NULL;
+
+init_encode_info_data(ptr, nb_blocks);
+
+return ptr;
+}
+
+AVEncodeInfoFrame *av_encode_info_create_side_data(AVFrame *frame, unsigned 
nb_blocks)
+{
+size_t size;
+AV_ENCODE_INFO_GET_SIZE(size, nb_blocks);
+AVFrameSideData *sd = av_frame_new_side_data(frame,
+ AV_FRAME_DATA_ENCODE_INFO,
+ size);
+if (!sd)
+return NULL;
+
+memset(sd->data, 0, size);
+init_encode_info_data((AVEncodeInfoFrame*)sd->data, nb_blocks);
+
+return (AVEncodeInfoFrame*)sd->data;
+}
diff --git a/libavutil/encode_info.h b/libavutil/encode_info.h
new file mode 100644
index 00..8afe0c9c9e
--- /dev/null
+++ b/libavutil/encode_info.h
@@ -0,0 +1,110 @@
+/*
+ * This file is part of 

Re: [FFmpeg-devel] [v3] avformat/flvdec: delete unused code

2019-08-23 Thread Michael Niedermayer
On Thu, Aug 22, 2019 at 06:55:00PM +0800, Tao Zhang wrote:
> Michael Niedermayer  于2019年8月18日周日 下午5:49写道:
> >
> > On Wed, Aug 14, 2019 at 11:07:18AM +0800, leozhang wrote:
> > > Reviewed-by: Carl Eugen Hoyos 
> > > Signed-off-by: leozhang 
> > > ---
> > >  libavformat/flvdec.c | 17 -
> > >  1 file changed, 17 deletions(-)
> >
> > probably ok
> Hi Michael, I'm sorry to bother you at your busy time and is it the
> time to push it?

will apply

thx

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

Does the universe only have a finite lifespan? No, its going to go on
forever, its just that you wont like living in it. -- Hiranya Peiri


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] fate/als: Add test for conformance file with 512 channels.

2019-08-23 Thread Michael Niedermayer
On Thu, Aug 22, 2019 at 09:23:49PM +0200, Thilo Borgmann wrote:
> Hi,
> 
> new fate test for many channels in ALS, like requested.
> 
> I already uploaded the corresponding file into fate-suite.
> If there are no objections, I'll commit this in a day or two.
> 
> Thanks,
> Thilo

>  fate/als.mak  |4 
>  ref/fate/mpeg4-als-conformance-09 |1 +
>  2 files changed, 5 insertions(+)
> c64a085f51b0c6492247146b0386400b26f039e3  
> 0001-fate-als-Add-test-for-conformance-file-with-512-chan.patch
> From 5ed096ab3eac956f235e7924d52810b5ec9e8203 Mon Sep 17 00:00:00 2001
> From: Thilo Borgmann 
> Date: Thu, 22 Aug 2019 21:21:12 +0200
> Subject: [PATCH] fate/als: Add test for conformance file with 512 channels.

Tested on linux x86-32 & 64, mingw32/64, qemu arm/mips

thx

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

Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/3] libavutil: AVEncodeInfo data structures

2019-08-23 Thread Nicolas George
Juan De León (12019-08-23):
> I changed it to an inline function, returns SIZE_MAX if it fails to make
> av_malloc() fail and return NULL.

You neglected to check for SIZE_MAX afterwards. I suspect there are
architectures where such a malloc could succeed.

If you insist on a function rather than a macro, I personally consider
bad style to rely on a magic value for error: return a boolean for
success and pass the size through a pointer.

But in this case, a macro would probably be the simplest.

Regards,

-- 
  Nicolas George


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/4] MAINTAINERS: add myself to OMX

2019-08-23 Thread Michael Niedermayer
On Thu, Aug 22, 2019 at 02:50:01PM -0700, Aman Gupta wrote:
> From: Aman Gupta 
> 
> Signed-off-by: Aman Gupta 
> Signed-off-by: Martin Storsjö 
> ---
>  MAINTAINERS | 1 +
>  1 file changed, 1 insertion(+)

LGTM

thx

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

The smallest minority on earth is the individual. Those who deny 
individual rights cannot claim to be defenders of minorities. - Ayn Rand


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] libavformat/rtspdec: Don't send teardown if rtsp_hd_out is null

2019-08-23 Thread Ross Nicholson
Ping 

> On 17 Aug 2019, at 14:57, Ross Nicholson  wrote:
> 
> Ok, thanks Moritz.
> 
>>> On 17 Aug 2019, at 14:10, Moritz Barsnick  wrote:
>>> 
>>> On Fri, Aug 16, 2019 at 10:35:43 -0700, Ross Nicholson wrote:
>>> Need anything else Moritz?
>> 
>> No. I only made one remark ("can't understand your issue"), hoping to
>> push things forward with new facts for others to take into
>> consideration. I can't and won't judge whether your fix is reasonable
>> or required. You'll need to wait for others to look into it.
>> 
>> Moritz
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>> 
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/3] libavutil: AVEncodeInfo data structures

2019-08-23 Thread Juan De León
On Fri, Aug 23, 2019 at 8:07 AM Nicolas George  wrote:

> > +if (nb_blocks - 1 > (SIZE_MAX - sizeof(AVEncodeInfoFrame)) /
> sizeof(AVEncodeInfoBlock))
> > +return NULL;
>
> nb_blocks - 1 overflows for 0. Move the -1 right of the = as +1.
>
> > +//AVEncodeInfoFrame already allocates size for one element of
> AVEncodeInfoBlock
>
> > +size_t size = sizeof(AVEncodeInfoFrame) - sizeof(AVEncodeInfoBlock)
> +
> > +  FFMAX(1, nb_blocks) * sizeof(AVEncodeInfoBlock);
>
> This code would be better shared in an inline function or macro instead
> of duplicated. With a macro, you can include the check.
>

I changed it to an inline function, returns SIZE_MAX if it fails to make
av_malloc() fail and return NULL.
Thanks for the feedback.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avcodec/videotoolbox_hevc: avoid leaking cached_hw_frames_ctx

2019-08-23 Thread Pavel Koshevoy
On Fri, Aug 23, 2019 at 8:12 AM Pavel Koshevoy  wrote:
>
> On Tue, Aug 6, 2019 at 8:50 PM Pavel Koshevoy  wrote:
> >
> > vtctx->cached_hw_frames_ctx is unref'd in videotoolbox_uninit,
> > but videotoolbox_hevc used ff_videotoolbox_uninit which
> > doesn't unref cache_hw_frames_ctx.
> > ---
> >  libavcodec/videotoolbox.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
> > index c718e82cc5..acaeef77dd 100644
> > --- a/libavcodec/videotoolbox.c
> > +++ b/libavcodec/videotoolbox.c
> > @@ -1143,7 +1143,7 @@ const AVHWAccel ff_hevc_videotoolbox_hwaccel = {
> >  .end_frame  = videotoolbox_hevc_end_frame,
> >  .frame_params   = videotoolbox_frame_params,
> >  .init   = videotoolbox_common_init,
> > -.uninit = ff_videotoolbox_uninit,
> > +.uninit = videotoolbox_uninit,
> >  .priv_data_size = sizeof(VTContext),
> >  };
> >
> > --
> > 2.16.4
> >
>
>
> I'd like to see this merged.   Would anyone be upset if I pushed it?
>



> When I ran into this issue testing on a Tesla P4 I observed that each
> hw frames ctx leak would cost ~120MB GPU memory.  Once all GPU memory
> is exhausted nvdec and nvenc would fail, and this happens pretty
> quickly when processing 4s video fragments from unrelated
> sources/timelines.

sorry, this was half-awake nonsense ... the cuda hwframes memleak was
external to ffmpeg and unrelated to this videotoolbox fix.


>
> Rick Kern and Aman Gupta are listed as maintainers for videotoolbox*,
> but I don't know how to contact them.
>
> Pavel.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/3] libavutil: AVEncodeInfo data structures

2019-08-23 Thread Juan De León
AVEncodeInfoFrame data structure to store as AVFrameSideData of type
AV_FRAME_DATA_ENCODE_INFO.
The structure stores quantization index for each plane, DC/AC deltas
for luma and chroma planes, and an array of AVEncodeInfoBlock type
denoting position, size, and delta quantizer for each block in the
frame.
Can be extended to support extraction of other block information.

Signed-off-by: Juan De León 
---
 libavutil/Makefile  |   2 +
 libavutil/encode_info.c |  74 +++
 libavutil/encode_info.h | 110 
 libavutil/frame.c   |   1 +
 libavutil/frame.h   |   7 +++
 5 files changed, 194 insertions(+)
 create mode 100644 libavutil/encode_info.c
 create mode 100644 libavutil/encode_info.h

diff --git a/libavutil/Makefile b/libavutil/Makefile
index 57e6e3d7e8..37cfb099e9 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -24,6 +24,7 @@ HEADERS = adler32.h   
  \
   dict.h\
   display.h \
   downmix_info.h\
+  encode_info.h \
   encryption_info.h \
   error.h   \
   eval.h\
@@ -111,6 +112,7 @@ OBJS = adler32.o
\
dict.o   \
display.o\
downmix_info.o   \
+   encode_info.o\
encryption_info.o\
error.o  \
eval.o   \
diff --git a/libavutil/encode_info.c b/libavutil/encode_info.c
new file mode 100644
index 00..0614745948
--- /dev/null
+++ b/libavutil/encode_info.c
@@ -0,0 +1,74 @@
+/*
+ * 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, MA 02110-1301 USA
+ */
+#include 
+
+#include "libavutil/encode_info.h"
+#include "libavutil/mem.h"
+
+
+/**
+ * Get the size to allocate of  AVEncodeInfoFrame and the array of 
AVEncodeInfoBlock.
+ * Return SIZE_MAX insted of 0 to make av_malloc() return NULL.
+ */
+static inline get_encode_info_size (unsigned nb_blocks)
+{
+if (nb_blocks > (SIZE_MAX - sizeof(AVEncodeInfoFrame)) / 
sizeof(AVEncodeInfoBlock) + 1)
+return SIZE_MAX;
+//AVEncodeInfoFrame already allocates size for one element of 
AVEncodeInfoBlock
+return sizeof(AVEncodeInfoFrame) - sizeof(AVEncodeInfoBlock)
++ FFMAX(1, nb_blocks) * sizeof(AVEncodeInfoBlock);
+}
+
+static int init_encode_info_data(AVEncodeInfoFrame *info, unsigned nb_blocks)
+{
+info->nb_blocks = nb_blocks;
+info->block_size = sizeof(AVEncodeInfoBlock);
+info->blocks_offset = offsetof(AVEncodeInfoFrame, blocks);
+
+for(int i = 0; i < AV_NUM_DATA_POINTERS; i++)
+info->plane_q[i] = -1;
+
+return 0;
+}
+
+AVEncodeInfoFrame *av_encode_info_alloc(unsigned nb_blocks)
+{
+size_t size = get_encode_info_size(nb_blocks);
+AVEncodeInfoFrame *ptr = av_mallocz(size);
+if (!ptr)
+return NULL;
+
+init_encode_info_data(ptr, nb_blocks);
+
+return ptr;
+}
+
+AVEncodeInfoFrame *av_encode_info_create_side_data(AVFrame *frame, unsigned 
nb_blocks)
+{
+size_t size = get_encode_info_size(nb_blocks);
+AVFrameSideData *sd = av_frame_new_side_data(frame,
+ AV_FRAME_DATA_ENCODE_INFO,
+ size);
+if (!sd)
+return NULL;
+
+memset(sd->data, 0, size);
+init_encode_info_data((AVEncodeInfoFrame*)sd->data, nb_blocks);
+
+return (AVEncodeInfoFrame*)sd->data;
+}
diff --git a/libavutil/encode_info.h b/libavutil/encode_info.h
new file mode 100644
index 00..8afe0c9c9e
--- /dev/null

Re: [FFmpeg-devel] [PATCH v3 3/3] FATE: add a test for freeezedetect

2019-08-23 Thread Michael Niedermayer
On Fri, Aug 23, 2019 at 08:17:09PM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  tests/fate/filter-video.mak |   4 +
>  tests/ref/fate/filter-metadata-freezedetect | 251 
> 
>  2 files changed, 255 insertions(+)
>  create mode 100644 tests/ref/fate/filter-metadata-freezedetect

fails on mips apparently

TESTfilter-metadata-freezedetect
--- src/tests/ref/fate/filter-metadata-freezedetect 2019-08-23 
18:22:57.427604188 +0200
+++ tests/data/fate/filter-metadata-freezedetect2019-08-23 
19:58:54.035579539 +0200
@@ -151,7 +151,7 @@
 pkt_pts=150
 pkt_pts=151
 pkt_pts=152
-pkt_pts=153|tag:lavfi.freezedetect.freeze_start=4.12|tag:lavfi.freezedetect.freeze_duration=2|tag:lavfi.freezedetect.freeze_end=6.12
+pkt_pts=153
 pkt_pts=154
 pkt_pts=155
 pkt_pts=156
@@ -202,7 +202,7 @@
 pkt_pts=201
 pkt_pts=202
 pkt_pts=203
-pkt_pts=204|tag:lavfi.freezedetect.freeze_start=6.16|tag:lavfi.freezedetect.freeze_duration=2|tag:lavfi.freezedetect.freeze_end=8.16
+pkt_pts=204
 pkt_pts=205
 pkt_pts=206
 pkt_pts=207
Test filter-metadata-freezedetect failed. Look at 
tests/data/fate/filter-metadata-freezedetect.err for details.


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

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] Change libaom default to crf=32.

2019-08-23 Thread James Zern
On Wed, Aug 21, 2019 at 6:03 PM James Zern  wrote:
>
> On Wed, Aug 21, 2019 at 12:18 PM Elliott Karpilovsky
>  wrote:
> >
> > From: elliottk 
> >
> > Current default is 256kbps, which produces inconsistent
> > results (too high for low-res, too low for hi-res).
> > Use CRF instead, which will adapt.
> > ---
> >  libavcodec/libaomenc.c | 9 +
> >  1 file changed, 5 insertions(+), 4 deletions(-)
> >
>
> lgtm. I'll apply this soon if there aren't any other comments. libvpx
> could probably use a similar update.

applied, thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v3] avcodec/h264_parse: retry decoding SPS with complete NAL

2019-08-23 Thread James Almer
On 8/22/2019 5:58 PM, Jun Li wrote:
> Fix #6591
> The content has no rbsp_stop_one_bit for ending the SPS, that
> causes the decoding SPS failure, results decoding frame failure as well.
> 
> The patch is just adding a retry with complete NALU, copied from the retry in 
> decode_nal_unit()
> ---
>  libavcodec/h264_parse.c | 20 
>  1 file changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/h264_parse.c b/libavcodec/h264_parse.c
> index ac31f54e07..baf8246cdc 100644
> --- a/libavcodec/h264_parse.c
> +++ b/libavcodec/h264_parse.c
> @@ -374,11 +374,23 @@ static int decode_extradata_ps(const uint8_t *data, int 
> size, H264ParamSets *ps,
>  for (i = 0; i < pkt.nb_nals; i++) {
>  H2645NAL *nal = [i];
>  switch (nal->type) {
> -case H264_NAL_SPS:
> -ret = ff_h264_decode_seq_parameter_set(>gb, logctx, ps, 0);
> -if (ret < 0)
> -goto fail;
> +case H264_NAL_SPS: {
> +GetBitContext tmp_gb = nal->gb;
> +ret = ff_h264_decode_seq_parameter_set(_gb, logctx, ps, 0);
> +if (ret < 0) {
> +av_log(logctx, AV_LOG_DEBUG,
> +  "SPS decoding failure, trying again with the complete 
> NAL\n");
> +init_get_bits8(_gb, nal->raw_data + 1, nal->raw_size - 
> 1);
> +ret = ff_h264_decode_seq_parameter_set(_gb, logctx, ps, 
> 0);
> +if (ret >= 0)
> +break;
> +
> +ret = ff_h264_decode_seq_parameter_set(>gb, logctx, ps, 
> 1);
> +if (ret < 0)
> +goto fail;
> +}
>  break;
> +}
>  case H264_NAL_PPS:
>  ret = ff_h264_decode_picture_parameter_set(>gb, logctx, ps,
> nal->size_bits);

Removed one level of indentation and pushed. Thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [CALL] New FFmpeg developers meeting

2019-08-23 Thread Thilo Borgmann
Hi,

> Because of current overall toxic situation in FFmpeg, meeting will not be
> held until situation improves considerably.

in spite of that, Paul is fine with having a developer meeting as said on IRC. 

Therefore I propose to do a developer meeting in Zagreb, Croatia.
The location is well connected via flights within Europe and internationally, 
so I think it is good for a majority of developers.
Transportation expenses will be reimbursed and accommodation will be free, 
including shoulder nights.

I've setup a doodle-like thing to find a good common date for the meeting 
between IBC and VDD.
If you want to attend, fill in all the dates that comfort you here:

https://framadate.org/gwOce8QtcJPbz4hs

Thanks,
Thilo
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avformat/mov: improve timecode calculation

2019-08-23 Thread Paul B Mahol
Here is patch.

On Thu, Aug 22, 2019 at 6:18 PM Paul B Mahol  wrote:

> Hi,
>
> patch attached.
>


0001-avformat-mov-improve-timecode-calculation.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 2/2] avcodec/mpeg4videodec: Fix integer overflow in mpeg4_decode_studio_block()

2019-08-23 Thread Kieran Kunhya
On Thu, 22 Aug 2019 at 23:55, Michael Niedermayer 
wrote:

> Fixes: signed integer overflow: 24023040 * 112 cannot be represented in
> type 'int'
> Fixes:
> 16570/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-5173275211071488
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by
> :
> Michael Niedermayer 
>
>
ok
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/3] libavutil: AVEncodeInfo data structures

2019-08-23 Thread Nicolas George
Juan De León (12019-08-21):
> AVEncodeInfoFrame data structure to store as AVFrameSideData of type
> AV_FRAME_DATA_ENCODE_INFO.
> The structure stores quantization index for each plane, DC/AC deltas
> for luma and chroma planes, and an array of AVEncodeInfoBlock type
> denoting position, size, and delta quantizer for each block in the
> frame.
> Can be extended to support extraction of other block information.
> 
> Signed-off-by: Juan De León 
> ---
>  libavutil/Makefile  |   2 +
>  libavutil/encode_info.c |  71 ++
>  libavutil/encode_info.h | 110 
>  libavutil/frame.c   |   1 +
>  libavutil/frame.h   |   7 +++
>  5 files changed, 191 insertions(+)
>  create mode 100644 libavutil/encode_info.c
>  create mode 100644 libavutil/encode_info.h
> 
> diff --git a/libavutil/Makefile b/libavutil/Makefile
> index 57e6e3d7e8..37cfb099e9 100644
> --- a/libavutil/Makefile
> +++ b/libavutil/Makefile
> @@ -24,6 +24,7 @@ HEADERS = adler32.h 
> \
>dict.h\
>display.h \
>downmix_info.h\
> +  encode_info.h \
>encryption_info.h \
>error.h   \
>eval.h\
> @@ -111,6 +112,7 @@ OBJS = adler32.o  
>   \
> dict.o   \
> display.o\
> downmix_info.o   \
> +   encode_info.o\
> encryption_info.o\
> error.o  \
> eval.o   \
> diff --git a/libavutil/encode_info.c b/libavutil/encode_info.c
> new file mode 100644
> index 00..91e43fce63
> --- /dev/null
> +++ b/libavutil/encode_info.c
> @@ -0,0 +1,71 @@
> +/*
> + * 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, MA 02110-1301 
> USA
> + */
> +#include 
> +
> +#include "libavutil/encode_info.h"
> +#include "libavutil/mem.h"
> +
> +static int init_encode_info_data(AVEncodeInfoFrame *info, unsigned 
> nb_blocks) {
> +info->nb_blocks = nb_blocks;
> +info->block_size = sizeof(AVEncodeInfoBlock);
> +info->blocks_offset = offsetof(AVEncodeInfoFrame, blocks);
> +
> +for(int i = 0; i < AV_NUM_DATA_POINTERS; i++)
> +info->plane_q[i] = -1;
> +
> +return 0;
> +}
> +
> +AVEncodeInfoFrame *av_encode_info_alloc(unsigned nb_blocks)
> +{
> +// Check for possible size_t overflow
> +if (nb_blocks - 1 > (SIZE_MAX - sizeof(AVEncodeInfoFrame)) / 
> sizeof(AVEncodeInfoBlock))
> +return NULL;
> +//AVEncodeInfoFrame already allocates size for one element of 
> AVEncodeInfoBlock
> +size_t size = sizeof(AVEncodeInfoFrame) - sizeof(AVEncodeInfoBlock) +
> +  FFMAX(1, nb_blocks) * sizeof(AVEncodeInfoBlock);
> +
> +AVEncodeInfoFrame *ptr = av_mallocz(size);
> +if (!ptr)
> +return NULL;
> +
> +init_encode_info_data(ptr, nb_blocks);
> +
> +return ptr;
> +}
> +
> +AVEncodeInfoFrame *av_encode_info_create_side_data(AVFrame *frame, unsigned 
> nb_blocks)
> +{
> +// Check for size_t overflow

> +if (nb_blocks - 1 > (SIZE_MAX - sizeof(AVEncodeInfoFrame)) / 
> sizeof(AVEncodeInfoBlock))
> +return NULL;

nb_blocks - 1 overflows for 0. Move the -1 right of the = as +1.

> +//AVEncodeInfoFrame already allocates size for one element of 
> AVEncodeInfoBlock

> +size_t size = sizeof(AVEncodeInfoFrame) - sizeof(AVEncodeInfoBlock) +
> +  FFMAX(1, nb_blocks) * sizeof(AVEncodeInfoBlock);

This code would be better shared in an inline function or macro instead
of 

Re: [FFmpeg-devel] [PATCH v1] avfilter/showinfo: support displaying for webvtt id and setting side data

2019-08-23 Thread Limin Wang

Sorry, just notice the path is using the wrong type, ignore the patch.

On Fri, Aug 23, 2019 at 10:25:40PM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavfilter/vf_showinfo.c | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
> index 3c13f11..d1f074a 100644
> --- a/libavfilter/vf_showinfo.c
> +++ b/libavfilter/vf_showinfo.c
> @@ -313,6 +313,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
> *frame)
>  case AV_FRAME_DATA_CONTENT_LIGHT_LEVEL:
>  dump_content_light_metadata(ctx, sd);
>  break;
> +case AV_PKT_DATA_WEBVTT_IDENTIFIER:
> +av_log(ctx, AV_LOG_INFO, "WebVTT (%d bytes)", sd->size);
> +break;
> +case AV_PKT_DATA_WEBVTT_SETTINGS:
> +av_log(ctx, AV_LOG_INFO, "WebVTT Settings (%d bytes)", sd->size);
> +break;
>  default:
>  av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%d 
> bytes)",
> sd->type, sd->size);
> -- 
> 2.6.4
> 
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v1] avfilter/showinfo: support displaying for webvtt id and setting side data

2019-08-23 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavfilter/vf_showinfo.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 3c13f11..d1f074a 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -313,6 +313,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*frame)
 case AV_FRAME_DATA_CONTENT_LIGHT_LEVEL:
 dump_content_light_metadata(ctx, sd);
 break;
+case AV_PKT_DATA_WEBVTT_IDENTIFIER:
+av_log(ctx, AV_LOG_INFO, "WebVTT (%d bytes)", sd->size);
+break;
+case AV_PKT_DATA_WEBVTT_SETTINGS:
+av_log(ctx, AV_LOG_INFO, "WebVTT Settings (%d bytes)", sd->size);
+break;
 default:
 av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%d bytes)",
sd->type, sd->size);
-- 
2.6.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 4/5] avcodec/alac: Check for bps of 0

2019-08-23 Thread James Almer
On 8/8/2019 8:23 PM, Michael Niedermayer wrote:
> Fixes: shift exponent 32 is too large for 32-bit type 'unsigned int'
> Fixes: 
> 15764/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5102101203517440
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/alac.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/alac.c b/libavcodec/alac.c
> index 6086e2caa8..1196925aa7 100644
> --- a/libavcodec/alac.c
> +++ b/libavcodec/alac.c
> @@ -250,7 +250,7 @@ static int decode_element(AVCodecContext *avctx, AVFrame 
> *frame, int ch_index,
>  
>  alac->extra_bits = get_bits(>gb, 2) << 3;
>  bps = alac->sample_size - alac->extra_bits + channels - 1;
> -if (bps > 32U) {
> +if (bps > 32 || bps < 1) {
>  avpriv_report_missing_feature(avctx, "bps %d", bps);
>  return AVERROR_PATCHWELCOME;

bps 0 (or negative) is obviously a broken file, so asking for a sample
is pointless. Just return invalid data in those cases, and leave this
check for > 32.

>  }
> 

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avcodec/videotoolbox_hevc: avoid leaking cached_hw_frames_ctx

2019-08-23 Thread Pavel Koshevoy
On Tue, Aug 6, 2019 at 8:50 PM Pavel Koshevoy  wrote:
>
> vtctx->cached_hw_frames_ctx is unref'd in videotoolbox_uninit,
> but videotoolbox_hevc used ff_videotoolbox_uninit which
> doesn't unref cache_hw_frames_ctx.
> ---
>  libavcodec/videotoolbox.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
> index c718e82cc5..acaeef77dd 100644
> --- a/libavcodec/videotoolbox.c
> +++ b/libavcodec/videotoolbox.c
> @@ -1143,7 +1143,7 @@ const AVHWAccel ff_hevc_videotoolbox_hwaccel = {
>  .end_frame  = videotoolbox_hevc_end_frame,
>  .frame_params   = videotoolbox_frame_params,
>  .init   = videotoolbox_common_init,
> -.uninit = ff_videotoolbox_uninit,
> +.uninit = videotoolbox_uninit,
>  .priv_data_size = sizeof(VTContext),
>  };
>
> --
> 2.16.4
>


I'd like to see this merged.   Would anyone be upset if I pushed it?

When I ran into this issue testing on a Tesla P4 I observed that each
hw frames ctx leak would cost ~120MB GPU memory.  Once all GPU memory
is exhausted nvdec and nvenc would fail, and this happens pretty
quickly when processing 4s video fragments from unrelated
sources/timelines.

Rick Kern and Aman Gupta are listed as maintainers for videotoolbox*,
but I don't know how to contact them.

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: reopen new http session for http_persistent when upload file failed

2019-08-23 Thread Ian Klassen
On Fri, Aug 23, 2019 at 2:06 AM Steven Liu  wrote:

> fix ticket: 7975
>
> Signed-off-by: Steven Liu 
> ---
>  libavformat/hlsenc.c | 67
> ++--
>  1 file changed, 54 insertions(+), 13 deletions(-)
>
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 18173cdce1..26e0f3819b 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -118,6 +118,7 @@ typedef struct VariantStream {
>  AVIOContext *out;
>  int packets_written;
>  int init_range_length;
> +uint8_t *temp_buffer;
>
>  AVFormatContext *avf;
>  AVFormatContext *vtt_avf;
> @@ -262,11 +263,12 @@ static int hlsenc_io_open(AVFormatContext *s,
> AVIOContext **pb, char *filename,
>  return err;
>  }
>
> -static void hlsenc_io_close(AVFormatContext *s, AVIOContext **pb, char
> *filename) {
> +static int hlsenc_io_close(AVFormatContext *s, AVIOContext **pb, char
> *filename) {
>  HLSContext *hls = s->priv_data;
>  int http_base_proto = filename ? ff_is_http_proto(filename) : 0;
> +int ret = 0;
>  if (!*pb)
> -return;
> +return ret;
>  if (!http_base_proto || !hls->http_persistent || hls->key_info_file
> || hls->encrypt) {
>  ff_format_io_close(s, pb);
>  #if CONFIG_HTTP_PROTOCOL
> @@ -274,9 +276,10 @@ static void hlsenc_io_close(AVFormatContext *s,
> AVIOContext **pb, char *filename
>  URLContext *http_url_context = ffio_geturlcontext(*pb);
>  av_assert0(http_url_context);
>  avio_flush(*pb);
> -ffurl_shutdown(http_url_context, AVIO_FLAG_WRITE);
> +ret = ffurl_shutdown(http_url_context, AVIO_FLAG_WRITE);
>  #endif
>  }
> +return ret;
>  }
>
>  static void set_http_options(AVFormatContext *s, AVDictionary **options,
> HLSContext *c)
> @@ -447,7 +450,6 @@ static void write_styp(AVIOContext *pb)
>  static int flush_dynbuf(VariantStream *vs, int *range_length)
>  {
>  AVFormatContext *ctx = vs->avf;
> -uint8_t *buffer;
>
>  if (!ctx->pb) {
>  return AVERROR(EINVAL);
> @@ -458,15 +460,20 @@ static int flush_dynbuf(VariantStream *vs, int
> *range_length)
>  avio_flush(ctx->pb);
>
>  // write out to file
> -*range_length = avio_close_dyn_buf(ctx->pb, );
> +*range_length = avio_close_dyn_buf(ctx->pb, >temp_buffer);
>  ctx->pb = NULL;
> -avio_write(vs->out, buffer, *range_length);
> -av_free(buffer);
> +avio_write(vs->out, vs->temp_buffer, *range_length);
>
>  // re-open buffer
>  return avio_open_dyn_buf(>pb);
>  }
>
> +static void reflush_dynbuf(VariantStream *vs, int *range_length)
> +{
> +// re-open buffer
> +avio_write(vs->out, vs->temp_buffer, *range_length);;
> +}
> +
>  static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls,
> VariantStream *vs) {
>
> @@ -1544,7 +1551,10 @@ static int hls_window(AVFormatContext *s, int last,
> VariantStream *vs)
>
>  fail:
>  av_dict_free();
> -hlsenc_io_close(s, (byterange_mode || hls->segment_type ==
> SEGMENT_TYPE_FMP4) ? >m3u8_out : >out, temp_filename);
> +ret = hlsenc_io_close(s, (byterange_mode || hls->segment_type ==
> SEGMENT_TYPE_FMP4) ? >m3u8_out : >out, temp_filename);
> +if (ret < 0) {
> +return ret;
> +}
>  hlsenc_io_close(s, >sub_m3u8_out, vs->vtt_m3u8_name);
>  if (use_temp_file) {
>  ff_rename(temp_filename, vs->m3u8_name, s);
> @@ -2399,7 +2409,16 @@ static int hls_write_packet(AVFormatContext *s,
> AVPacket *pkt)
>  if (ret < 0) {
>  return ret;
>  }
> -hlsenc_io_close(s, >out, filename);
> +ret = hlsenc_io_close(s, >out, filename);
> +if (ret < 0) {
> +av_log(s, AV_LOG_WARNING, "upload segment failed,"
> +   "and will retry upload by a new http
> session.\n");
> +ff_format_io_close(s, >out);
> +ret = hlsenc_io_open(s, >out, filename, );
> +reflush_dynbuf(vs, _length);
> +ret = hlsenc_io_close(s, >out, filename);
> +}
> +av_free(vs->temp_buffer);
>  av_free(filename);
>  }
>  }
> @@ -2426,8 +2445,13 @@ static int hls_write_packet(AVFormatContext *s,
> AVPacket *pkt)
>  // if we're building a VOD playlist, skip writing the manifest
> multiple times, and just wait until the end
>  if (hls->pl_type != PLAYLIST_TYPE_VOD) {
>  if ((ret = hls_window(s, 0, vs)) < 0) {
> -av_free(old_filename);
> -return ret;
> +av_log(s, AV_LOG_WARNING, "update playlist failed, will
> retry once time\n");
> +ff_format_io_close(s, >out);
> +vs->out = NULL;
> +if ((ret = hls_window(s, 0, vs)) < 0) {
> +av_free(old_filename);
> +

Re: [FFmpeg-devel] [PATCH v2] tools/target_dec_fuzzer: use refcounted packets

2019-08-23 Thread James Almer
On 8/22/2019 4:01 PM, James Almer wrote:
> On 8/21/2019 10:21 AM, James Almer wrote:
>> On 8/21/2019 6:15 AM, Tomas Härdin wrote:
>>> tis 2019-08-20 klockan 21:05 -0300 skrev James Almer:
 Should reduce date copying considerably.

 Signed-off-by: James Almer 
 ---
 Fixed a stupid mistake when checking the return value for av_new_packet().
 Still untested.
>>>
>>> Works great for me. Should make fuzzing faster overall, better use of
>>> computing resources imo
>>>
 @@ -186,6 +144,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
 size) {
  error("Failed memory allocation");
  
  ctx->max_pixels = maxpixels_per_frame; //To reduce false positive OOM 
 and hangs
 +ctx->refcounted_frames = 1;
>>>
>>> Could maybe have a comment that this is also to reduce false positives,
>>> or that we want to focus on the new API rather than the old one
>>
>> Sure.
>>
>>>
 @@ -240,7 +199,10 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, 
 size_t size) {
  if (data + sizeof(fuzz_tag) > end)
  data = end;
  
 -FDBPrepare(, , last, data - last);
 +res = av_new_packet(, data - last);
 +if (res < 0)
 +error("Failed memory allocation");
 +memcpy(parsepkt.data, last, data - last);
>>>
>>> Is there some way to avoid this copy?
>>
>> I could create packets that point to a specific offset in the input
>> fuzzed buffer, but that will mean they will lack the padding required by
>> the API, not to mention the complete lack of control over said buffer's
>> lifetime. This could either generate no issues, or make things go really
>> wrong.
>>
>> So to make proper use of the AVPacket API, i need to allocate their
>> reference counted buffers and populate them. After this patch the
>> behaviour of this fuzzer is essentially the same as if it was a
>> libavformat demuxer, creating packets out of an input file and
>> propagating them to libavcodec.
>> If the idea was to imitate an average library user's behavior, this
>> pretty much is it.
>>
>>>
>>> /Tomas
> 
> Will push with the requested comment added soon.

Pushed, thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] EOF and IO error checking

2019-08-23 Thread Michael Niedermayer
On Thu, Aug 22, 2019 at 10:47:17AM +0200, Marton Balint wrote:
> 
> 
> On Sun, 18 Aug 2019, Michael Niedermayer wrote:
> 
> >On Sat, Aug 17, 2019 at 09:10:59PM +0200, Marton Balint wrote:
> >>Hi,
> >>
> >>As you might now avio_feof() returns true both in case of actual EOF and in
> >>case of IO errors.
> >>
> >>Some demuxers (matroska) have special handling for this exact reason, e.g.:
> >>
> >>if (avio_feof(pb)) {
> >>if (pb->error) {
> >>return pb->error;
> >>} else {
> >>return AVERROR_EOF;
> >>}
> >>}
> >>
> >>Most of the demuxers do not, so there is a real chance that IO errrors are
> >>mistaken for EOF.
> >>
> >>What should we do about this?
> >>
> >>a) Fix every demuxer to return IO error if there is one.
> >>
> >>b) Add special code to ff_read_packet which checks if there is an error in
> >>the IO context and return that if there is?
> >
> >>
> >>c) Add code to ffmpeg.c which checks the IO context error code after every
> >>av_read_frame call?
> >
> >This while generally correct is not guranteed to be correct.
> >The internal IO context may have an IO error without the demuxer having an
> >error. From the possibility of reconnects to redundancy to errors after
> >all essential parts of a file ...
> >so this may need some flag per demuxer that either declares this relation
> >true or a flag declaring it false
> 
> Do you have an example in mind for a demuxer which specifically needs this?
> From the top of my head I can't think of one.
> 
> Reconnects happen in the protocol handlers, so errors there should not
> affect the AVIO context errors.
> 
> I am also sceptical about the use case of gracefully handling IO errors in
> non-essential parts of the file. Signalling IO errors is a lot more
> important and I bet there are cases where some demuxer won't set the packet
> corrupt flag (which is by the way not propagated correctly through the API)
> if it encounters an IO error when reading something.
> 
> In any case, I don't mind too much option a), if that what seems more clean
> but we will probably miss a few cases of the issue.

Some formats have an index at the end, which is optional and the file works 
fine without but if its missing or on a bad sector maybe the IO context would be
left in a state of error until the next packet is read.
Also some demuxers may have some form of buffer between what they read and
the output for the user, an IO error may be set in the IO context before
prior packets are returned.
we also read a few packets ahead to obtain resolution and such in some cases
again what the user gets as packet is from a buffer while the IO context
represents the future.
so simply using the IO contexts error state might not work unconditionally
when it works sure iam fine with it ...


Thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 3/5] avcodec/alac: Fix multiple integer overflows in lpc_prediction()

2019-08-23 Thread Michael Niedermayer
On Fri, Aug 09, 2019 at 01:23:48AM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 2088795537 + 2147254401 cannot be represented 
> in type 'int'
> Fixes: signed integer overflow: -1500363496 + -1295351808 cannot be 
> represented in type 'int'
> Fixes: signed integer overflow: -79560 * 32640 cannot be represented in type 
> 'int'
> Fixes: signed integer overflow: 2088910005 + 2088796058 cannot be represented 
> in type 'int'
> Fixes: signed integer overflow: -117258064 - 2088725225 cannot be represented 
> in type 'int'
> Fixes: signed integer overflow: 2088725225 - -117258064 cannot be represented 
> in type 'int'
> Fixes: 
> 15739/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5630664122040320
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/alac.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)

will apply

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

The worst form of inequality is to try to make unequal things equal.
-- Aristotle


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 5/5] avcodec/smacker: Check that not all tables are skiped

2019-08-23 Thread Michael Niedermayer
On Fri, Aug 09, 2019 at 01:23:50AM +0200, Michael Niedermayer wrote:
> If all tables are skipped it would be impossible to encode any
> "non black" video.
> 
> Fixes: Timeout (78sec -> 1ms)
> Fixes: 
> 15821/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMACKER_fuzzer-5652598838788096
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/smacker.c | 7 +++
>  1 file changed, 7 insertions(+)

will apply

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

If you drop bombs on a foreign country and kill a hundred thousand
innocent people, expect your government to call the consequence
"unprovoked inhuman terrorist attacks" and use it to justify dropping
more bombs and killing more people. The technology changed, the idea is old.


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 3/6] avcodec/pictordec: Optimize picmemset() for single plane full lines

2019-08-23 Thread Michael Niedermayer
On Sat, Aug 03, 2019 at 01:09:49PM +0200, Michael Niedermayer wrote:
> On Sat, Aug 03, 2019 at 12:43:32PM +1000, Peter Ross wrote:
> > On Sat, Aug 03, 2019 at 01:49:54AM +0200, Michael Niedermayer wrote:
> > > Fixes: Timeout (72sec -> 1sec)
> > > Fixes: 
> > > 15512/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PICTOR_fuzzer-5663942342344704
> > > 
> > > Found-by: continuous fuzzing process 
> > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > > Signed-off-by: Michael Niedermayer 
> > > ---
> > >  libavcodec/pictordec.c | 16 +++-
> > >  1 file changed, 15 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/libavcodec/pictordec.c b/libavcodec/pictordec.c
> > > index 2e6fcdca52..5beb03cd5d 100644
> > > --- a/libavcodec/pictordec.c
> > > +++ b/libavcodec/pictordec.c
> > > @@ -66,6 +66,7 @@ static void picmemset(PicContext *s, AVFrame *frame, 
> > > unsigned value, int run,
> > >  int xl = *x;
> > >  int yl = *y;
> > >  int planel = *plane;
> > > +int pixels_per_value = 8/bits_per_plane;
> > >  value   <<= shift;
> > >  
> > >  d = frame->data[0] + yl * frame->linesize[0];
> > > @@ -74,7 +75,7 @@ static void picmemset(PicContext *s, AVFrame *frame, 
> > > unsigned value, int run,
> > >  for (j = 8-bits_per_plane; j >= 0; j -= bits_per_plane) {
> > >  d[xl] |= (value >> j) & mask;
> > >  xl += 1;
> > > -if (xl == s->width) {
> > > +while (xl == s->width) {
> > >  yl -= 1;
> > >  xl = 0;
> > >  if (yl < 0) {
> > > @@ -86,6 +87,19 @@ static void picmemset(PicContext *s, AVFrame *frame, 
> > > unsigned value, int run,
> > > mask  <<= bits_per_plane;
> > >  }
> > >  d = frame->data[0] + yl * frame->linesize[0];
> > > +if (s->nb_planes == 1 &&
> > > +run*pixels_per_value >= s->width &&
> > > +pixels_per_value < s->width) {
> > > +int j;
> > > +for (j = 8-bits_per_plane; j >= 0; j -= 
> > > bits_per_plane) {
> > 
> > suggest naming it 'k' to avoid confusion with earlier for loop.
> 
> actually, looking at this again, i think we should use the same j,
> This also now excludes s->width % pixels_per_value != 0 for which i suspect 
> there
> is no testcase. Ill add support for this in case the fuzzer finds a case
> that way we then also have a testcase for implementing that corner case.
> 
> heres the new code:
> 
> --- a/libavcodec/pictordec.c
> +++ b/libavcodec/pictordec.c
> @@ -66,6 +66,7 @@ static void picmemset(PicContext *s, AVFrame *frame, 
> unsigned value, int run,
>  int xl = *x;
>  int yl = *y;
>  int planel = *plane;
> +int pixels_per_value = 8/bits_per_plane;
>  value   <<= shift;
>  
>  d = frame->data[0] + yl * frame->linesize[0];
> @@ -74,7 +75,7 @@ static void picmemset(PicContext *s, AVFrame *frame, 
> unsigned value, int run,
>  for (j = 8-bits_per_plane; j >= 0; j -= bits_per_plane) {
>  d[xl] |= (value >> j) & mask;
>  xl += 1;
> -if (xl == s->width) {
> +while (xl == s->width) {
>  yl -= 1;
>  xl = 0;
>  if (yl < 0) {
> @@ -86,6 +87,19 @@ static void picmemset(PicContext *s, AVFrame *frame, 
> unsigned value, int run,
> mask  <<= bits_per_plane;
>  }
>  d = frame->data[0] + yl * frame->linesize[0];
> +if (s->nb_planes == 1 &&
> +run*pixels_per_value >= s->width &&
> +pixels_per_value < s->width &&
> +s->width % pixels_per_value == 0
> +) {
> +for (; xl < pixels_per_value; xl ++) {
> +j = (j < bits_per_plane ? 8 : j) - bits_per_plane;
> +d[xl] |= (value >> j) & mask;
> +}
> +av_memcpy_backptr(d+xl, pixels_per_value, s->width - xl);
> +run -= s->width / pixels_per_value;
> +xl = s->width;
> +}
>  }
>  }
>  run--;


will apply

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Whats the most studid thing your enemy could do ? Blow himself up
Whats the most studid thing you could do ? Give up your rights and
freedom because your enemy blew himself up.



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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 5/5] avcodec/pnm_parser: Use memmove() to handle "overread"

2019-08-23 Thread Michael Niedermayer
On Thu, Aug 01, 2019 at 11:44:43PM +0200, Michael Niedermayer wrote:
> This is significantly faster
> 
> Fixes: Timeout (1sec after this and the previous commit)
> Fixes: 
> 15558/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PPM_fuzzer-5705273643106304
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/pnm_parser.c | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)

will apply

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

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 3/5] avcodec/pnm: skip reading trailing bytes in get_pnm()

2019-08-23 Thread Michael Niedermayer
On Thu, Aug 01, 2019 at 11:44:41PM +0200, Michael Niedermayer wrote:
> None of the keys we support is that long and other keys
> lead to decoder failure. None of the values is expected
> to be longer, they are all numbers or short keywords.
> 
> This simplifies the code
> 
> Fixes: Timeout (9sec->43ms)
> Fixes: 
> 15177/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PAM_fuzzer-5080556716425216
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/pnm.c | 2 --
>  1 file changed, 2 deletions(-)

will apply

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

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 2/5] avcodec/pnm: Check magic bytes directly without pnm_get()

2019-08-23 Thread Michael Niedermayer
On Thu, Aug 01, 2019 at 11:44:40PM +0200, Michael Niedermayer wrote:
> Fixes: Timeout (10sec -> 30ms) (case 15089)
> Fixes: 
> 15089/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PBM_fuzzer-5767535057698816
> Fixes: 
> 16001/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PGM_fuzzer-5199169645445120
> Fixes: 
> 16003/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PGMYUV_fuzzer-5076443270217728
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/pnm.c | 10 +++---
>  1 file changed, 7 insertions(+), 3 deletions(-)

will apply


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

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 4/5] avcodec/parser: Optimize ff_combine_frame() with massivly negative next

2019-08-23 Thread Michael Niedermayer
On Thu, Aug 01, 2019 at 11:44:42PM +0200, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes: 
> 15558/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PPM_fuzzer-5705273643106304
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/parser.c | 4 
>  1 file changed, 4 insertions(+)

will apply

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

I have often repented speaking, but never of holding my tongue.
-- Xenocrates


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 3/3] avformat/mpsubdec: Check pts / duration before cast

2019-08-23 Thread Michael Niedermayer
On Mon, Jul 29, 2019 at 01:09:31AM +0200, Michael Niedermayer wrote:
> Fixes: 3e+47 is outside the range of representable values of type 'int'
> Fixes: 
> 16057/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-569307214848
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/mpsubdec.c | 11 +--
>  1 file changed, 9 insertions(+), 2 deletions(-)

will apply

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

Dictatorship: All citizens are under surveillance, all their steps and
actions recorded, for the politicians to enforce control.
Democracy: All politicians are under surveillance, all their steps and
actions recorded, for the citizens to enforce control.


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 2/2] avcodec/lcldec: Check mthread_inlen instead of cliping

2019-08-23 Thread Michael Niedermayer
On Sun, Jul 28, 2019 at 12:31:22AM +0200, Michael Niedermayer wrote:
> Clipping was added in 2009 to avoid crashes.
> The clipped case would produce a 2nd slice with 0 input
> thus also producing 0 output.
> Subsequent checks will cause decoder failure unless both
> slices have the same output length. thus the only way this
> would not already fail is if the output from both slices
> was 0 bytes.
> 
> Fixes: Timeout (134sec -> 241ms)
> Fixes: 
> 15599/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MSZH_fuzzer-5658127116009472
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/lcldec.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

will apply

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

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v3 2/3] avfilter/vsrc_mptestsrc: simplify the code and change the type of frame

2019-08-23 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavfilter/vsrc_mptestsrc.c | 27 ++-
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/libavfilter/vsrc_mptestsrc.c b/libavfilter/vsrc_mptestsrc.c
index 4a2db18..4101690 100644
--- a/libavfilter/vsrc_mptestsrc.c
+++ b/libavfilter/vsrc_mptestsrc.c
@@ -308,7 +308,8 @@ static int request_frame(AVFilterLink *outlink)
 AVFrame *picref;
 int w = WIDTH, h = HEIGHT,
 cw = AV_CEIL_RSHIFT(w, test->hsub), ch = AV_CEIL_RSHIFT(h, test->vsub);
-unsigned int frame = outlink->frame_count_in;
+uint64_t frame = outlink->frame_count_in / test->max_frames;
+uint64_t mod = outlink->frame_count_in % test->max_frames;
 enum test_type tt = test->test;
 int i;
 
@@ -327,20 +328,20 @@ static int request_frame(AVFilterLink *outlink)
 memset(picref->data[2] + i*picref->linesize[2], 128, cw);
 }
 
-if (tt == TEST_ALL && frame%test->max_frames) /* draw a black frame at the 
beginning of each test */
-tt = (frame/test->max_frames)%(TEST_NB-1);
+if (tt == TEST_ALL && mod) /* draw a black frame at the beginning of each 
test */
+tt = frame%(TEST_NB-1);
 
 switch (tt) {
-case TEST_DC_LUMA:   dc_test(picref->data[0], picref->linesize[0], 
256, 256, frame%test->max_frames); break;
-case TEST_DC_CHROMA: dc_test(picref->data[1], picref->linesize[1], 
256, 256, frame%test->max_frames); break;
-case TEST_FREQ_LUMA:   freq_test(picref->data[0], picref->linesize[0], 
frame%test->max_frames); break;
-case TEST_FREQ_CHROMA: freq_test(picref->data[1], picref->linesize[1], 
frame%test->max_frames); break;
-case TEST_AMP_LUMA: amp_test(picref->data[0], picref->linesize[0], 
frame%test->max_frames); break;
-case TEST_AMP_CHROMA:   amp_test(picref->data[1], picref->linesize[1], 
frame%test->max_frames); break;
-case TEST_CBP:  cbp_test(picref->data   , picref->linesize   , 
frame%test->max_frames); break;
-case TEST_MV:mv_test(picref->data[0], picref->linesize[0], 
frame%test->max_frames); break;
-case TEST_RING1:  ring1_test(picref->data[0], picref->linesize[0], 
frame%test->max_frames); break;
-case TEST_RING2:  ring2_test(picref->data[0], picref->linesize[0], 
frame%test->max_frames); break;
+case TEST_DC_LUMA:   dc_test(picref->data[0], picref->linesize[0], 
256, 256, mod); break;
+case TEST_DC_CHROMA: dc_test(picref->data[1], picref->linesize[1], 
256, 256, mod); break;
+case TEST_FREQ_LUMA:   freq_test(picref->data[0], picref->linesize[0], 
mod); break;
+case TEST_FREQ_CHROMA: freq_test(picref->data[1], picref->linesize[1], 
mod); break;
+case TEST_AMP_LUMA: amp_test(picref->data[0], picref->linesize[0], 
mod); break;
+case TEST_AMP_CHROMA:   amp_test(picref->data[1], picref->linesize[1], 
mod); break;
+case TEST_CBP:  cbp_test(picref->data   , picref->linesize   , 
mod); break;
+case TEST_MV:mv_test(picref->data[0], picref->linesize[0], 
mod); break;
+case TEST_RING1:  ring1_test(picref->data[0], picref->linesize[0], 
mod); break;
+case TEST_RING2:  ring2_test(picref->data[0], picref->linesize[0], 
mod); break;
 }
 
 return ff_filter_frame(outlink, picref);
-- 
2.6.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/2] doc/examples/decode_audio: print message about how to play the output file

2019-08-23 Thread Limin Wang
On Wed, Aug 21, 2019 at 07:34:28PM +0800, Steven Liu wrote:
> Signed-off-by: Steven Liu 
> ---
>  doc/examples/decode_audio.c | 51 +
>  1 file changed, 51 insertions(+)
> 
> diff --git a/doc/examples/decode_audio.c b/doc/examples/decode_audio.c
> index 19dcafd2c8..23d0c9bf50 100644
> --- a/doc/examples/decode_audio.c
> +++ b/doc/examples/decode_audio.c
> @@ -39,6 +39,35 @@
>  #define AUDIO_INBUF_SIZE 20480
>  #define AUDIO_REFILL_THRESH 4096
>  
> +static int get_format_from_sample_fmt(const char **fmt,
> +  enum AVSampleFormat sample_fmt)
> +{
> +int i;
> +struct sample_fmt_entry {
> +enum AVSampleFormat sample_fmt; const char *fmt_be, *fmt_le;
> +} sample_fmt_entries[] = {
> +{ AV_SAMPLE_FMT_U8,  "u8","u8"},
> +{ AV_SAMPLE_FMT_S16, "s16be", "s16le" },
> +{ AV_SAMPLE_FMT_S32, "s32be", "s32le" },
> +{ AV_SAMPLE_FMT_FLT, "f32be", "f32le" },
> +{ AV_SAMPLE_FMT_DBL, "f64be", "f64le" },
> +};
> +*fmt = NULL;
> +
> +for (i = 0; i < FF_ARRAY_ELEMS(sample_fmt_entries); i++) {
> +struct sample_fmt_entry *entry = _fmt_entries[i];
> +if (sample_fmt == entry->sample_fmt) {
> +*fmt = AV_NE(entry->fmt_be, entry->fmt_le);
> +return 0;
> +}
> +}
> +
> +fprintf(stderr,
> +"sample format %s is not supported as output format\n",
> +av_get_sample_fmt_name(sample_fmt));
> +return -1;
> +}
> +
>  static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame,
> FILE *outfile)
>  {
> @@ -172,6 +201,28 @@ int main(int argc, char **argv)
>  pkt->size = 0;
>  decode(c, pkt, decoded_frame, outfile);
>  
> +/* print output pcm infomations, because there have no metadata of pcm */
> +enum AVSampleFormat sfmt = c->sample_fmt;
> +int n_channels = c->channels;
> +const char *fmt;
> +
> +if (av_sample_fmt_is_planar(sfmt)) {
> +const char *packed = av_get_sample_fmt_name(sfmt);
> +printf("Warning: the sample format the decoder produced is planar "
> +   "(%s). This example will output the first channel only.\n",
> +   packed ? packed : "?");
> +sfmt = av_get_packed_sample_fmt(sfmt);
> +}
> +
> +n_channels = c->channels;

duplicate code with line#53?

> +if ((ret = get_format_from_sample_fmt(, sfmt)) < 0)
> +goto end;
> +
> +printf("Play the output audio file with the command:\n"
> +   "ffplay -f %s -ac %d -ar %d %s\n",
> +   fmt, n_channels, c->sample_rate,
> +   outfilename);
> +end:
>  fclose(outfile);
>  fclose(f);
>  
> -- 
> 2.17.2 (Apple Git-113)
> 
> 
> 
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v3 3/3] FATE: add a test for freeezedetect

2019-08-23 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 tests/fate/filter-video.mak |   4 +
 tests/ref/fate/filter-metadata-freezedetect | 251 
 2 files changed, 255 insertions(+)
 create mode 100644 tests/ref/fate/filter-metadata-freezedetect

diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index 60c6be1..3ef281b 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -742,6 +742,10 @@ FATE_METADATA_FILTER-$(call ALLYES, $(CROPDETECT_DEPS)) += 
fate-filter-metadata-
 fate-filter-metadata-cropdetect: SRC = $(TARGET_SAMPLES)/filter/cropdetect.mp4
 fate-filter-metadata-cropdetect: CMD = run $(FILTER_METADATA_COMMAND) 
"sws_flags=+accurate_rnd+bitexact;movie='$(SRC)',cropdetect=max_outliers=3"
 
+FREEZEDETECT_DEPS = FFPROBE AVDEVICE LAVFI_INDEV MPTESTSRC_FILTER SCALE_FILTER 
FREEZEDETECT_FILTER
+FATE_METADATA_FILTER-$(call ALLYES, $(FREEZEDETECT_DEPS)) += 
fate-filter-metadata-freezedetect
+fate-filter-metadata-freezedetect: CMD = run $(FILTER_METADATA_COMMAND) 
"sws_flags=+accurate_rnd+bitexact;mptestsrc=r=25:d=10:m=51,freezedetect"
+
 SILENCEDETECT_DEPS = FFPROBE AVDEVICE LAVFI_INDEV AMOVIE_FILTER TTA_DEMUXER 
TTA_DECODER SILENCEDETECT_FILTER
 FATE_METADATA_FILTER-$(call ALLYES, $(SILENCEDETECT_DEPS)) += 
fate-filter-metadata-silencedetect
 fate-filter-metadata-silencedetect: SRC = 
$(TARGET_SAMPLES)/lossless-audio/inside.tta
diff --git a/tests/ref/fate/filter-metadata-freezedetect 
b/tests/ref/fate/filter-metadata-freezedetect
new file mode 100644
index 000..a0ee38e
--- /dev/null
+++ b/tests/ref/fate/filter-metadata-freezedetect
@@ -0,0 +1,251 @@
+pkt_pts=0
+pkt_pts=1
+pkt_pts=2
+pkt_pts=3
+pkt_pts=4
+pkt_pts=5
+pkt_pts=6
+pkt_pts=7
+pkt_pts=8
+pkt_pts=9
+pkt_pts=10
+pkt_pts=11
+pkt_pts=12
+pkt_pts=13
+pkt_pts=14
+pkt_pts=15
+pkt_pts=16
+pkt_pts=17
+pkt_pts=18
+pkt_pts=19
+pkt_pts=20
+pkt_pts=21
+pkt_pts=22
+pkt_pts=23
+pkt_pts=24
+pkt_pts=25
+pkt_pts=26
+pkt_pts=27
+pkt_pts=28
+pkt_pts=29
+pkt_pts=30
+pkt_pts=31
+pkt_pts=32
+pkt_pts=33
+pkt_pts=34
+pkt_pts=35
+pkt_pts=36
+pkt_pts=37
+pkt_pts=38
+pkt_pts=39
+pkt_pts=40
+pkt_pts=41
+pkt_pts=42
+pkt_pts=43
+pkt_pts=44
+pkt_pts=45
+pkt_pts=46
+pkt_pts=47
+pkt_pts=48
+pkt_pts=49
+pkt_pts=50
+pkt_pts=51
+pkt_pts=52
+pkt_pts=53
+pkt_pts=54
+pkt_pts=55
+pkt_pts=56
+pkt_pts=57
+pkt_pts=58
+pkt_pts=59
+pkt_pts=60
+pkt_pts=61
+pkt_pts=62
+pkt_pts=63
+pkt_pts=64
+pkt_pts=65
+pkt_pts=66
+pkt_pts=67
+pkt_pts=68
+pkt_pts=69
+pkt_pts=70
+pkt_pts=71
+pkt_pts=72
+pkt_pts=73
+pkt_pts=74
+pkt_pts=75
+pkt_pts=76
+pkt_pts=77
+pkt_pts=78
+pkt_pts=79
+pkt_pts=80
+pkt_pts=81
+pkt_pts=82
+pkt_pts=83
+pkt_pts=84
+pkt_pts=85
+pkt_pts=86
+pkt_pts=87
+pkt_pts=88
+pkt_pts=89
+pkt_pts=90
+pkt_pts=91
+pkt_pts=92
+pkt_pts=93
+pkt_pts=94
+pkt_pts=95
+pkt_pts=96
+pkt_pts=97
+pkt_pts=98
+pkt_pts=99
+pkt_pts=100
+pkt_pts=101
+pkt_pts=102
+pkt_pts=103
+pkt_pts=104
+pkt_pts=105
+pkt_pts=106
+pkt_pts=107
+pkt_pts=108
+pkt_pts=109
+pkt_pts=110
+pkt_pts=111
+pkt_pts=112
+pkt_pts=113
+pkt_pts=114
+pkt_pts=115
+pkt_pts=116
+pkt_pts=117
+pkt_pts=118
+pkt_pts=119
+pkt_pts=120
+pkt_pts=121
+pkt_pts=122
+pkt_pts=123
+pkt_pts=124
+pkt_pts=125
+pkt_pts=126
+pkt_pts=127
+pkt_pts=128
+pkt_pts=129
+pkt_pts=130
+pkt_pts=131
+pkt_pts=132
+pkt_pts=133
+pkt_pts=134
+pkt_pts=135
+pkt_pts=136
+pkt_pts=137
+pkt_pts=138
+pkt_pts=139
+pkt_pts=140
+pkt_pts=141
+pkt_pts=142
+pkt_pts=143
+pkt_pts=144
+pkt_pts=145
+pkt_pts=146
+pkt_pts=147
+pkt_pts=148
+pkt_pts=149
+pkt_pts=150
+pkt_pts=151
+pkt_pts=152
+pkt_pts=153|tag:lavfi.freezedetect.freeze_start=4.12|tag:lavfi.freezedetect.freeze_duration=2|tag:lavfi.freezedetect.freeze_end=6.12
+pkt_pts=154
+pkt_pts=155
+pkt_pts=156
+pkt_pts=157
+pkt_pts=158
+pkt_pts=159
+pkt_pts=160
+pkt_pts=161
+pkt_pts=162
+pkt_pts=163
+pkt_pts=164
+pkt_pts=165
+pkt_pts=166
+pkt_pts=167
+pkt_pts=168
+pkt_pts=169
+pkt_pts=170
+pkt_pts=171
+pkt_pts=172
+pkt_pts=173
+pkt_pts=174
+pkt_pts=175
+pkt_pts=176
+pkt_pts=177
+pkt_pts=178
+pkt_pts=179
+pkt_pts=180
+pkt_pts=181
+pkt_pts=182
+pkt_pts=183
+pkt_pts=184
+pkt_pts=185
+pkt_pts=186
+pkt_pts=187
+pkt_pts=188
+pkt_pts=189
+pkt_pts=190
+pkt_pts=191
+pkt_pts=192
+pkt_pts=193
+pkt_pts=194
+pkt_pts=195
+pkt_pts=196
+pkt_pts=197
+pkt_pts=198
+pkt_pts=199
+pkt_pts=200
+pkt_pts=201
+pkt_pts=202
+pkt_pts=203
+pkt_pts=204|tag:lavfi.freezedetect.freeze_start=6.16|tag:lavfi.freezedetect.freeze_duration=2|tag:lavfi.freezedetect.freeze_end=8.16
+pkt_pts=205
+pkt_pts=206
+pkt_pts=207
+pkt_pts=208
+pkt_pts=209
+pkt_pts=210
+pkt_pts=211
+pkt_pts=212
+pkt_pts=213
+pkt_pts=214
+pkt_pts=215
+pkt_pts=216
+pkt_pts=217
+pkt_pts=218
+pkt_pts=219
+pkt_pts=220
+pkt_pts=221
+pkt_pts=222
+pkt_pts=223
+pkt_pts=224
+pkt_pts=225
+pkt_pts=226
+pkt_pts=227
+pkt_pts=228
+pkt_pts=229
+pkt_pts=230
+pkt_pts=231
+pkt_pts=232
+pkt_pts=233
+pkt_pts=234
+pkt_pts=235
+pkt_pts=236
+pkt_pts=237
+pkt_pts=238
+pkt_pts=239
+pkt_pts=240
+pkt_pts=241
+pkt_pts=242
+pkt_pts=243
+pkt_pts=244
+pkt_pts=245

[FFmpeg-devel] [PATCH v3 1/3] avfilter/vsrc_mptestsrc: add options to set the maximum number of frames

2019-08-23 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 doc/filters.texi |  3 +++
 libavfilter/vsrc_mptestsrc.c | 29 +
 2 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 01262d8..a6371e4 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -20258,6 +20258,9 @@ Set the number or the name of the test to perform. 
Supported tests are:
 @item ring2
 @item all
 
+@item max_frames, m
+Set the maximum number of frames generated for each test, default value is 30.
+
 @end table
 
 Default value is "all", which will cycle through the list of all tests.
diff --git a/libavfilter/vsrc_mptestsrc.c b/libavfilter/vsrc_mptestsrc.c
index c5fdea7..4a2db18 100644
--- a/libavfilter/vsrc_mptestsrc.c
+++ b/libavfilter/vsrc_mptestsrc.c
@@ -54,6 +54,7 @@ typedef struct MPTestContext {
 const AVClass *class;
 AVRational frame_rate;
 int64_t pts, max_pts, duration;
+int64_t max_frames;
 int hsub, vsub;
 int test;   ///< test_type
 } MPTestContext;
@@ -79,6 +80,10 @@ static const AVOption mptestsrc_options[]= {
 { "ring1",   "", 0, AV_OPT_TYPE_CONST, {.i64=TEST_RING1},   
INT_MIN, INT_MAX, FLAGS, "test" },
 { "ring2",   "", 0, AV_OPT_TYPE_CONST, {.i64=TEST_RING2},   
INT_MIN, INT_MAX, FLAGS, "test" },
 { "all", "", 0, AV_OPT_TYPE_CONST, {.i64=TEST_ALL}, 
INT_MIN, INT_MAX, FLAGS, "test" },
+{ "max_frames", "Set the maximum number of frames generated for each 
test", OFFSET(max_frames),
+AV_OPT_TYPE_INT, {.i64 = 30}, 1, INT64_MAX, FLAGS },
+{ "m",  "Set the maximum number of frames generated for each 
test", OFFSET(max_frames),
+AV_OPT_TYPE_INT, {.i64 = 30}, 1, INT64_MAX, FLAGS },
 { NULL }
 };
 
@@ -322,20 +327,20 @@ static int request_frame(AVFilterLink *outlink)
 memset(picref->data[2] + i*picref->linesize[2], 128, cw);
 }
 
-if (tt == TEST_ALL && frame%30) /* draw a black frame at the beginning of 
each test */
-tt = (frame/30)%(TEST_NB-1);
+if (tt == TEST_ALL && frame%test->max_frames) /* draw a black frame at the 
beginning of each test */
+tt = (frame/test->max_frames)%(TEST_NB-1);
 
 switch (tt) {
-case TEST_DC_LUMA:   dc_test(picref->data[0], picref->linesize[0], 
256, 256, frame%30); break;
-case TEST_DC_CHROMA: dc_test(picref->data[1], picref->linesize[1], 
256, 256, frame%30); break;
-case TEST_FREQ_LUMA:   freq_test(picref->data[0], picref->linesize[0], 
frame%30); break;
-case TEST_FREQ_CHROMA: freq_test(picref->data[1], picref->linesize[1], 
frame%30); break;
-case TEST_AMP_LUMA: amp_test(picref->data[0], picref->linesize[0], 
frame%30); break;
-case TEST_AMP_CHROMA:   amp_test(picref->data[1], picref->linesize[1], 
frame%30); break;
-case TEST_CBP:  cbp_test(picref->data   , picref->linesize   , 
frame%30); break;
-case TEST_MV:mv_test(picref->data[0], picref->linesize[0], 
frame%30); break;
-case TEST_RING1:  ring1_test(picref->data[0], picref->linesize[0], 
frame%30); break;
-case TEST_RING2:  ring2_test(picref->data[0], picref->linesize[0], 
frame%30); break;
+case TEST_DC_LUMA:   dc_test(picref->data[0], picref->linesize[0], 
256, 256, frame%test->max_frames); break;
+case TEST_DC_CHROMA: dc_test(picref->data[1], picref->linesize[1], 
256, 256, frame%test->max_frames); break;
+case TEST_FREQ_LUMA:   freq_test(picref->data[0], picref->linesize[0], 
frame%test->max_frames); break;
+case TEST_FREQ_CHROMA: freq_test(picref->data[1], picref->linesize[1], 
frame%test->max_frames); break;
+case TEST_AMP_LUMA: amp_test(picref->data[0], picref->linesize[0], 
frame%test->max_frames); break;
+case TEST_AMP_CHROMA:   amp_test(picref->data[1], picref->linesize[1], 
frame%test->max_frames); break;
+case TEST_CBP:  cbp_test(picref->data   , picref->linesize   , 
frame%test->max_frames); break;
+case TEST_MV:mv_test(picref->data[0], picref->linesize[0], 
frame%test->max_frames); break;
+case TEST_RING1:  ring1_test(picref->data[0], picref->linesize[0], 
frame%test->max_frames); break;
+case TEST_RING2:  ring2_test(picref->data[0], picref->linesize[0], 
frame%test->max_frames); break;
 }
 
 return ff_filter_frame(outlink, picref);
-- 
2.6.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2 2/3] avfilter/vsrc_mptestsrc: simplify the code and change the type of frame

2019-08-23 Thread Limin Wang
On Thu, Aug 22, 2019 at 03:04:19PM +0200, Moritz Barsnick wrote:
> On Mon, Aug 12, 2019 at 23:39:52 +0800, lance.lmw...@gmail.com wrote:
> 
> This looks very wrong. Does it work?
> 
> > -if (tt == TEST_ALL && frame%test->max_frames) /* draw a black frame at 
> > the beginning of each test */
> > -tt = (frame/test->max_frames)%(TEST_NB-1);
> > +frame = frame/test->max_frames;
> 
> Here, you reduce frame to frame/test->max_frames.

good catch, it's wrong, it's simple replacement, so haven't check it carefully.
Now I have fixed it and update the patch. Have checked with ffplay.

> 
> > +if (tt == TEST_ALL && frame) /* draw a black frame at the beginning of 
> > each test */
> > +tt = frame%(TEST_NB-1);
> 
> Which makes this replacement correct. But:
> 
> > -case TEST_DC_LUMA:   dc_test(picref->data[0], picref->linesize[0], 
> > 256, 256, frame%test->max_frames); break;
> > -case TEST_DC_CHROMA: dc_test(picref->data[1], picref->linesize[1], 
> > 256, 256, frame%test->max_frames); break;
> > -case TEST_FREQ_LUMA:   freq_test(picref->data[0], picref->linesize[0], 
> > frame%test->max_frames); break;
> > -case TEST_FREQ_CHROMA: freq_test(picref->data[1], picref->linesize[1], 
> > frame%test->max_frames); break;
> > -case TEST_AMP_LUMA: amp_test(picref->data[0], picref->linesize[0], 
> > frame%test->max_frames); break;
> > -case TEST_AMP_CHROMA:   amp_test(picref->data[1], picref->linesize[1], 
> > frame%test->max_frames); break;
> > -case TEST_CBP:  cbp_test(picref->data   , picref->linesize   , 
> > frame%test->max_frames); break;
> > -case TEST_MV:mv_test(picref->data[0], picref->linesize[0], 
> > frame%test->max_frames); break;
> > -case TEST_RING1:  ring1_test(picref->data[0], picref->linesize[0], 
> > frame%test->max_frames); break;
> > -case TEST_RING2:  ring2_test(picref->data[0], picref->linesize[0], 
> > frame%test->max_frames); break;
> > +case TEST_DC_LUMA:   dc_test(picref->data[0], picref->linesize[0], 
> > 256, 256, frame); break;
> > +case TEST_DC_CHROMA: dc_test(picref->data[1], picref->linesize[1], 
> > 256, 256, frame); break;
> > +case TEST_FREQ_LUMA:   freq_test(picref->data[0], picref->linesize[0], 
> > frame); break;
> > +case TEST_FREQ_CHROMA: freq_test(picref->data[1], picref->linesize[1], 
> > frame); break;
> > +case TEST_AMP_LUMA: amp_test(picref->data[0], picref->linesize[0], 
> > frame); break;
> > +case TEST_AMP_CHROMA:   amp_test(picref->data[1], picref->linesize[1], 
> > frame); break;
> > +case TEST_CBP:  cbp_test(picref->data   , picref->linesize   , 
> > frame); break;
> > +case TEST_MV:mv_test(picref->data[0], picref->linesize[0], 
> > frame); break;
> > +case TEST_RING1:  ring1_test(picref->data[0], picref->linesize[0], 
> > frame); break;
> > +case TEST_RING2:  ring2_test(picref->data[0], picref->linesize[0], 
> > frame); break;
> 
> Here, you have effectively replaced "frame%test->max_frames" with
> "frame/test->max_frames" (now "frame"). Are you sure?
> 
> Cheers,
> Moritz
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/aacdec: Add FF_CODEC_CAP_INIT_CLEANUP

2019-08-23 Thread Michael Niedermayer
On Fri, Aug 23, 2019 at 08:54:11AM +0200, Paul B Mahol wrote:
> lgtm

will apply

thx

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

Modern terrorism, a quick summary: Need oil, start war with country that
has oil, kill hundread thousand in war. Let country fall into chaos,
be surprised about raise of fundamantalists. Drop more bombs, kill more
people, be surprised about them taking revenge and drop even more bombs
and strip your own citizens of their rights and freedoms. to be continued


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 2/3] avcodec/idcinvideo: Add 320x240 default maximum resolution

2019-08-23 Thread Michael Niedermayer
On Thu, Aug 22, 2019 at 11:00:58PM +0200, Tomas Härdin wrote:
> tor 2019-08-22 klockan 20:09 +0200 skrev Michael Niedermayer:
> > Fixes: Timeout (128sec -> 2ms)
> > Fixes: 
> > 16568/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IDCIN_fuzzer-5675004095627264
> > 
> > See: [FFmpeg-devel] [PATCH 4/4] tools/target_dec_fuzzer: Adjust max_pixels 
> > for IDCIN
> > 
> > Found-by: continuous fuzzing process 
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/idcinvideo.c | 6 ++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/libavcodec/idcinvideo.c b/libavcodec/idcinvideo.c
> > index cff9ad31ac..6b2d8087ae 100644
> > --- a/libavcodec/idcinvideo.c
> > +++ b/libavcodec/idcinvideo.c
> > @@ -243,6 +243,11 @@ static int idcin_decode_frame(AVCodecContext *avctx,
> >  return buf_size;
> >  }
> >  
> > +static const AVCodecDefault idcin_defaults[] = {
> > +{ "max_pixels", "320*240" },
> > +{ NULL },
> > +};
> 
> Should be OK since we don't know of any samples larger than this. If we
> want to be *really* strict we could limit it to 320x240 only

will apply it together with the dependant patch for the fuzzer

thx


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

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] DVB EPG decoder

2019-08-23 Thread Anthony Delannoy
> I think we should only merge the part of this patchset which makes the EIT
> available as a data stream. Parsing the whole EIT or dumping the data as
> ASCII is not libavcodec's or libavutil's job.

The EPG decoder does not change the table's data, it just store them
and it happens to
contains text sometimes.
Some utilites functions I made in libavutil/dvb can convert those raw
data in text
description(s) for certain descriptors.

> Also there is no such concept in libavcodec as a data decoder, if something 
> happens to
> work with avcodec_send_packet/avcodec_receive_frame that is mostly luck I
> believe.

avcodec_send_packet and avcodec_receive_frame both call
AVCodec::receive_frame if it is
implemented. That's why my implementation of the EPG decoder does
contain this function.

For now my test scripts consists to:
```
 99 if (st->codecpar->codec_id != AV_CODEC_ID_EPG)
100 goto free_pkt;
101
102 ret = avcodec_send_packet(dec_ctx, );
...
112 while (1) {
113 ret = avcodec_receive_frame(dec_ctx, frame);
114 if (ret < 0)
115 break;
116
117 for (int i = 0; i < frame->nb_side_data; i++) {
118 AVFrameSideData *sd = frame->side_data[i];
119 if (sd && sd->type == AV_FRAME_DATA_EPG_TABLE) {
120 EPGTable *table = sd->data;
121 av_epg_show_table(table, AV_LOG_WARNING);
122 }
123 }
124 av_frame_unref(frame);
125 }
126
127 free_pkt:
128 av_packet_unref();
```
It works as intended and permits to decode EPGTable without issues, I
tried on multiple channels.

I wanted to permit the table decoding and not just an EPG data stream
to permit easy reading
and in the future easy modification before encoding EPG back.

> I am also not sure if we should add the EIT PID to all programs, that
> would mess up the direct relation between a PMT and an AVProgram, and we
> probably don't want that. So I'd rather see the EIT data stream as a
> standalone PID separate from the programs.

I'm not an expert but I think each service/program contains a PMT
table and all others. So one
EPG stream (if available) for each service.
That's what I understood from the ETSI EN 300 468 V1.16.1
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH]lavc/g729dec: Support decoding ACELP.KELVIN

2019-08-23 Thread Paul B Mahol
allcodecs.c entry is in wrong section, it should be audio one but yours is
in video section.
the avcodec.h entry may contradict with next libav entry so better move it
bellow hcom.

Rest looks OK.

On Thu, Aug 22, 2019 at 12:13 PM Carl Eugen Hoyos 
wrote:

> Am Mo., 19. Aug. 2019 um 23:37 Uhr schrieb Carl Eugen Hoyos
> :
> >
> > Hi!
> >
> > Attached patch fixes tickets #4799 and #8081, thanks to Paul for his
> help.
>
> New patch attached.
>
> Carl Eugen
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] avformat/hlsenc: reopen new http session for http_persistent when upload file failed

2019-08-23 Thread Steven Liu
fix ticket: 7975

Signed-off-by: Steven Liu 
---
 libavformat/hlsenc.c | 67 ++--
 1 file changed, 54 insertions(+), 13 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 18173cdce1..26e0f3819b 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -118,6 +118,7 @@ typedef struct VariantStream {
 AVIOContext *out;
 int packets_written;
 int init_range_length;
+uint8_t *temp_buffer;
 
 AVFormatContext *avf;
 AVFormatContext *vtt_avf;
@@ -262,11 +263,12 @@ static int hlsenc_io_open(AVFormatContext *s, AVIOContext 
**pb, char *filename,
 return err;
 }
 
-static void hlsenc_io_close(AVFormatContext *s, AVIOContext **pb, char 
*filename) {
+static int hlsenc_io_close(AVFormatContext *s, AVIOContext **pb, char 
*filename) {
 HLSContext *hls = s->priv_data;
 int http_base_proto = filename ? ff_is_http_proto(filename) : 0;
+int ret = 0;
 if (!*pb)
-return;
+return ret;
 if (!http_base_proto || !hls->http_persistent || hls->key_info_file || 
hls->encrypt) {
 ff_format_io_close(s, pb);
 #if CONFIG_HTTP_PROTOCOL
@@ -274,9 +276,10 @@ static void hlsenc_io_close(AVFormatContext *s, 
AVIOContext **pb, char *filename
 URLContext *http_url_context = ffio_geturlcontext(*pb);
 av_assert0(http_url_context);
 avio_flush(*pb);
-ffurl_shutdown(http_url_context, AVIO_FLAG_WRITE);
+ret = ffurl_shutdown(http_url_context, AVIO_FLAG_WRITE);
 #endif
 }
+return ret;
 }
 
 static void set_http_options(AVFormatContext *s, AVDictionary **options, 
HLSContext *c)
@@ -447,7 +450,6 @@ static void write_styp(AVIOContext *pb)
 static int flush_dynbuf(VariantStream *vs, int *range_length)
 {
 AVFormatContext *ctx = vs->avf;
-uint8_t *buffer;
 
 if (!ctx->pb) {
 return AVERROR(EINVAL);
@@ -458,15 +460,20 @@ static int flush_dynbuf(VariantStream *vs, int 
*range_length)
 avio_flush(ctx->pb);
 
 // write out to file
-*range_length = avio_close_dyn_buf(ctx->pb, );
+*range_length = avio_close_dyn_buf(ctx->pb, >temp_buffer);
 ctx->pb = NULL;
-avio_write(vs->out, buffer, *range_length);
-av_free(buffer);
+avio_write(vs->out, vs->temp_buffer, *range_length);
 
 // re-open buffer
 return avio_open_dyn_buf(>pb);
 }
 
+static void reflush_dynbuf(VariantStream *vs, int *range_length)
+{
+// re-open buffer
+avio_write(vs->out, vs->temp_buffer, *range_length);;
+}
+
 static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls,
VariantStream *vs) {
 
@@ -1544,7 +1551,10 @@ static int hls_window(AVFormatContext *s, int last, 
VariantStream *vs)
 
 fail:
 av_dict_free();
-hlsenc_io_close(s, (byterange_mode || hls->segment_type == 
SEGMENT_TYPE_FMP4) ? >m3u8_out : >out, temp_filename);
+ret = hlsenc_io_close(s, (byterange_mode || hls->segment_type == 
SEGMENT_TYPE_FMP4) ? >m3u8_out : >out, temp_filename);
+if (ret < 0) {
+return ret;
+}
 hlsenc_io_close(s, >sub_m3u8_out, vs->vtt_m3u8_name);
 if (use_temp_file) {
 ff_rename(temp_filename, vs->m3u8_name, s);
@@ -2399,7 +2409,16 @@ static int hls_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 if (ret < 0) {
 return ret;
 }
-hlsenc_io_close(s, >out, filename);
+ret = hlsenc_io_close(s, >out, filename);
+if (ret < 0) {
+av_log(s, AV_LOG_WARNING, "upload segment failed,"
+   "and will retry upload by a new http session.\n");
+ff_format_io_close(s, >out);
+ret = hlsenc_io_open(s, >out, filename, );
+reflush_dynbuf(vs, _length);
+ret = hlsenc_io_close(s, >out, filename);
+}
+av_free(vs->temp_buffer);
 av_free(filename);
 }
 }
@@ -2426,8 +2445,13 @@ static int hls_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 // if we're building a VOD playlist, skip writing the manifest 
multiple times, and just wait until the end
 if (hls->pl_type != PLAYLIST_TYPE_VOD) {
 if ((ret = hls_window(s, 0, vs)) < 0) {
-av_free(old_filename);
-return ret;
+av_log(s, AV_LOG_WARNING, "update playlist failed, will retry 
once time\n");
+ff_format_io_close(s, >out);
+vs->out = NULL;
+if ((ret = hls_window(s, 0, vs)) < 0) {
+av_free(old_filename);
+return ret;
+}
 }
 }
 
@@ -2577,7 +2601,19 @@ static int hls_write_trailer(struct AVFormatContext *s)
 goto failed;
 
 vs->size = range_length;
-hlsenc_io_close(s, >out, filename);
+ret = hlsenc_io_close(s, >out, 

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/aacdec: Add FF_CODEC_CAP_INIT_CLEANUP

2019-08-23 Thread Paul B Mahol
lgtm

On Fri, Aug 23, 2019 at 12:54 AM Michael Niedermayer 
wrote:

> Fixes: memleaks
> Fixes:
> 16289/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_LATM_fuzzer-5200695692623872
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by
> :
> Michael Niedermayer 
> ---
>  libavcodec/aacdec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
> index c606ad40a9..98b6e58be3 100644
> --- a/libavcodec/aacdec.c
> +++ b/libavcodec/aacdec.c
> @@ -559,7 +559,7 @@ AVCodec ff_aac_decoder = {
>  AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE
>  },
>  .capabilities= AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
> -.caps_internal   = FF_CODEC_CAP_INIT_THREADSAFE,
> +.caps_internal   = FF_CODEC_CAP_INIT_THREADSAFE |
> FF_CODEC_CAP_INIT_CLEANUP,
>  .channel_layouts = aac_channel_layout,
>  .flush = flush,
>  .priv_class  = _decoder_class,
> @@ -584,7 +584,7 @@ AVCodec ff_aac_latm_decoder = {
>  AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE
>  },
>  .capabilities= AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
> -.caps_internal   = FF_CODEC_CAP_INIT_THREADSAFE,
> +.caps_internal   = FF_CODEC_CAP_INIT_THREADSAFE |
> FF_CODEC_CAP_INIT_CLEANUP,
>  .channel_layouts = aac_channel_layout,
>  .flush = flush,
>  .profiles= NULL_IF_CONFIG_SMALL(ff_aac_profiles),
> --
> 2.23.0
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 8/8] avcodec/v4l2_buffers: Add handling for NV21 and YUV420P

2019-08-23 Thread Moritz Barsnick
On Thu, Aug 22, 2019 at 14:47:41 -0700, Aman Gupta wrote:
> The single planar support was for NV21 only.
^
Nit: NV12


> Add NV21 and YUV420P support.
>
> Signed-off-by: Aman Gupta 

Cheers,
Moritz
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".