Re: [FFmpeg-devel] [EXT] Re: [PATCH v1] avcodec/v4l2_m2m_enc: Set bitrate mode to cbr by default

2020-04-29 Thread Ming Qian


> On Wed, 29. Apr 16:14, Ming Qian wrote:
> > Without this setting, bitrate may have no effect
> > if the default value of bitrate mode is VBR.
> >
> > Signed-off-by: Ming Qian 
> > ---
> >  libavcodec/v4l2_m2m_enc.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c
> > index 8454e2326c..6296ad88c6 100644
> > --- a/libavcodec/v4l2_m2m_enc.c
> > +++ b/libavcodec/v4l2_m2m_enc.c
> > @@ -191,6 +191,7 @@ static int v4l2_prepare_encoder(V4L2m2mContext
> *s)
> >
> >  /* set ext ctrls */
> >  v4l2_set_ext_ctrl(s, MPEG_CID(HEADER_MODE),
> > MPEG_VIDEO(HEADER_MODE_SEPARATE), "header mode", 0);
> > +v4l2_set_ext_ctrl(s, MPEG_CID(BITRATE_MODE),
> > + MPEG_VIDEO(BITRATE_MODE_CBR), "bit rate mode", 1);
> >  v4l2_set_ext_ctrl(s, MPEG_CID(BITRATE) , avctx->bit_rate, "bit rate", 
> > 1);
> >  v4l2_set_ext_ctrl(s, MPEG_CID(FRAME_RC_ENABLE), 1, "frame level
> rate control", 0);
> >  v4l2_set_ext_ctrl(s, MPEG_CID(GOP_SIZE), avctx->gop_size,"gop
> > size", 1);
> > --
> > 2.26.0
> >
> 
> On the RPI4 it causes streamon to fail:
> 
> ./ffmpeg -y -i 7799x264.mp4 -an -codec:v h264_v4l2m2m out.264
> [h264_v4l2m2m @ 0x3d6e3b0] VIDIOC_STREAMON failed on output context
> Video encoding failed Conversion failed!
> 
> [41648.654237] bcm2835-codec bcm2835-codec:
> bcm2835_codec_start_streaming: Failed enabling i/p port, ret -3
> [41648.654243] [ cut here ] [41648.654267] WARNING: 
> CPU:
> 2 PID: 26254 at drivers/media/common/videobuf2/videobuf2-core.c:1365
> vb2_start_streaming+0xe4/0x160 [videobuf2_common] [41648.654271]
> Modules linked in: bnep hci_uart btbcm serdev bluetooth ecdh_generic 8021q
> garp stp llc vc4 v3d gpu_sched drm_kms_helper brcmfmac brcmutil drm
> snd_soc_core sha256_generic snd_compress snd_pcm_dmaengine
> drm_panel_orientation_quirks syscopyarea sysfillrect sysimgblt fb_sys_fops
> raspberrypi_hwmon cfg80211 hwmon snd_bcm2835(C) snd_pcm rfkill
> snd_timer bcm2835_v4l2(C) snd bcm2835_codec(C) v4l2_mem2mem
> v4l2_common bcm2835_mmal_vchiq(C) videobuf2_vmalloc
> videobuf2_dma_contig videobuf2_memops videobuf2_v4l2
> videobuf2_common videodev media vc_sm_cma(C) rpivid_mem
> uio_pdrv_genirq uio ip_tables x_tables ipv6
> [41648.654351] CPU: 2 PID: 26254 Comm: ffmpeg Tainted: GWC
> 4.19.97-v7l+ #1294
> [41648.654355] Hardware name: BCM2835
> [41648.654374] [] (unwind_backtrace) from []
> (show_stack+0x20/0x24) [41648.654383] [] (show_stack) from
> [] (dump_stack+0xe0/0x124) [41648.654392] []
> (dump_stack) from [] (__warn+0x104/0x11c) [41648.654400]
> [] (__warn) from [] (warn_slowpath_null+0x50/0x58)
> [41648.654414] [] (warn_slowpath_null) from []
> (vb2_start_streaming+0xe4/0x160 [videobuf2_common]) [41648.654434]
> [] (vb2_start_streaming [videobuf2_common]) from []
> (vb2_core_streamon+0x130/0x16c [videobuf2_common]) [41648.654451]
> [] (vb2_core_streamon [videobuf2_common]) from []
> (vb2_streamon+0x40/0x60 [videobuf2_v4l2]) [41648.654467] []
> (vb2_streamon [videobuf2_v4l2]) from []
> (v4l2_m2m_streamon+0x30/0x48 [v4l2_mem2mem]) [41648.654480]
> [] (v4l2_m2m_streamon [v4l2_mem2mem]) from []
> (v4l2_m2m_ioctl_streamon+0x20/0x24 [v4l2_mem2mem]) [41648.654518]
> [] (v4l2_m2m_ioctl_streamon [v4l2_mem2mem]) from
> [] (v4l_streamon+0x28/0x2c [videodev]) [41648.654571]
> [] (v4l_streamon [videodev]) from []
> (__video_do_ioctl+0x268/0x528 [videodev]) [41648.654621] []
> (__video_do_ioctl [videodev]) from []
> (video_usercopy+0x218/0x600 [videodev]) [41648.654670] []
> (video_usercopy [videodev]) from [] (video_ioctl2+0x20/0x24
> [videodev]) [41648.654720] [] (video_ioctl2 [videodev]) from
> [] (v4l2_ioctl+0x4c/0x60 [videodev]) [41648.654751] []
> (v4l2_ioctl [videodev]) from [] (do_vfs_ioctl+0xbc/0x804)
> [41648.654759] [] (do_vfs_ioctl) from []
> (ksys_ioctl+0x44/0x6c) [41648.654765] [] (ksys_ioctl) from
> [] (sys_ioctl+0x18/0x1c) [41648.654771] [] (sys_ioctl)
> from [] (ret_fast_syscall+0x0/0x28) [41648.654775] Exception
> stack(0xc0157fa8 to 0xc0157ff0)
> [41648.654780] 7fa0:    7fff 0005 40045612
> befe66d8 0005
> [41648.654785] 7fc0:  7fff 0001 0036 0001 
> b6fb4000 befe66e4 [41648.654788] 7fe0: 01a045dc befe66cc 013350bc
> b64e551c [41648.654793] ---[ end trace 874bc099afe54842 ]---
> 
> Not sure if this is a known issue on the RPI4...
> 
> Thanks,
> --
> Andriy

It's strange, in my opinion, the change is unlikely to affect the streamon. But 
it led to a kernel panic.

___
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 0/3] Patch set to delay output live stream

2020-04-29 Thread Andreas Rheinhardt
Tao Zhang:
> Marton Balint  于2020年4月30日周四 上午4:55写道:
>>
>>
>>
>> On Thu, 30 Apr 2020, Tao Zhang wrote:
>>
>>> Marton Balint  于2020年4月30日周四 上午12:03写道:



 On Wed, 29 Apr 2020, leozhang wrote:

> In some applications, it is required to add delay to live streaming.

 In what applications? And if you do this, why not run

 sleep 20; ffmpeg 
>>> In live streaming applications, someone wouldn't want broadcast what's
>>> comming next immediately.
>>> Sleep 20 then ffmpeg is not ok, because the stream is still
>>> broadcasting immediately, and lost 20 seconds signal.
>>
>> So you want to buffer 20 seconds of input, and then start the output?
> yes
>>

 I don't see how this is useful at all.

 And what is -paced? What it is used for? Isn't it the same as using ffmpeg
 -re? You really should better explain your use case.
>>> -re read the input, -paced write the output.
>>
>> But why do you want to delay every output packet?
> By default, ffmpeg will output packets as fast as possible.
> So I delay output every packet at native frame rate to simulate live stream.

What would be the benefit of your patch for API users (i.e. users that
directly use libavformat and not ffmpeg.c)? Right now your problem seems
to be in ffmpeg.c and not in libavformat.
>>

 Regards,
 Marton

> For example, you can add 20 seconds to rtmp stream with below command:
> ffmpeg -i your_input_stream_address -c copy -map 0:a -map 0:v -f fifo 
> -paced 1 -queue_size 600
> -output_delay 2000 -fifo_format flv 
> rtmp://example.com/live/delayed_stream_name
>
> leozhang (3):
>  avformat/fifo: add option to delay output
>  avformat/fifo: add option to write packets in paced way
>  doc/muxers: add command example how to delay output live stream
>
> doc/muxers.texi| 17 +
> libavformat/fifo.c | 26 ++
> 2 files changed, 43 insertions(+)
>
> --
> 1.8.3.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 2/3] closed caption decoder: add new parameter to allow output to avoid repeated lines

2020-04-29 Thread Roger Pack
On Tue, Apr 28, 2020 at 1:46 AM Hendrik Leppkes  wrote:
>
> On Tue, Apr 28, 2020 at 8:19 AM Roger Pack  wrote:
> >
> > I didn't actually *need* this but thought the functionality was very
> > nice to have, so here's my contribution.
> >
> > It allows for forcing "rollup" style closed captions to output one
> > line at a time (basically, when there is a carriage return, it outputs
> > a line), so there is never any duplication in the output, for instance
> > if it's converted to .srt or .vtt files.  Without this you have output
> > like this:
> >
> >
> > 00:01.536 --> 00:03.605
> > AND AS A SECONDARY QUESTION, I
> >
> > 00:03.605 --> 00:05.707
> > AND AS A SECONDARY QUESTION, I
> > WOULD ASK YOU HOW OUR VETERANS
> >
> > 00:05.706 --> 00:09.343
> > WOULD ASK YOU HOW OUR VETERANS
> > AND ACTIVE DUTY MILITARY HAVE
> >
> > 00:09.344 --> 00:10.412
> > AND ACTIVE DUTY MILITARY HAVE
> > FARED UNDER THIS COMMANDER IN
> >
> > With it set to "1" you get output like this:
> >
> >
> > 00:02.014 --> 00:03.049
> > SOLDIERS HOME IN HOLYOKE,
> >
> > 00:03.048 --> 00:04.116
> > MASSACHUSETTS, HAVE LOST 73.
> >
> > 00:04.116 --> 00:04.850
> > ANOTHER FACILITY IN NEW ORLEANS,
> >
> > 00:04.850 --> 00:06.184
> > 53.
> >
> > 00:06.184 --> 00:07.753
> > VETERANS ARE IN REAL PERIL
> >
> > 00:07.753 --> 00:14.193
> > BECAUSE OF A LACK OF PREPARATION
> >
> > 00:14.193 --> 00:15.727
> > AND THEN THE SAME DYSFUNCTION
> >
>
> I would've figured that even when you split it into  individual lines,
> that each line would show for the same amount as it did before, ie.
> with overlap in the SRT. Otherwise, some lines like the "ANOTHER
> FACILITY IN NEW ORLEANS," one are shown for not even a second, which
> seems pretty bad.


The chief goal of the new setting is to make it easier for automated
processes to parse the output (realtime or otherwise).

Like "read from analog tuner and tail the .vtt file and see what the
subtitles are" without having to worry about duplication of lines.  So
it not displaying for long isn't a problem in this case.
This seems like a useful functionality for me.
The goal here is to just show the latest line in the .srt output, no
previous lines.  I think that's useful, though not for display
purposes, in which case they can just use the default anyway?

Thanks.
-roger-

>
> - Hendrik
> ___
> 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 v1] avcodec/v4l2_m2m_enc: Set bitrate mode to cbr by default

2020-04-29 Thread Andriy Gelman
On Wed, 29. Apr 16:14, Ming Qian wrote:
> Without this setting, bitrate may have no effect
> if the default value of bitrate mode is VBR.
> 
> Signed-off-by: Ming Qian 
> ---
>  libavcodec/v4l2_m2m_enc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c
> index 8454e2326c..6296ad88c6 100644
> --- a/libavcodec/v4l2_m2m_enc.c
> +++ b/libavcodec/v4l2_m2m_enc.c
> @@ -191,6 +191,7 @@ static int v4l2_prepare_encoder(V4L2m2mContext *s)
>  
>  /* set ext ctrls */
>  v4l2_set_ext_ctrl(s, MPEG_CID(HEADER_MODE), 
> MPEG_VIDEO(HEADER_MODE_SEPARATE), "header mode", 0);
> +v4l2_set_ext_ctrl(s, MPEG_CID(BITRATE_MODE), 
> MPEG_VIDEO(BITRATE_MODE_CBR), "bit rate mode", 1);
>  v4l2_set_ext_ctrl(s, MPEG_CID(BITRATE) , avctx->bit_rate, "bit rate", 1);
>  v4l2_set_ext_ctrl(s, MPEG_CID(FRAME_RC_ENABLE), 1, "frame level rate 
> control", 0);
>  v4l2_set_ext_ctrl(s, MPEG_CID(GOP_SIZE), avctx->gop_size,"gop size", 1);
> -- 
> 2.26.0
> 

On the RPI4 it causes streamon to fail:

./ffmpeg -y -i 7799x264.mp4 -an -codec:v h264_v4l2m2m out.264
[h264_v4l2m2m @ 0x3d6e3b0] VIDIOC_STREAMON failed on output context
Video encoding failed   

Conversion failed!

[41648.654237] bcm2835-codec bcm2835-codec: bcm2835_codec_start_streaming: 
Failed enabling i/p port, ret -3
 
[41648.654243] [ cut here ]
[41648.654267] WARNING: CPU: 2 PID: 26254 at 
drivers/media/common/videobuf2/videobuf2-core.c:1365 
vb2_start_streaming+0xe4/0x160 [videobuf2_common]   
  
[41648.654271] Modules linked in: bnep hci_uart btbcm serdev bluetooth 
ecdh_generic 8021q garp stp llc vc4 v3d gpu_sched drm_kms_helper brcmfmac 
brcmutil drm snd_soc_core sha256_generic snd_compress snd_pcm_dmaengine 
drm_panel_orientation_quirks syscopyarea sysfillrect sysimgblt fb_sys_fops 
raspberrypi_hwmon cfg80211 hwmon snd_bcm2835(C) snd_pcm rfkill snd_timer 
bcm2835_v4l2(C) snd bcm2835_codec(C) v4l2_mem2mem v4l2_common 
bcm2835_mmal_vchiq(C) videobuf2_vmalloc videobuf2_dma_contig videobuf2_memops 
videobuf2_v4l2 videobuf2_common videodev media vc_sm_cma(C) rpivid_mem 
uio_pdrv_genirq uio ip_tables x_tables ipv6
[41648.654351] CPU: 2 PID: 26254 Comm: ffmpeg Tainted: GWC
4.19.97-v7l+ #1294
[41648.654355] Hardware name: BCM2835
[41648.654374] [] (unwind_backtrace) from [] 
(show_stack+0x20/0x24)
[41648.654383] [] (show_stack) from [] 
(dump_stack+0xe0/0x124)
[41648.654392] [] (dump_stack) from [] (__warn+0x104/0x11c)
[41648.654400] [] (__warn) from [] 
(warn_slowpath_null+0x50/0x58)
[41648.654414] [] (warn_slowpath_null) from [] 
(vb2_start_streaming+0xe4/0x160 [videobuf2_common]) 
 
[41648.654434] [] (vb2_start_streaming [videobuf2_common]) from 
[] (vb2_core_streamon+0x130/0x16c [videobuf2_common]) 
  
[41648.654451] [] (vb2_core_streamon [videobuf2_common]) from 
[] (vb2_streamon+0x40/0x60 [videobuf2_v4l2])  

[41648.654467] [] (vb2_streamon [videobuf2_v4l2]) from [] 
(v4l2_m2m_streamon+0x30/0x48 [v4l2_mem2mem])
  
[41648.654480] [] (v4l2_m2m_streamon [v4l2_mem2mem]) from 
[] (v4l2_m2m_ioctl_streamon+0x20/0x24 [v4l2_mem2mem]) 

[41648.654518] [] (v4l2_m2m_ioctl_streamon [v4l2_mem2mem]) from 
[] (v4l_streamon+0x28/0x2c [videodev])
  
[41648.654571] [] (v4l_streamon [videodev]) from [] 
(__video_do_ioctl+0x268/0x528 [videodev])   

[41648.654621] [] (__video_do_ioctl [videodev]) from [] 
(video_usercopy+0x218/0x600 [videodev]) 

[41648.654670] [] (video_usercopy [videodev]) from [] 
(video_ioctl2+0x20/0x24 [videodev]) 
  
[41648.654720] [] (video_ioctl2 [videodev]) from [] 
(v4l2_ioctl+0x4c/0x60 [videodev])   

[41648.654751] [] (v4l2_ioctl [videodev]) from [] 
(do_vfs_ioctl+0xbc/0x804)   
  
[41648.654759] [] (do_vfs_ioctl) from [] 
(ksys_ioctl+0x44/0x6c)
[41648.654765] [] (ksys_ioctl) from [] (sys_ioctl+0x18/0x1c)
[41648.654771] [] (sys_ioctl) from [] 
(ret_fast_syscall+0x0/0x28)
[41648.654775] Exception stack(0xc0157fa8 to 0xc0157ff0)
[41648.654780] 7fa0:    7fff 0005 40045612 
befe66d8 0005
[41648.654785] 7fc0:  7fff 0001 0036 0001 

Re: [FFmpeg-devel] [PATCH 1/3] avformat/fifo: add option to delay output

2020-04-29 Thread Tao Zhang
Nicolas George  于2020年4月29日周三 下午9:31写道:
>
> leozhang (12020-04-29):
> > Signed-off-by: leozhang 
> > ---
> >  doc/muxers.texi| 3 +++
> >  libavformat/fifo.c | 7 +++
> >  2 files changed, 10 insertions(+)
> >
> > diff --git a/doc/muxers.texi b/doc/muxers.texi
> > index cb2bb42..a74cbc4 100644
> > --- a/doc/muxers.texi
> > +++ b/doc/muxers.texi
> > @@ -2271,6 +2271,9 @@ certain (usually permanent) errors the recovery is 
> > not attempted even when
> >  Specify whether to wait for the keyframe after recovering from
> >  queue overflow or failure. This option is set to 0 (false) by default.
> >
>
> > +@item output_delay
> > +Time to delay output, in microseconds. Default value is 0.
>
> This is not accurate enough. This will block every output packet for the
> extra specified duration.
>
> Not sure if it is very useful, compared with the other patch.
In live streaming applications, if user wouldn't want broadcast what's
coming next immediately, can set wanted output delay.
>
> > +
> >  @end table
> >
> >  @subsection Examples
> > diff --git a/libavformat/fifo.c b/libavformat/fifo.c
> > index d11dc66..bdecf2d 100644
> > --- a/libavformat/fifo.c
> > +++ b/libavformat/fifo.c
> > @@ -77,6 +77,8 @@ typedef struct FifoContext {
> >  /* Value > 0 signals queue overflow */
> >  volatile uint8_t overflow_flag;
> >
> > +/* Time to delay output, in microseconds */
> > +uint64_t output_delay;
> >  } FifoContext;
> >
> >  typedef struct FifoThreadContext {
> > @@ -397,6 +399,8 @@ static void *fifo_consumer_thread(void *data)
> >  memset(_thread_ctx, 0, sizeof(FifoThreadContext));
> >  fifo_thread_ctx.avf = avf;
> >
> > +av_usleep(fifo->output_delay);
> > +
> >  while (1) {
> >  uint8_t just_flushed = 0;
> >
> > @@ -630,6 +634,9 @@ static const AVOption options[] = {
> >  {"recover_any_error", "Attempt recovery regardless of type of the 
> > error", OFFSET(recover_any_error),
> >   AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
> >
>
> > +{"output_delay", "Time to delay output, in microseconds", 
> > OFFSET(output_delay),
> > + AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, 
> > AV_OPT_FLAG_ENCODING_PARAM},
>
> AV_OPT_TYPE_DURATION and adapt the description and documentation.
Will fix it in v2 version. Thanks.
>
> > +
> >  {NULL},
> >  };
> >
>
> Regards,
>
> --
>   Nicolas George
> ___
> 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] ppc: configure: Support Power ISA 3.0

2020-04-29 Thread Trung Lê
On Thu, Apr 30, 2020 at 3:16 AM Carl Eugen Hoyos  wrote:

> Shouldn't --disable-power8 also disable power9 (assuming there is a
> difference)?
>

No it should not. From my understanding, the `--enable-power8` flag is used
to determine if the version `altivec.h` supports the macro `_ARCH_PWR8` or
not:

```code
if enabled power8; then
check_cpp_condition power8 "altivec.h" "defined(_ARCH_PWR8)"
fi
```

Thus --disable-power8 should have no effect on power9 flag because power9
uses a different `_ARCH_PWR9` macro.

The question is do we want to expose the `--disable-power[8|9]` flags?
Should the `--cpu=power[8|9]` flags implicitly perform the cpp condition
check?

Kind regards


>
> 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".

Re: [FFmpeg-devel] 回复: [EXT] Re: [PATCH] avcodec/v4l2_buffers: don't prevent enqueue capture buffer to driver

2020-04-29 Thread Andriy Gelman
On Sun, 26. Apr 23:50, Andriy Gelman wrote:
> On Thu, 09. Apr 00:27, Andriy Gelman wrote:
> > On Thu, 09. Apr 02:14, Ming Qian wrote:
> > > Did you try increasing the -num_capture_buffers option? It may solve your 
> > > problem.
> > > 1. We can't increase the num_capture_buffers indefinitely.
> > > 2. There is a ring buffer in driver, so the number of frames who is 
> > > stored in the ring buffer may be a large value, This depends on the speed 
> > > of the input and output. So it's likely that when output port is done, 
> > > there are a large count of frames who have not been decoded,  if the 
> > > capture port prevent qbuf to driver, there will no frame buffer to store 
> > > the decoded frame.
> > > 
> > > There is currently a check that sets ctx->done=1 when all the capture 
> > > buffers are dequeued (v4l2_context.c:300), and this patch would prevent 
> > > it (although it's not needed if an eos event is received).
> > 
> > > Yes, but I think it's not appropriate to judge whether the capture port 
> > > is done by checking all the capture buffers are dequeued.
> > > 
> > 
> > I tend to agree with you. Even if eos event is not setup/supported, we 
> > should
> > be able to set ctx->done=1 via the EPIPE error.  
> > 
> > But let's wait for some more comments. 
> > 
> 
> In [1] it says that capture buffers should be enqueued back to the device 
> while
> draining.
> 
> I'll apply this patch on Wednesday if no one objects.
> 

Applied.

Thanks,
-- 
Andriy
___
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] [EXT] [PATCH 2/2] avcodec/v4l2_context: Finish draining if V4L2_BUF_FLAG_LAST is set

2020-04-29 Thread Ming Qian
> From: Andriy Gelman 
> 
> V4L2 api can indicate that flushing of the capture buffers is completed by
> setting the V4L2_BUF_FLAG_LAST flag.
> Use guards because the flag was only defined in Linux v4.2.
> 
> Reference:
> linux/Documentation/media/uapi/v4l/dev-decoder.rst
> 
> "The client must continue to handle both queues independently,
>  similarly to normal decode operation. This includes:
>  ...
>  - queuing and dequeuing CAPTURE buffers, until a buffer marked with
>the V4L2_BUF_FLAG_LAST flag is dequeued"
> 
> Signed-off-by: Andriy Gelman 
> ---
>  libavcodec/v4l2_context.c | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c index
> f0ecc18ebd..da802405e4 100644
> --- a/libavcodec/v4l2_context.c
> +++ b/libavcodec/v4l2_context.c
> @@ -400,6 +400,10 @@ dequeue:
>  ctx->done = 1;
>  return NULL;
>  }
> +#ifdef V4L2_BUF_FLAG_LAST
> +if (buf.flags & V4L2_BUF_FLAG_LAST)
> +ctx->done = 1;
> +#endif
>  }
> 
>  avbuf = >buffers[buf.index];
> --
> 2.25.1
> 

Lgtm
___
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] [EXT] [PATCH 1/2] avcodec/v4l2_context: Drop empty packet while draining

2020-04-29 Thread Ming Qian
> From: Andriy Gelman 
> 
> v4l2_m2m devices may send an empty packet/frame while draining to indicate
> that all capture buffers have been flushed.
> 
> Currently, the empty packet/frame is not handled correctly:
> When encoding, the empty packet is forwarded to the muxer, usually creating
> warnings.
> When decoding, a reference to the memory is created anyway.. Since in the
> past this memory contained a decoded frame, it results in an extra frame being
> decoded.
> 
> This commit discards the empty packet/frame.
> 
> References:
> linux/Documentation/media/uapi/v4l/dev-decoder.rst:
> 
> "The last buffer may be empty (with :c:type:`v4l2_buffer` bytesused = 0)
>  and in that case it must be ignored by the client, as it does not
>  contain a decoded frame."
> 
> linux/Documentation/media/uapi/media/v4l/vidioc-encoder-cmd.rst:
> 
> "...This buffer may be empty, indicated by the
>  driver setting the ``bytesused`` field to 0."
> 
> Signed-off-by: Andriy Gelman 
> ---
>  libavcodec/v4l2_context.c | 9 +
>  1 file changed, 9 insertions(+)
> 
> diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c index
> 6c2db5c849..f0ecc18ebd 100644
> --- a/libavcodec/v4l2_context.c
> +++ b/libavcodec/v4l2_context.c
> @@ -393,6 +393,15 @@ dequeue:
>  return NULL;
>  }
> 
> +if (ctx_to_m2mctx(ctx)->draining
> && !V4L2_TYPE_IS_OUTPUT(ctx->type)) {
> +int bytesused = V4L2_TYPE_IS_MULTIPLANAR(buf.type) ?
> +buf.m.planes[0].bytesused : buf.bytesused;
> +if (bytesused == 0) {
> +ctx->done = 1;
> +return NULL;
> +}
> +}
> +
>  avbuf = >buffers[buf.index];
>  avbuf->status = V4L2BUF_AVAILABLE;
>  avbuf->buf = buf;
> --
> 2.25.1
> 

Lgtm

___
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: add support for microseconds since epoch based sequence number

2020-04-29 Thread Steven Liu


> 2020年4月30日 上午12:29,Marton Balint  写道:
> 
> 
> 
> On Sat, 18 Apr 2020, Marton Balint wrote:
> 
>> Sequence numbers of segments should be unique, if an encoder is using shorter
>> than 1 second segments and it is restarted, then future segments will be 
>> using
>> already used sequence numbers if initial sequence number is based on the 
>> number
>> of seconds since epoch and not microseconds.
> 
> Ping.
Sorry response so late.
LGTM
> 
> Thanks,
> Marton
> 
>> 
>> Signed-off-by: Marton Balint 
>> ---
>> doc/muxers.texi   |  3 +++
>> libavformat/hlsenc.c  | 13 ++---
>> libavformat/version.h |  2 +-
>> 3 files changed, 14 insertions(+), 4 deletions(-)
>> 
>> diff --git a/doc/muxers.texi b/doc/muxers.texi
>> index e5b8debcb3..cf1c9a8622 100644
>> --- a/doc/muxers.texi
>> +++ b/doc/muxers.texi
>> @@ -640,6 +640,9 @@ Set the starting sequence numbers according to 
>> @var{start_number} option value.
>> @item epoch
>> The start number will be the seconds since epoch (1970-01-01 00:00:00)
>> +@item epoch_us
>> +The start number will be the microseconds since epoch (1970-01-01 00:00:00)
>> +
>> @item datetime
>> The start number will be based on the current date/time as mmddHHMMSS. 
>> e.g. 20161231235759.
>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>> index d75684741f..008a3f3947 100644
>> --- a/libavformat/hlsenc.c
>> +++ b/libavformat/hlsenc.c
>> @@ -41,6 +41,7 @@
>> #include "libavutil/random_seed.h"
>> #include "libavutil/opt.h"
>> #include "libavutil/log.h"
>> +#include "libavutil/time.h"
>> #include "libavutil/time_internal.h"
>> #include "avformat.h"
>> @@ -56,6 +57,8 @@ typedef enum {
>>HLS_START_SEQUENCE_AS_START_NUMBER = 0,
>>HLS_START_SEQUENCE_AS_SECONDS_SINCE_EPOCH = 1,
>>HLS_START_SEQUENCE_AS_FORMATTED_DATETIME = 2,  // MMDDhhmmss
>> +HLS_START_SEQUENCE_AS_MICROSECONDS_SINCE_EPOCH = 3,
>> +HLS_START_SEQUENCE_LAST, // unused
>> } StartSequenceSourceType;
>> typedef enum {
>> @@ -2788,9 +2791,12 @@ static int hls_init(AVFormatContext *s)
>>pattern = "%d.m4s";
>>}
>>if ((hls->start_sequence_source_type == 
>> HLS_START_SEQUENCE_AS_SECONDS_SINCE_EPOCH) ||
>> +(hls->start_sequence_source_type == 
>> HLS_START_SEQUENCE_AS_MICROSECONDS_SINCE_EPOCH) ||
>>(hls->start_sequence_source_type == 
>> HLS_START_SEQUENCE_AS_FORMATTED_DATETIME)) {
>> -time_t t = time(NULL); // we will need it in either case
>> -if (hls->start_sequence_source_type == 
>> HLS_START_SEQUENCE_AS_SECONDS_SINCE_EPOCH) {
>> +time_t t = time(NULL);
>> +if (hls->start_sequence_source_type == 
>> HLS_START_SEQUENCE_AS_MICROSECONDS_SINCE_EPOCH) {
>> +hls->start_sequence = av_gettime();
>> +} else if (hls->start_sequence_source_type == 
>> HLS_START_SEQUENCE_AS_SECONDS_SINCE_EPOCH) {
>>hls->start_sequence = (int64_t)t;
>>} else if (hls->start_sequence_source_type == 
>> HLS_START_SEQUENCE_AS_FORMATTED_DATETIME) {
>>char b[15];
>> @@ -3083,9 +3089,10 @@ static const AVOption options[] = {
>>{"event", "EVENT playlist", 0, AV_OPT_TYPE_CONST, {.i64 = 
>> PLAYLIST_TYPE_EVENT }, INT_MIN, INT_MAX, E, "pl_type" },
>>{"vod", "VOD playlist", 0, AV_OPT_TYPE_CONST, {.i64 = PLAYLIST_TYPE_VOD 
>> }, INT_MIN, INT_MAX, E, "pl_type" },
>>{"method", "set the HTTP method(default: PUT)", OFFSET(method), 
>> AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,E},
>> -{"hls_start_number_source", "set source of first number in sequence", 
>> OFFSET(start_sequence_source_type), AV_OPT_TYPE_INT, {.i64 = 
>> HLS_START_SEQUENCE_AS_START_NUMBER }, 0, 
>> HLS_START_SEQUENCE_AS_FORMATTED_DATETIME, E, "start_sequence_source_type" },
>> +{"hls_start_number_source", "set source of first number in sequence", 
>> OFFSET(start_sequence_source_type), AV_OPT_TYPE_INT, {.i64 = 
>> HLS_START_SEQUENCE_AS_START_NUMBER }, 0, HLS_START_SEQUENCE_LAST-1, E, 
>> "start_sequence_source_type" },
>>{"generic", "start_number value (default)", 0, AV_OPT_TYPE_CONST, {.i64 = 
>> HLS_START_SEQUENCE_AS_START_NUMBER }, INT_MIN, INT_MAX, E, 
>> "start_sequence_source_type" },
>>{"epoch", "seconds since epoch", 0, AV_OPT_TYPE_CONST, {.i64 = 
>> HLS_START_SEQUENCE_AS_SECONDS_SINCE_EPOCH }, INT_MIN, INT_MAX, E, 
>> "start_sequence_source_type" },
>> +{"epoch_us", "microseconds since epoch", 0, AV_OPT_TYPE_CONST, {.i64 = 
>> HLS_START_SEQUENCE_AS_MICROSECONDS_SINCE_EPOCH }, INT_MIN, INT_MAX, E, 
>> "start_sequence_source_type" },
>>{"datetime", "current datetime as MMDDhhmmss", 0, AV_OPT_TYPE_CONST, 
>> {.i64 = HLS_START_SEQUENCE_AS_FORMATTED_DATETIME }, INT_MIN, INT_MAX, E, 
>> "start_sequence_source_type" },
>>{"http_user_agent", "override User-Agent field in HTTP header", 
>> OFFSET(user_agent), AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,E},
>>{"var_stream_map", "Variant stream map string", OFFSET(var_stream_map), 
>> AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,E},
>> diff --git 

[FFmpeg-devel] [PATCH] MAINTAINERS: Add myself to libopenh264enc

2020-04-29 Thread Linjie Fu
Reviewed-by: Martin Storsjö 
Signed-off-by: Linjie Fu 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 06956f8..96654f1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -194,6 +194,7 @@ Codecs:
   libdavs2.cHuiwen Ren
   libgsm.c  Michel Bardiaux
   libkvazaar.c  Arttu Ylä-Outinen
+  libopenh264enc.c  Martin Storsjo, Linjie Fu
   libopenjpeg.c Jaikrishnan Menon
   libopenjpegenc.c  Michael Bradshaw
   libtheoraenc.cDavid Conrad
-- 
2.7.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/5] avformat/dashenc: fix invalid pointer access if avio_get_dyn_buf failed

2020-04-29 Thread lance . lmwang
On Wed, Apr 29, 2020 at 06:55:33PM +0200, Nicolas George wrote:
> lance.lmw...@gmail.com (12020-04-29):
> > Thanks, I catch your point now. Most of existing code haven't return ERROR, 
> > so I
> > choose the same way to process it. If you think it's not OK, we'll change 
> > more
> > code I think.
> 
> Maybe the other code needs to be fixed the same way. Maybe the other
> code needs not return an error and this one does. Maybe your change is
> actually valid.
> 
> You cannot know unless you first understand what the code does and what
> it is supposed to do. You cannot program by imitation, it does not work.
> 
> And you have to test your changes: run a ffmpeg command line, make sure
> the new code is triggered, and check the output file, compare it with
> when the change is not triggered. If they are both correct, good. If one
> is corrupted, then you know your change was bogus. And if you did not
> test, then your change cannot be accepted.

Sorry, the old code will segment fault but the new code will not if error
happened. so I have no idea what's to compare the output as it's error.
Also all of the code which are using avio_get_dyn_buf() didn't check the size
for error. I had to say the avio_get_dyn_buf() is designed very well.

Can we change avio_get_dyn_buf() to return the error directly? also the 
description of API isn't clear for the error condition.


> 
> Ideally we can trust regular contributors to have tested their changes
> and run FATE before submitting patches.
> 
> Regards,
> 
> -- 
>   Nicolas George



> ___
> 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".


-- 
Thanks,
Limin Wang
___
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] avcodec/cbs_h265: fix writing extension_data bits

2020-04-29 Thread James Almer
On 4/20/2020 6:45 PM, James Almer wrote:
> We only care about the right most bit.
> 
> Signed-off-by: James Almer 
> ---
> Fixes handling files like
> https://trac.ffmpeg.org/attachment/ticket/7965/puppets_with_alpha_hevc.mov
> Without this patch, parsing works but passing the VPS through 
> hevc_metadata_bsf
> when writing fails.
> 
>  libavcodec/cbs_h265_syntax_template.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/cbs_h265_syntax_template.c 
> b/libavcodec/cbs_h265_syntax_template.c
> index 180a045c34..85b952e64c 100644
> --- a/libavcodec/cbs_h265_syntax_template.c
> +++ b/libavcodec/cbs_h265_syntax_template.c
> @@ -80,7 +80,7 @@ static int FUNC(extension_data)(CodedBitstreamContext *ctx, 
> RWContext *rw,
>  }
>  #else
>  for (k = 0; k < current->bit_length; k++)
> -xu(1, extension_data, current->data[k / 8] >> (7 - k % 8), 0, 1, 0);
> +xu(1, extension_data, current->data[k / 8] >> (7 - k % 8) & 1, 0, 1, 
> 0);
>  #endif
>  return 0;
>  }

I'll apply this soon.
___
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 3/3 v3] avcodec/cbs_h265: add missing support for reserved_payload_extension_data SEI bits

2020-04-29 Thread James Almer
Fixes ticket #8622

Signed-off-by: James Almer 
---
In writing scenarios, it will now ensure bit_equal_to_one is also always
written when currently defined extension data (like in Buffering Period) is
present, and not just when unknown extension data is.

 libavcodec/cbs_h2645.c|  1 +
 libavcodec/cbs_h265.h |  1 +
 libavcodec/cbs_h265_syntax_template.c | 71 +--
 3 files changed, 68 insertions(+), 5 deletions(-)

diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
index 095e449ddc..b432921ecc 100644
--- a/libavcodec/cbs_h2645.c
+++ b/libavcodec/cbs_h2645.c
@@ -553,6 +553,7 @@ static void cbs_h265_free_sei_payload(H265RawSEIPayload 
*payload)
 av_buffer_unref(>payload.other.data_ref);
 break;
 }
+av_buffer_unref(>extension_data.data_ref);
 }
 
 static void cbs_h265_free_sei(void *opaque, uint8_t *content)
diff --git a/libavcodec/cbs_h265.h b/libavcodec/cbs_h265.h
index 2c1e153ad9..73897f77a4 100644
--- a/libavcodec/cbs_h265.h
+++ b/libavcodec/cbs_h265.h
@@ -715,6 +715,7 @@ typedef struct H265RawSEIPayload {
 AVBufferRef *data_ref;
 } other;
 } payload;
+H265RawExtensionData extension_data;
 } H265RawSEIPayload;
 
 typedef struct H265RawSEI {
diff --git a/libavcodec/cbs_h265_syntax_template.c 
b/libavcodec/cbs_h265_syntax_template.c
index ed08b06e9c..45838467b7 100644
--- a/libavcodec/cbs_h265_syntax_template.c
+++ b/libavcodec/cbs_h265_syntax_template.c
@@ -1564,7 +1564,8 @@ static int 
FUNC(slice_segment_header)(CodedBitstreamContext *ctx, RWContext *rw,
 
 static int FUNC(sei_buffering_period)(CodedBitstreamContext *ctx, RWContext 
*rw,
   H265RawSEIBufferingPeriod *current,
-  uint32_t *payload_size)
+  uint32_t *payload_size,
+  int *more_data)
 {
 CodedBitstreamH265Context *h265 = ctx->priv_data;
 const H265RawSPS *sps;
@@ -1658,8 +1659,15 @@ static int 
FUNC(sei_buffering_period)(CodedBitstreamContext *ctx, RWContext *rw,
 else
 infer(use_alt_cpb_params_flag, 0);
 #else
-if (current->use_alt_cpb_params_flag)
+// If unknown extension data exists, then use_alt_cpb_params_flag is
+// coded in the bitstream and must be written even if it's 0.
+if (current->use_alt_cpb_params_flag || *more_data) {
 flag(use_alt_cpb_params_flag);
+// Ensure this bit is not the last in the payload by making the
+// more_data_in_payload() check evaluate to true, so it may not
+// be mistaken as something else by decoders.
+*more_data = 1;
+}
 #endif
 
 return 0;
@@ -2057,11 +2065,48 @@ static int 
FUNC(sei_alpha_channel_info)(CodedBitstreamContext *ctx,
 return 0;
 }
 
+static int FUNC(payload_extension)(CodedBitstreamContext *ctx, RWContext *rw,
+   H265RawExtensionData *current, uint32_t 
payload_size,
+   int cur_pos)
+{
+int err;
+size_t byte_length, k;
+
+#ifdef READ
+GetBitContext tmp;
+int bits_left, payload_zero_bits;
+
+if (!cbs_h265_payload_extension_present(rw, payload_size, cur_pos))
+return 0;
+
+bits_left = 8 * payload_size - cur_pos;
+tmp = *rw;
+if (bits_left > 8)
+skip_bits_long(, bits_left - 8);
+payload_zero_bits = get_bits(, FFMIN(bits_left, 8));
+if (!payload_zero_bits)
+return AVERROR_INVALIDDATA;
+payload_zero_bits = ff_ctz(payload_zero_bits);
+current->bit_length = bits_left - payload_zero_bits - 1;
+allocate(current->data, (current->bit_length + 7) / 8);
+#endif
+
+byte_length = (current->bit_length + 7) / 8;
+for (k = 0; k < byte_length; k++) {
+int length = FFMIN(current->bit_length - k * 8, 8);
+xu(length, reserved_payload_extension_data, current->data[k],
+   0, MAX_UINT_BITS(length), 0);
+}
+
+return 0;
+}
+
 static int FUNC(sei_payload)(CodedBitstreamContext *ctx, RWContext *rw,
  H265RawSEIPayload *current, int prefix)
 {
 int err, i;
-int start_position, end_position;
+int start_position, current_position, end_position;
+int more_data = !!current->extension_data.bit_length;
 
 #ifdef READ
 start_position = get_bits_count(rw);
@@ -2093,8 +2138,15 @@ static int FUNC(sei_payload)(CodedBitstreamContext *ctx, 
RWContext *rw,
 CHECK(FUNC(sei_ ## name)(ctx, rw, >payload.name, \
  >payload_size)); \
 break
+#define SEI_TYPE_E(type, prefix_valid, suffix_valid, name) \
+case HEVC_SEI_TYPE_ ## type: \
+SEI_TYPE_CHECK_VALID(name, prefix_valid, suffix_valid); \
+CHECK(FUNC(sei_ ## name)(ctx, rw, >payload.name, \
+ >payload_size, \
+ _data)); \
+break
 
-SEI_TYPE_S(BUFFERING_PERIOD, 1, 0, 

[FFmpeg-devel] [PATCH 2/3 v3] avcodec/cbs_h265: move the payload_extension_present check into its own function

2020-04-29 Thread James Almer
Will be reused in the following patch.

Signed-off-by: James Almer 
---
Moved the comment for the function to its new place, but otherwise, no
difference compared to v2.

 libavcodec/cbs_h2645.c| 10 ++
 libavcodec/cbs_h265_syntax_template.c |  9 +++--
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
index d42073cc5a..095e449ddc 100644
--- a/libavcodec/cbs_h2645.c
+++ b/libavcodec/cbs_h2645.c
@@ -233,6 +233,16 @@ static int cbs_write_se_golomb(CodedBitstreamContext *ctx, 
PutBitContext *pbc,
 return 0;
 }
 
+// payload_extension_present() - true if we are before the last 1-bit
+// in the payload structure, which must be in the last byte.
+static int cbs_h265_payload_extension_present(GetBitContext *gbc, uint32_t 
payload_size,
+  int cur_pos)
+{
+int bits_left = payload_size * 8 - cur_pos;
+return (bits_left > 0 &&
+(bits_left > 7 || show_bits(gbc, bits_left) & 
MAX_UINT_BITS(bits_left - 1)));
+}
+
 #define HEADER(name) do { \
 ff_cbs_trace_header(ctx, name); \
 } while (0)
diff --git a/libavcodec/cbs_h265_syntax_template.c 
b/libavcodec/cbs_h265_syntax_template.c
index a51b12cfc6..ed08b06e9c 100644
--- a/libavcodec/cbs_h265_syntax_template.c
+++ b/libavcodec/cbs_h265_syntax_template.c
@@ -1572,7 +1572,7 @@ static int 
FUNC(sei_buffering_period)(CodedBitstreamContext *ctx, RWContext *rw,
 int err, i, length;
 
 #ifdef READ
-int start_pos, end_pos, bits_left;
+int start_pos, end_pos;
 start_pos = get_bits_count(rw);
 #endif
 
@@ -1651,12 +1651,9 @@ static int 
FUNC(sei_buffering_period)(CodedBitstreamContext *ctx, RWContext *rw,
 }
 
 #ifdef READ
-// payload_extension_present() - true if we are before the last 1-bit
-// in the payload structure, which must be in the last byte.
 end_pos = get_bits_count(rw);
-bits_left = *payload_size * 8 - (end_pos - start_pos);
-if (bits_left > 0 &&
-(bits_left > 7 || ff_ctz(show_bits(rw, bits_left)) < bits_left - 1))
+if (cbs_h265_payload_extension_present(rw, *payload_size,
+   end_pos - start_pos))
 flag(use_alt_cpb_params_flag);
 else
 infer(use_alt_cpb_params_flag, 0);
-- 
2.26.2

___
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 v2] avcodec/cbs_h265: rename H265RawPSExtensionData to H265RawExtensionData

2020-04-29 Thread James Almer
So that NAL types other than Parameter Set ones may use it.

Signed-off-by: James Almer 
---
No difference compared to v1.

 libavcodec/cbs_h265.h | 10 +-
 libavcodec/cbs_h265_syntax_template.c |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavcodec/cbs_h265.h b/libavcodec/cbs_h265.h
index ad746bf35f..2c1e153ad9 100644
--- a/libavcodec/cbs_h265.h
+++ b/libavcodec/cbs_h265.h
@@ -182,11 +182,11 @@ typedef struct H265RawVUI {
 uint8_t log2_max_mv_length_vertical;
 } H265RawVUI;
 
-typedef struct H265RawPSExtensionData {
+typedef struct H265RawExtensionData {
 uint8_t *data;
 size_t bit_length;
 AVBufferRef *data_ref;
-} H265RawPSExtensionData;
+} H265RawExtensionData;
 
 typedef struct H265RawVPS {
 H265RawNALUnitHeader nal_unit_header;
@@ -221,7 +221,7 @@ typedef struct H265RawVPS {
 H265RawHRDParameters hrd_parameters[HEVC_MAX_LAYER_SETS];
 
 uint8_t vps_extension_flag;
-H265RawPSExtensionData extension_data;
+H265RawExtensionData extension_data;
 } H265RawVPS;
 
 typedef struct H265RawSTRefPicSet {
@@ -325,7 +325,7 @@ typedef struct H265RawSPS {
 uint8_t sps_scc_extension_flag;
 uint8_t sps_extension_4bits;
 
-H265RawPSExtensionData extension_data;
+H265RawExtensionData extension_data;
 
 // Range extension.
 uint8_t transform_skip_rotation_enabled_flag;
@@ -413,7 +413,7 @@ typedef struct H265RawPPS {
 uint8_t pps_scc_extension_flag;
 uint8_t pps_extension_4bits;
 
-H265RawPSExtensionData extension_data;
+H265RawExtensionData extension_data;
 
 // Range extension.
 uint8_t log2_max_transform_skip_block_size_minus2;
diff --git a/libavcodec/cbs_h265_syntax_template.c 
b/libavcodec/cbs_h265_syntax_template.c
index 0696eeeb9e..a51b12cfc6 100644
--- a/libavcodec/cbs_h265_syntax_template.c
+++ b/libavcodec/cbs_h265_syntax_template.c
@@ -59,7 +59,7 @@ static int FUNC(byte_alignment)(CodedBitstreamContext *ctx, 
RWContext *rw)
 }
 
 static int FUNC(extension_data)(CodedBitstreamContext *ctx, RWContext *rw,
-H265RawPSExtensionData *current)
+H265RawExtensionData *current)
 {
 int err;
 size_t k;
-- 
2.26.2

___
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 0/3] Patch set to delay output live stream

2020-04-29 Thread Tao Zhang
Marton Balint  于2020年4月30日周四 上午4:55写道:
>
>
>
> On Thu, 30 Apr 2020, Tao Zhang wrote:
>
> > Marton Balint  于2020年4月30日周四 上午12:03写道:
> >>
> >>
> >>
> >> On Wed, 29 Apr 2020, leozhang wrote:
> >>
> >> > In some applications, it is required to add delay to live streaming.
> >>
> >> In what applications? And if you do this, why not run
> >>
> >> sleep 20; ffmpeg 
> > In live streaming applications, someone wouldn't want broadcast what's
> > comming next immediately.
> > Sleep 20 then ffmpeg is not ok, because the stream is still
> > broadcasting immediately, and lost 20 seconds signal.
>
> So you want to buffer 20 seconds of input, and then start the output?
yes
>
> >>
> >> I don't see how this is useful at all.
> >>
> >> And what is -paced? What it is used for? Isn't it the same as using ffmpeg
> >> -re? You really should better explain your use case.
> > -re read the input, -paced write the output.
>
> But why do you want to delay every output packet?
By default, ffmpeg will output packets as fast as possible.
So I delay output every packet at native frame rate to simulate live stream.
>
> >>
> >> Regards,
> >> Marton
> >>
> >> > For example, you can add 20 seconds to rtmp stream with below command:
> >> > ffmpeg -i your_input_stream_address -c copy -map 0:a -map 0:v -f fifo 
> >> > -paced 1 -queue_size 600
> >> > -output_delay 2000 -fifo_format flv 
> >> > rtmp://example.com/live/delayed_stream_name
> >> >
> >> > leozhang (3):
> >> >  avformat/fifo: add option to delay output
> >> >  avformat/fifo: add option to write packets in paced way
> >> >  doc/muxers: add command example how to delay output live stream
> >> >
> >> > doc/muxers.texi| 17 +
> >> > libavformat/fifo.c | 26 ++
> >> > 2 files changed, 43 insertions(+)
> >> >
> >> > --
> >> > 1.8.3.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".
> >> ___
> >> 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 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/6] avformat/matroskaenc: Move adding SeekEntry into end_ebml_master_crc32()

2020-04-29 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> Up until now, SeekEntries were already added before
> start_ebml_master_crc32() was even called and before we were actually
> sure that we really write the element the SeekHead references; after
> all, we might also error out later; and given that the allocations
> implicit in dynamic buffers should be checked, end_ebml_master_crc32()
> will eventually have to return errors itself, so that it is the right
> place to add SeekHead entries.
> 
> The earlier behaviour is of course a remnant of the time in which
> start_ebml_master_crc32() really did output something, so that the
> position before start_ebml_master_crc32() needed to be recorded.
> Erroring out later is also not as dangerous as it seems because in
> this case no SeekHead will be written (if it happened when writing
> the header, the whole muxing process would abort; if it happened
> when writing the trailer (when writing chapters not available initially),
> writing the trailer would be aborted and no SeekHead containing the
> bogus chapter entry would be written).
> 
> This commit does not change the way the SeekEntries are added for those
> elements that are output preliminarily; this is so because the SeekHead
> is written before those elements are finally output and doing it
> otherwise would increase the amount of seeks.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavformat/matroskaenc.c | 64 ---
>  1 file changed, 33 insertions(+), 31 deletions(-)
> 
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index a1b613290c..b50fd8dd9b 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -349,6 +349,17 @@ static void end_ebml_master(AVIOContext *pb, ebml_master 
> master)
>  avio_seek(pb, pos, SEEK_SET);
>  }
>  
> +static void mkv_add_seekhead_entry(MatroskaMuxContext *mkv, uint32_t 
> elementid,
> +   uint64_t filepos)
> +{
> +mkv_seekhead *seekhead = >seekhead;
> +
> +av_assert1(seekhead->num_entries < MAX_SEEKHEAD_ENTRIES);
> +
> +seekhead->entries[seekhead->num_entries].elementid= elementid;
> +seekhead->entries[seekhead->num_entries++].segmentpos = filepos - 
> mkv->segment_offset;
> +}
> +
>  static int start_ebml_master_crc32(AVIOContext **dyn_cp, MatroskaMuxContext 
> *mkv)
>  {
>  int ret;
> @@ -364,11 +375,15 @@ static int start_ebml_master_crc32(AVIOContext 
> **dyn_cp, MatroskaMuxContext *mkv
>  
>  static void end_ebml_master_crc32(AVIOContext *pb, AVIOContext **dyn_cp,
>MatroskaMuxContext *mkv, uint32_t id,
> -  int length_size, int keep_buffer)
> +  int length_size, int keep_buffer,
> +  int add_seekentry)
>  {
>  uint8_t *buf, crc[4];
>  int size, skip = 0;
>  
> +if (add_seekentry)
> +mkv_add_seekhead_entry(mkv, id, avio_tell(pb));
> +
>  put_ebml_id(pb, id);
>  size = avio_get_dyn_buf(*dyn_cp, );
>  put_ebml_length(pb, size, length_size);
> @@ -441,17 +456,6 @@ static void mkv_start_seekhead(MatroskaMuxContext *mkv, 
> AVIOContext *pb)
>  put_ebml_void(pb, mkv->seekhead.reserved_size);
>  }
>  
> -static void mkv_add_seekhead_entry(MatroskaMuxContext *mkv, uint32_t 
> elementid,
> -   uint64_t filepos)
> -{
> -mkv_seekhead *seekhead = >seekhead;
> -
> -av_assert1(seekhead->num_entries < MAX_SEEKHEAD_ENTRIES);
> -
> -seekhead->entries[seekhead->num_entries].elementid= elementid;
> -seekhead->entries[seekhead->num_entries++].segmentpos = filepos - 
> mkv->segment_offset;
> -}
> -
>  /**
>   * Write the SeekHead to the file at the location reserved for it
>   * and seek to destpos afterwards. When error_on_seek_failure
> @@ -489,7 +493,7 @@ static int mkv_write_seekhead(AVIOContext *pb, 
> MatroskaMuxContext *mkv,
>  put_ebml_uint(dyn_cp, MATROSKA_ID_SEEKPOSITION, entry->segmentpos);
>  end_ebml_master(dyn_cp, seekentry);
>  }
> -end_ebml_master_crc32(pb, _cp, mkv, MATROSKA_ID_SEEKHEAD, 0, 0);
> +end_ebml_master_crc32(pb, _cp, mkv, MATROSKA_ID_SEEKHEAD, 0, 0, 0);
>  
>  remaining = seekhead->filepos + seekhead->reserved_size - avio_tell(pb);
>  put_ebml_void(pb, remaining);
> @@ -1421,7 +1425,8 @@ static int mkv_write_tracks(AVFormatContext *s)
>  end_ebml_master_crc32_preliminary(pb, mkv->tracks_bc,
>MATROSKA_ID_TRACKS, 
> >tracks_pos);
>  else
> -end_ebml_master_crc32(pb, >tracks_bc, mkv, MATROSKA_ID_TRACKS, 
> 0, 0);
> +end_ebml_master_crc32(pb, >tracks_bc, mkv,
> +  MATROSKA_ID_TRACKS, 0, 0, 0);
>  
>  return 0;
>  }
> @@ -1443,8 +1448,6 @@ static int mkv_write_chapters(AVFormatContext *s)
>  break;
>  }
>  

In my private branch, these six patches are based upon my earlier
patchset, 

Re: [FFmpeg-devel] [PATCH 2/5] avformat/matroskaenc: fix invalid pointer access if avio_get_dyn_buf failed

2020-04-29 Thread Nicolas George
Andreas Rheinhardt (12020-04-30):
> I sent a patch containing proper checks for this and other allocations
> in this muxer here [1].

Thanks.

> PS: avio_close_dyn_buf() is even worse: Besides the design flaw of
> freeing a resource without setting the pointer to it to NULL, it returns
> a size of -AV_INPUT_BUFFER_PADDING_SIZE if a memory allocation failure
> happened (but not if the arbitrary limit of INT_MAX/2 has been
> surpassed); and this despite its documentation not allowing returning
> negative values at all. (And it returns the current position of the
> write pointer as size and zeroes what comes immediately after, even if a
> seek to the front has happened.)

The av_dynbuf_write() API I proposed some time ago allows proper error
check at the end (and I even intend to make it a little more
unavoidable in the next iteration). And as a bonus, it uses an on-stack
buffer as long as it fits (it is based on BPrint).

I have a small intro written about it if people are interested.

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 2/5] avformat/matroskaenc: fix invalid pointer access if avio_get_dyn_buf failed

2020-04-29 Thread Andreas Rheinhardt
lance.lmw...@gmail.com:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavformat/matroskaenc.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index 784973a951..f0474da44f 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -374,9 +374,12 @@ static void end_ebml_master_crc32(AVIOContext *pb, 
> AVIOContext **dyn_cp,
>  put_ebml_length(pb, size, length_size);
>  if (mkv->write_crc) {
>  skip = 6; /* Skip reserved 6-byte long void element from the dynamic 
> buffer. */
> +if (size > skip) {
>  AV_WL32(crc, av_crc(av_crc_get_table(AV_CRC_32_IEEE_LE), UINT32_MAX, 
> buf + skip, size - skip) ^ UINT32_MAX);
>  put_ebml_binary(pb, EBML_ID_CRC32, crc, sizeof(crc));
> +}
>  }
> +if (size > skip)
>  avio_write(pb, buf + skip, size - skip);
>  
>  if (keep_buffer) {
> 
I sent a patch containing proper checks for this and other allocations
in this muxer here [1].

- Andreas

PS: avio_close_dyn_buf() is even worse: Besides the design flaw of
freeing a resource without setting the pointer to it to NULL, it returns
a size of -AV_INPUT_BUFFER_PADDING_SIZE if a memory allocation failure
happened (but not if the arbitrary limit of INT_MAX/2 has been
surpassed); and this despite its documentation not allowing returning
negative values at all. (And it returns the current position of the
write pointer as size and zeroes what comes immediately after, even if a
seek to the front has happened.)

[1]: http://ffmpeg.org/pipermail/ffmpeg-devel/2020-April/261704.html
___
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 3/6] avformat/matroskaenc: Avoid dynamic buffer when writing Colour

2020-04-29 Thread Andreas Rheinhardt
There is a good upper bound for the maximum length of the Colour master
element; it is therefore unnecessary to use a dynamic buffer for it.
A simple buffer on the stack is enough. This commit implements this.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/matroskaenc.c | 26 --
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 31f75abc64..36c9ea1d9c 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -808,18 +808,19 @@ static int mkv_write_codecprivate(AVFormatContext *s, 
AVIOContext *pb,
 return ret;
 }
 
-static int mkv_write_video_color(AVIOContext *pb, const AVCodecParameters *par,
+static void mkv_write_video_color(AVIOContext *pb, const AVCodecParameters 
*par,
  const AVStream *st)
 {
-AVIOContext *dyn_cp;
-uint8_t *colorinfo_ptr;
+/* 18 Elements with two bytes ID, one byte length field, 8 bytes payload
+ * a master element with two bytes ID and one byte length field
+ * plus another byte to stay clear of the end. */
+uint8_t colour[(2 + 1 + 8) * 18 + (2 + 1) + 1];
+AVIOContext buf, *dyn_cp = 
 int side_data_size = 0;
-int ret, colorinfo_size;
+int colorinfo_size;
 const uint8_t *side_data;
 
-ret = avio_open_dyn_buf(_cp);
-if (ret < 0)
-return ret;
+ffio_init_context(dyn_cp, colour, sizeof(colour), 1, NULL, NULL, NULL, 
NULL);
 
 if (par->color_trc != AVCOL_TRC_UNSPECIFIED &&
 par->color_trc < AVCOL_TRC_NB) {
@@ -890,14 +891,12 @@ static int mkv_write_video_color(AVIOContext *pb, const 
AVCodecParameters *par,
 end_ebml_master(dyn_cp, meta_element);
 }
 
-colorinfo_size = avio_get_dyn_buf(dyn_cp, _ptr);
+colorinfo_size = avio_tell(dyn_cp);
 if (colorinfo_size) {
 ebml_master colorinfo = start_ebml_master(pb, MATROSKA_ID_VIDEOCOLOR, 
colorinfo_size);
-avio_write(pb, colorinfo_ptr, colorinfo_size);
+avio_write(pb, colour, colorinfo_size);
 end_ebml_master(pb, colorinfo);
 }
-ffio_free_dyn_buf(_cp);
-return 0;
 }
 
 static int mkv_write_video_projection(AVFormatContext *s, AVIOContext *pb,
@@ -1290,9 +1289,8 @@ static int mkv_write_track(AVFormatContext *s, 
MatroskaMuxContext *mkv,
 uint32_t color_space = av_le2ne32(par->codec_tag);
 put_ebml_binary(pb, MATROSKA_ID_VIDEOCOLORSPACE, _space, 
sizeof(color_space));
 }
-ret = mkv_write_video_color(pb, par, st);
-if (ret < 0)
-return ret;
+mkv_write_video_color(pb, par, st);
+
 ret = mkv_write_video_projection(s, pb, st);
 if (ret < 0)
 return ret;
-- 
2.20.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".

[FFmpeg-devel] [PATCH 6/6] avformat/matroskaenc: Cosmetics

2020-04-29 Thread Andreas Rheinhardt
Mainly reindentation.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/matroskaenc.c | 42 +++
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 12c22184a3..d5c69d8d77 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -376,9 +376,9 @@ static int start_ebml_master_crc32(AVIOContext **dyn_cp, 
MatroskaMuxContext *mkv
 }
 
 static int end_ebml_master_crc32(AVIOContext *pb, AVIOContext **dyn_cp,
-  MatroskaMuxContext *mkv, uint32_t id,
-  int length_size, int keep_buffer,
-  int add_seekentry)
+ MatroskaMuxContext *mkv, uint32_t id,
+ int length_size, int keep_buffer,
+ int add_seekentry)
 {
 uint8_t *buf, crc[4];
 int ret, size, skip = 0;
@@ -413,11 +413,11 @@ fail:
  * Furthermore always add a SeekHead Entry for this element.
  */
 static int end_ebml_master_crc32_tentatively(AVIOContext *pb,
-  ebml_stored_master *elem,
-  MatroskaMuxContext *mkv, 
uint32_t id)
+ ebml_stored_master *elem,
+ MatroskaMuxContext *mkv, uint32_t 
id)
 {
 if ((pb->seekable & AVIO_SEEKABLE_NORMAL) && !mkv->is_live) {
-uint8_t *buf;
+uint8_t *buf;
 int size = avio_get_dyn_buf(elem->bc, );
 
 if (elem->bc->error < 0)
@@ -426,9 +426,9 @@ static int end_ebml_master_crc32_tentatively(AVIOContext 
*pb,
 elem->pos = avio_tell(pb);
 mkv_add_seekhead_entry(mkv, id, elem->pos);
 
-put_ebml_id(pb, id);
-put_ebml_length(pb, size, 0);
-avio_write(pb, buf, size);
+put_ebml_id(pb, id);
+put_ebml_length(pb, size, 0);
+avio_write(pb, buf, size);
 
 return 0;
 } else
@@ -816,17 +816,17 @@ static int mkv_write_codecprivate(AVFormatContext *s, 
AVIOContext *pb,
 }
 
 if (ret >= 0) {
-codecpriv_size = avio_get_dyn_buf(dyn_cp, );
+codecpriv_size = avio_get_dyn_buf(dyn_cp, );
 if ((ret = dyn_cp->error) >= 0 && codecpriv_size)
-put_ebml_binary(pb, MATROSKA_ID_CODECPRIVATE, codecpriv,
-codecpriv_size);
+put_ebml_binary(pb, MATROSKA_ID_CODECPRIVATE, codecpriv,
+codecpriv_size);
 }
 ffio_free_dyn_buf(_cp);
 return ret;
 }
 
-static void mkv_write_video_color(AVIOContext *pb, const AVCodecParameters 
*par,
- const AVStream *st)
+static void mkv_write_video_color(AVIOContext *pb, const AVStream *st,
+  const AVCodecParameters *par)
 {
 /* 18 Elements with two bytes ID, one byte length field, 8 bytes payload
  * a master element with two bytes ID and one byte length field
@@ -1304,7 +1304,7 @@ static int mkv_write_track(AVFormatContext *s, 
MatroskaMuxContext *mkv,
 uint32_t color_space = av_le2ne32(par->codec_tag);
 put_ebml_binary(pb, MATROSKA_ID_VIDEOCOLORSPACE, _space, 
sizeof(color_space));
 }
-mkv_write_video_color(pb, par, st);
+mkv_write_video_color(pb, st, par);
 
 ret = mkv_write_video_projection(s, pb, st);
 if (ret < 0)
@@ -1441,7 +1441,7 @@ static int mkv_write_tracks(AVFormatContext *s)
 }
 
 return end_ebml_master_crc32_tentatively(pb, >track, mkv,
-  MATROSKA_ID_TRACKS);
+ MATROSKA_ID_TRACKS);
 }
 
 static int mkv_write_chapters(AVFormatContext *s)
@@ -1693,7 +1693,7 @@ static int mkv_write_tags(AVFormatContext *s)
 
 if (mkv->tags.bc) {
 return end_ebml_master_crc32_tentatively(s->pb, >tags, mkv,
-  MATROSKA_ID_TAGS);
+ MATROSKA_ID_TAGS);
 }
 return 0;
 }
@@ -2466,7 +2466,7 @@ static int mkv_write_trailer(AVFormatContext *s)
 
 if (mkv->cluster_bc) {
 ret = end_ebml_master_crc32(pb, >cluster_bc, mkv,
-  MATROSKA_ID_CLUSTER, 0, 0, 0);
+MATROSKA_ID_CLUSTER, 0, 0, 0);
 if (ret < 0)
 return ret;
 }
@@ -2526,7 +2526,7 @@ static int mkv_write_trailer(AVFormatContext *s)
 }
 }
 ret = end_ebml_master_crc32(pb, , mkv, MATROSKA_ID_CUES,
-  length_size, 0, 1);
+length_size, 0, 1);
 if (ret < 0)
 return ret;
 if (mkv->reserve_cues_space) {
@@ -2554,7 +2554,7 @@ static int mkv_write_trailer(AVFormatContext *s)
 // write Tracks master
 avio_seek(pb, 

[FFmpeg-devel] [PATCH 4/6] avformat/matroskaenc: Simplify writing buffer

2020-04-29 Thread Andreas Rheinhardt
If one already has the contents of a master elements in a buffer of
known size, then writing a EBML master element is no different from
writing an EBML binary element. It is overtly complicated to use
start/end_ebml_master() as these functions first write an unkown-length
size field of the appropriate length, then write the buffer's contents,
followed by a seek to the length field to overwrite it with the real
size (obtained via avio_tell() although it was already known in
advance), followed by another seek to the previous position. Just use
put_ebml_binary() instead.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/matroskaenc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 36c9ea1d9c..e671a572a8 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -893,9 +893,7 @@ static void mkv_write_video_color(AVIOContext *pb, const 
AVCodecParameters *par,
 
 colorinfo_size = avio_tell(dyn_cp);
 if (colorinfo_size) {
-ebml_master colorinfo = start_ebml_master(pb, MATROSKA_ID_VIDEOCOLOR, 
colorinfo_size);
-avio_write(pb, colour, colorinfo_size);
-end_ebml_master(pb, colorinfo);
+put_ebml_binary(pb, MATROSKA_ID_VIDEOCOLOR, colour, colorinfo_size);
 }
 }
 
-- 
2.20.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".

[FFmpeg-devel] [PATCH 5/6] avformat/matroskaenc: Check allocations implicit in dynamic buffers

2020-04-29 Thread Andreas Rheinhardt
Failures of the allocations that happen under the hood when using dynamic
buffers are usually completely unchecked and the Matroska muxer is no
exception to this.

The API has its part in this, because there is no documented way to
actually check for errors: The return value of both avio_get_dyn_buf()
as well as avio_close_dyn_buf() is only documented as "the length of
the byte buffer", so that using this to return errors would be an API
break.

Therefore this commit uses the only reliable way to check for errors
with avio_get_dyn_buf(): The AVIOContext's error flag. (This is one of
the advantages of avio_get_dyn_buf(): By not destroying the AVIOContext
it is possible to inspect this value.) Checking whether the size or the
pointer vanishes is not enough as it does not check for truncated output
(the dynamic buffer API is int based and so has to truncate the buffer
even when enough memory would be available; it's current actual limit is
even way below INT_MAX).

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/matroskaenc.c | 113 ++
 1 file changed, 77 insertions(+), 36 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index e671a572a8..12c22184a3 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -375,19 +375,22 @@ static int start_ebml_master_crc32(AVIOContext **dyn_cp, 
MatroskaMuxContext *mkv
 return 0;
 }
 
-static void end_ebml_master_crc32(AVIOContext *pb, AVIOContext **dyn_cp,
+static int end_ebml_master_crc32(AVIOContext *pb, AVIOContext **dyn_cp,
   MatroskaMuxContext *mkv, uint32_t id,
   int length_size, int keep_buffer,
   int add_seekentry)
 {
 uint8_t *buf, crc[4];
-int size, skip = 0;
+int ret, size, skip = 0;
+
+size = avio_get_dyn_buf(*dyn_cp, );
+if ((ret = (*dyn_cp)->error) < 0)
+goto fail;
 
 if (add_seekentry)
 mkv_add_seekhead_entry(mkv, id, avio_tell(pb));
 
 put_ebml_id(pb, id);
-size = avio_get_dyn_buf(*dyn_cp, );
 put_ebml_length(pb, size, length_size);
 if (mkv->write_crc) {
 skip = 6; /* Skip reserved 6-byte long void element from the dynamic 
buffer. */
@@ -396,18 +399,20 @@ static void end_ebml_master_crc32(AVIOContext *pb, 
AVIOContext **dyn_cp,
 }
 avio_write(pb, buf + skip, size - skip);
 
+fail:
 if (keep_buffer) {
 ffio_reset_dyn_buf(*dyn_cp);
 } else {
 ffio_free_dyn_buf(dyn_cp);
 }
+return ret;
 }
 
 /**
  * Output EBML master. Keep the buffer if seekable, allowing for later updates.
  * Furthermore always add a SeekHead Entry for this element.
  */
-static void end_ebml_master_crc32_tentatively(AVIOContext *pb,
+static int end_ebml_master_crc32_tentatively(AVIOContext *pb,
   ebml_stored_master *elem,
   MatroskaMuxContext *mkv, 
uint32_t id)
 {
@@ -415,14 +420,19 @@ static void end_ebml_master_crc32_tentatively(AVIOContext 
*pb,
 uint8_t *buf;
 int size = avio_get_dyn_buf(elem->bc, );
 
+if (elem->bc->error < 0)
+return elem->bc->error;
+
 elem->pos = avio_tell(pb);
 mkv_add_seekhead_entry(mkv, id, elem->pos);
 
 put_ebml_id(pb, id);
 put_ebml_length(pb, size, 0);
 avio_write(pb, buf, size);
+
+return 0;
 } else
-end_ebml_master_crc32(pb, >bc, mkv, id, 0, 0, 1);
+return end_ebml_master_crc32(pb, >bc, mkv, id, 0, 0, 1);
 }
 
 static void put_xiph_size(AVIOContext *pb, int size)
@@ -501,7 +511,10 @@ static int mkv_write_seekhead(AVIOContext *pb, 
MatroskaMuxContext *mkv,
 put_ebml_uint(dyn_cp, MATROSKA_ID_SEEKPOSITION, entry->segmentpos);
 end_ebml_master(dyn_cp, seekentry);
 }
-end_ebml_master_crc32(pb, _cp, mkv, MATROSKA_ID_SEEKHEAD, 0, 0, 0);
+ret = end_ebml_master_crc32(pb, _cp, mkv,
+MATROSKA_ID_SEEKHEAD, 0, 0, 0);
+if (ret < 0)
+return ret;
 
 remaining = seekhead->filepos + seekhead->reserved_size - avio_tell(pb);
 put_ebml_void(pb, remaining);
@@ -574,12 +587,14 @@ static int mkv_assemble_cues(AVStream **streams, 
AVIOContext *dyn_cp,
 end_ebml_master(cuepoint, track_positions);
 } while (++entry < end && entry->pts == pts);
 size = avio_get_dyn_buf(cuepoint, );
+if ((ret = cuepoint->error) < 0)
+break;
 put_ebml_binary(dyn_cp, MATROSKA_ID_POINTENTRY, buf, size);
 ffio_reset_dyn_buf(cuepoint);
 }
 ffio_free_dyn_buf();
 
-return 0;
+return ret;
 }
 
 static int put_xiph_codecpriv(AVFormatContext *s, AVIOContext *pb,
@@ -800,10 +815,12 @@ static int mkv_write_codecprivate(AVFormatContext *s, 
AVIOContext *pb,
 ff_put_wav_header(s, dyn_cp, par, 
FF_PUT_WAV_HEADER_FORCE_WAVEFORMATEX);
 }
 
+if (ret >= 0) {
 codecpriv_size = 

[FFmpeg-devel] [PATCH 2/6] avformat/matroskaenc: Unify writing level 1 elements preliminarily

2020-04-29 Thread Andreas Rheinhardt
The Matroska muxer updates several header elements when the output is
seekable; if unseekable, the buffer containing the contents of the element
is immediately freed after writing. Before this commit, there were three
places doing exactly the same: Checking whether the output is seekable
and calling the function that writes and frees or the function that
just writes the EBML master. This has been unified; adding SeekHead
entries for these elements has been unified, too.

Signed-off-by: Andreas Rheinhardt 
---
There was unfortunately a naming collision: The MatroskaMuxContext
already contains an element tracks, so I settled for track for the
stored EBML master.

 libavformat/matroskaenc.c | 135 +-
 1 file changed, 62 insertions(+), 73 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index b50fd8dd9b..31f75abc64 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -69,6 +69,11 @@ typedef struct ebml_master {
 int sizebytes;  ///< how many bytes were reserved for 
the size
 } ebml_master;
 
+typedef struct ebml_stored_master {
+AVIOContext *bc;
+int64_t pos;
+} ebml_stored_master;
+
 typedef struct mkv_seekhead_entry {
 uint32_telementid;
 uint64_tsegmentpos;
@@ -115,12 +120,9 @@ typedef struct mkv_track {
 typedef struct MatroskaMuxContext {
 const AVClass   *class;
 int mode;
-AVIOContext *tags_bc;
-int64_t tags_pos;
-AVIOContext *info_bc;
-int64_t info_pos;
-AVIOContext *tracks_bc;
-int64_t tracks_pos;
+ebml_stored_master info;
+ebml_stored_master track;
+ebml_stored_master tags;
 ebml_master segment;
 int64_t segment_offset;
 AVIOContext *cluster_bc;
@@ -402,19 +404,25 @@ static void end_ebml_master_crc32(AVIOContext *pb, 
AVIOContext **dyn_cp,
 }
 
 /**
-* Complete ebml master without destroying the buffer, allowing for later 
updates
-*/
-static void end_ebml_master_crc32_preliminary(AVIOContext *pb, AVIOContext 
*dyn_cp,
-  uint32_t id, int64_t *pos)
+ * Output EBML master. Keep the buffer if seekable, allowing for later updates.
+ * Furthermore always add a SeekHead Entry for this element.
+ */
+static void end_ebml_master_crc32_tentatively(AVIOContext *pb,
+  ebml_stored_master *elem,
+  MatroskaMuxContext *mkv, 
uint32_t id)
 {
+if ((pb->seekable & AVIO_SEEKABLE_NORMAL) && !mkv->is_live) {
 uint8_t *buf;
-int size = avio_get_dyn_buf(dyn_cp, );
+int size = avio_get_dyn_buf(elem->bc, );
 
-*pos = avio_tell(pb);
+elem->pos = avio_tell(pb);
+mkv_add_seekhead_entry(mkv, id, elem->pos);
 
 put_ebml_id(pb, id);
 put_ebml_length(pb, size, 0);
 avio_write(pb, buf, size);
+} else
+end_ebml_master_crc32(pb, >bc, mkv, id, 0, 0, 1);
 }
 
 static void put_xiph_size(AVIOContext *pb, int size)
@@ -433,9 +441,9 @@ static void mkv_deinit(AVFormatContext *s)
 av_packet_unref(>cur_audio_pkt);
 
 ffio_free_dyn_buf(>cluster_bc);
-ffio_free_dyn_buf(>info_bc);
-ffio_free_dyn_buf(>tracks_bc);
-ffio_free_dyn_buf(>tags_bc);
+ffio_free_dyn_buf(>info.bc);
+ffio_free_dyn_buf(>track.bc);
+ffio_free_dyn_buf(>tags.bc);
 
 av_freep(>cues.entries);
 av_freep(>tracks);
@@ -1374,9 +1382,7 @@ static int mkv_write_tracks(AVFormatContext *s)
 if (mkv->nb_attachments == s->nb_streams)
 return 0;
 
-mkv_add_seekhead_entry(mkv, MATROSKA_ID_TRACKS, avio_tell(pb));
-
-ret = start_ebml_master_crc32(>tracks_bc, mkv);
+ret = start_ebml_master_crc32(>track.bc, mkv);
 if (ret < 0)
 return ret;
 
@@ -1416,17 +1422,13 @@ static int mkv_write_tracks(AVFormatContext *s)
  i == video_default_idx || i == audio_default_idx 
||
  i == subtitle_default_idx;
 ret = mkv_write_track(s, mkv, st, >tracks[i],
-  mkv->tracks_bc, is_default);
+  mkv->track.bc, is_default);
 if (ret < 0)
 return ret;
 }
 
-if ((pb->seekable & AVIO_SEEKABLE_NORMAL) && !mkv->is_live)
-end_ebml_master_crc32_preliminary(pb, mkv->tracks_bc,
-  MATROSKA_ID_TRACKS, 
>tracks_pos);
-else
-end_ebml_master_crc32(pb, >tracks_bc, mkv,
-  MATROSKA_ID_TRACKS, 0, 0, 0);
+end_ebml_master_crc32_tentatively(pb, >track, mkv,
+  MATROSKA_ID_TRACKS);
 
 return 0;
 }
@@ -1532,14 +1534,12 @@ static int mkv_write_tag_targets(AVFormatContext *s, 
uint32_t elementid,
 ebml_master targets;
 int ret;
 
-if (!mkv->tags_bc) {
-mkv_add_seekhead_entry(mkv, MATROSKA_ID_TAGS, 

[FFmpeg-devel] [PATCH 1/6] avformat/matroskaenc: Move adding SeekEntry into end_ebml_master_crc32()

2020-04-29 Thread Andreas Rheinhardt
Up until now, SeekEntries were already added before
start_ebml_master_crc32() was even called and before we were actually
sure that we really write the element the SeekHead references; after
all, we might also error out later; and given that the allocations
implicit in dynamic buffers should be checked, end_ebml_master_crc32()
will eventually have to return errors itself, so that it is the right
place to add SeekHead entries.

The earlier behaviour is of course a remnant of the time in which
start_ebml_master_crc32() really did output something, so that the
position before start_ebml_master_crc32() needed to be recorded.
Erroring out later is also not as dangerous as it seems because in
this case no SeekHead will be written (if it happened when writing
the header, the whole muxing process would abort; if it happened
when writing the trailer (when writing chapters not available initially),
writing the trailer would be aborted and no SeekHead containing the
bogus chapter entry would be written).

This commit does not change the way the SeekEntries are added for those
elements that are output preliminarily; this is so because the SeekHead
is written before those elements are finally output and doing it
otherwise would increase the amount of seeks.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/matroskaenc.c | 64 ---
 1 file changed, 33 insertions(+), 31 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index a1b613290c..b50fd8dd9b 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -349,6 +349,17 @@ static void end_ebml_master(AVIOContext *pb, ebml_master 
master)
 avio_seek(pb, pos, SEEK_SET);
 }
 
+static void mkv_add_seekhead_entry(MatroskaMuxContext *mkv, uint32_t elementid,
+   uint64_t filepos)
+{
+mkv_seekhead *seekhead = >seekhead;
+
+av_assert1(seekhead->num_entries < MAX_SEEKHEAD_ENTRIES);
+
+seekhead->entries[seekhead->num_entries].elementid= elementid;
+seekhead->entries[seekhead->num_entries++].segmentpos = filepos - 
mkv->segment_offset;
+}
+
 static int start_ebml_master_crc32(AVIOContext **dyn_cp, MatroskaMuxContext 
*mkv)
 {
 int ret;
@@ -364,11 +375,15 @@ static int start_ebml_master_crc32(AVIOContext **dyn_cp, 
MatroskaMuxContext *mkv
 
 static void end_ebml_master_crc32(AVIOContext *pb, AVIOContext **dyn_cp,
   MatroskaMuxContext *mkv, uint32_t id,
-  int length_size, int keep_buffer)
+  int length_size, int keep_buffer,
+  int add_seekentry)
 {
 uint8_t *buf, crc[4];
 int size, skip = 0;
 
+if (add_seekentry)
+mkv_add_seekhead_entry(mkv, id, avio_tell(pb));
+
 put_ebml_id(pb, id);
 size = avio_get_dyn_buf(*dyn_cp, );
 put_ebml_length(pb, size, length_size);
@@ -441,17 +456,6 @@ static void mkv_start_seekhead(MatroskaMuxContext *mkv, 
AVIOContext *pb)
 put_ebml_void(pb, mkv->seekhead.reserved_size);
 }
 
-static void mkv_add_seekhead_entry(MatroskaMuxContext *mkv, uint32_t elementid,
-   uint64_t filepos)
-{
-mkv_seekhead *seekhead = >seekhead;
-
-av_assert1(seekhead->num_entries < MAX_SEEKHEAD_ENTRIES);
-
-seekhead->entries[seekhead->num_entries].elementid= elementid;
-seekhead->entries[seekhead->num_entries++].segmentpos = filepos - 
mkv->segment_offset;
-}
-
 /**
  * Write the SeekHead to the file at the location reserved for it
  * and seek to destpos afterwards. When error_on_seek_failure
@@ -489,7 +493,7 @@ static int mkv_write_seekhead(AVIOContext *pb, 
MatroskaMuxContext *mkv,
 put_ebml_uint(dyn_cp, MATROSKA_ID_SEEKPOSITION, entry->segmentpos);
 end_ebml_master(dyn_cp, seekentry);
 }
-end_ebml_master_crc32(pb, _cp, mkv, MATROSKA_ID_SEEKHEAD, 0, 0);
+end_ebml_master_crc32(pb, _cp, mkv, MATROSKA_ID_SEEKHEAD, 0, 0, 0);
 
 remaining = seekhead->filepos + seekhead->reserved_size - avio_tell(pb);
 put_ebml_void(pb, remaining);
@@ -1421,7 +1425,8 @@ static int mkv_write_tracks(AVFormatContext *s)
 end_ebml_master_crc32_preliminary(pb, mkv->tracks_bc,
   MATROSKA_ID_TRACKS, 
>tracks_pos);
 else
-end_ebml_master_crc32(pb, >tracks_bc, mkv, MATROSKA_ID_TRACKS, 0, 
0);
+end_ebml_master_crc32(pb, >tracks_bc, mkv,
+  MATROSKA_ID_TRACKS, 0, 0, 0);
 
 return 0;
 }
@@ -1443,8 +1448,6 @@ static int mkv_write_chapters(AVFormatContext *s)
 break;
 }
 
-mkv_add_seekhead_entry(mkv, MATROSKA_ID_CHAPTERS, avio_tell(pb));
-
 ret = start_ebml_master_crc32(_cp, mkv);
 if (ret < 0)
 return ret;
@@ -1481,7 +1484,7 @@ static int mkv_write_chapters(AVFormatContext *s)
 end_ebml_master(dyn_cp, chapteratom);
 }
 end_ebml_master(dyn_cp, editionentry);
-

Re: [FFmpeg-devel] [PATCH 2/3] libswscale: add output support for AV_PIX_FMT_GBRAPF32

2020-04-29 Thread Mark Reid
On Wed, Apr 29, 2020 at 2:22 PM Michael Niedermayer 
wrote:

> On Wed, Apr 29, 2020 at 11:19:56PM +0200, Michael Niedermayer wrote:
> > On Tue, Apr 28, 2020 at 08:02:34PM -0700, mindm...@gmail.com wrote:
> > > From: Mark Reid 
> > >
> > > ---
> > >  libswscale/output.c  | 82 
> > >  libswscale/slice.c   | 28 
> > >  libswscale/swscale_unscaled.c| 33 ++
> > >  libswscale/utils.c   |  8 +--
> > >  tests/ref/fate/filter-pixdesc-gbrapf32be |  1 +
> > >  tests/ref/fate/filter-pixdesc-gbrapf32le |  1 +
> > >  tests/ref/fate/filter-pixdesc-gbrpf32be  |  1 +
> > >  tests/ref/fate/filter-pixdesc-gbrpf32le  |  1 +
> > >  tests/ref/fate/filter-pixfmts-copy   |  4 ++
> > >  tests/ref/fate/filter-pixfmts-crop   |  4 ++
> > >  tests/ref/fate/filter-pixfmts-field  |  4 ++
> > >  tests/ref/fate/filter-pixfmts-fieldorder |  4 ++
> > >  tests/ref/fate/filter-pixfmts-hflip  |  4 ++
> > >  tests/ref/fate/filter-pixfmts-il |  4 ++
> > >  tests/ref/fate/filter-pixfmts-null   |  4 ++
> > >  tests/ref/fate/filter-pixfmts-scale  |  4 ++
> > >  tests/ref/fate/filter-pixfmts-transpose  |  4 ++
> > >  tests/ref/fate/filter-pixfmts-vflip  |  4 ++
> > >  18 files changed, 180 insertions(+), 15 deletions(-)
> > >  create mode 100644 tests/ref/fate/filter-pixdesc-gbrapf32be
> > >  create mode 100644 tests/ref/fate/filter-pixdesc-gbrapf32le
> > >  create mode 100644 tests/ref/fate/filter-pixdesc-gbrpf32be
> > >  create mode 100644 tests/ref/fate/filter-pixdesc-gbrpf32le
> >
> > Fails on qemu MIPS
> >
> > --- src/tests/ref/fate/filter-pixfmts-scale 2020-04-29
> 22:18:07.326122866 +0200
> > +++ tests/data/fate/filter-pixfmts-scale2020-04-29
> 23:06:16.167950113 +0200
> > @@ -25,8 +25,8 @@
> >  gbrap12le   bb1ba1c157717db3dd612a76d38a018e
> >  gbrap16be   c72b935a6e57a8e1c37bff08c2db55b1
> >  gbrap16le   13eb0e62b1ac9c1c86c81521eaefab5f
> > -gbrapf32be  e6abe67df7fdd5f5dc5db7d852e50954
> > -gbrapf32le  4d3043b206f7053f7d8d5672f430d680
> > +gbrapf32be  982d646dc5b2dc718c65fa2a439828f5
> > +gbrapf32le  f1ffa56441e29aab5e1fd982337bb8ac
> >  gbrpdc3387f925f972c61aae7eb23cdc19f0
> >  gbrp10be0277d4c3a8498d75e2783fb81379e481
> >  gbrp10lef3d70f8ab845c3c9b8f7452e4a6e285a
> > Test filter-pixfmts-scale failed. Look at
> tests/data/fate/filter-pixfmts-scale.err for details.
> > src/tests/Makefile:254: recipe for target 'fate-filter-pixfmts-scale'
> failed
> > make: *** [fate-filter-pixfmts-scale] Error 1
> > TESTh264-conformance-frext-pph422i5_panasonic_a
> > TESTh264-conformance-frext-pph422i6_panasonic_a
> > TESTh264-conformance-frext-pph422i7_panasonic_a
> > TESTh264-conformance-hcbp2_hhi_a
> > TESTh264-conformance-hcmp1_hhi_a
> >
> > I also think for float, tests based on comparission instead of checksums
> > would allow more use of floats in the computations which would
> > differ rounding wise between platforms
>
> and the 2 sws patches would otherwise be ok if they didnt break any tests
>
>
I was worried about the test with float, and tried to limiting the number
of float operations, but guess it's not enough.
I haven't looked yet, but is there anywhere you could point me to doing
a comparison based test?
I'll break the exr part out into a separate patch for later, and get the
sws stuff working first.

thanks for the review!


> Thanks
>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Freedom in capitalist society always remains about the same as it was in
> ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
> ___
> 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 2/2] avcodec/v4l2_context: Finish draining if V4L2_BUF_FLAG_LAST is set

2020-04-29 Thread Andriy Gelman
From: Andriy Gelman 

V4L2 api can indicate that flushing of the capture buffers is completed
by setting the V4L2_BUF_FLAG_LAST flag.
Use guards because the flag was only defined in Linux v4.2.

Reference:
linux/Documentation/media/uapi/v4l/dev-decoder.rst

"The client must continue to handle both queues independently,
 similarly to normal decode operation. This includes:
 ...
 - queuing and dequeuing CAPTURE buffers, until a buffer marked with
   the V4L2_BUF_FLAG_LAST flag is dequeued"

Signed-off-by: Andriy Gelman 
---
 libavcodec/v4l2_context.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
index f0ecc18ebd..da802405e4 100644
--- a/libavcodec/v4l2_context.c
+++ b/libavcodec/v4l2_context.c
@@ -400,6 +400,10 @@ dequeue:
 ctx->done = 1;
 return NULL;
 }
+#ifdef V4L2_BUF_FLAG_LAST
+if (buf.flags & V4L2_BUF_FLAG_LAST)
+ctx->done = 1;
+#endif
 }
 
 avbuf = >buffers[buf.index];
-- 
2.25.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 3/4] avcodec/svq1dec: Check that there is data left after the hader

2020-04-29 Thread Michael Niedermayer
On Mon, Feb 24, 2020 at 12:39:15AM +0100, Moritz Barsnick wrote:
> On Wed, Feb 19, 2020 at 00:59:18 +0100, Michael Niedermayer wrote:
> > Subject: [FFmpeg-devel] [PATCH 3/4] avcodec/svq1dec: Check that there is 
> > data left after the hader
> 
> Nit: hader -> header

will apply with that fixed

thx

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

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides


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/4] avcodec/txd: Check for input size against the header size.

2020-04-29 Thread Michael Niedermayer
On Wed, Feb 19, 2020 at 12:59:17AM +0100, Michael Niedermayer wrote:
> Fixes: Timeout (21sec -> 80ms)
> Fixes: 
> 20673/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TXD_fuzzer-5177453863763968
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/txd.c | 3 +++
>  1 file changed, 3 insertions(+)

will apply

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

Democracy is the form of government in which you can choose your dictator


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 1/2] avcodec/v4l2_context: Drop empty packet while draining

2020-04-29 Thread Andriy Gelman
From: Andriy Gelman 

v4l2_m2m devices may send an empty packet/frame while draining
to indicate that all capture buffers have been flushed.

Currently, the empty packet/frame is not handled correctly:
When encoding, the empty packet is forwarded to the muxer, usually
creating warnings.
When decoding, a reference to the memory is created anyway.. Since in
the past this memory contained a decoded frame, it results in an extra
frame being decoded.

This commit discards the empty packet/frame.

References:
linux/Documentation/media/uapi/v4l/dev-decoder.rst:

"The last buffer may be empty (with :c:type:`v4l2_buffer` bytesused = 0)
 and in that case it must be ignored by the client, as it does not
 contain a decoded frame."

linux/Documentation/media/uapi/media/v4l/vidioc-encoder-cmd.rst:

"...This buffer may be empty, indicated by the
 driver setting the ``bytesused`` field to 0."

Signed-off-by: Andriy Gelman 
---
 libavcodec/v4l2_context.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
index 6c2db5c849..f0ecc18ebd 100644
--- a/libavcodec/v4l2_context.c
+++ b/libavcodec/v4l2_context.c
@@ -393,6 +393,15 @@ dequeue:
 return NULL;
 }
 
+if (ctx_to_m2mctx(ctx)->draining && !V4L2_TYPE_IS_OUTPUT(ctx->type)) {
+int bytesused = V4L2_TYPE_IS_MULTIPLANAR(buf.type) ?
+buf.m.planes[0].bytesused : buf.bytesused;
+if (bytesused == 0) {
+ctx->done = 1;
+return NULL;
+}
+}
+
 avbuf = >buffers[buf.index];
 avbuf->status = V4L2BUF_AVAILABLE;
 avbuf->buf = buf;
-- 
2.25.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 2/3] libswscale: add output support for AV_PIX_FMT_GBRAPF32

2020-04-29 Thread Michael Niedermayer
On Wed, Apr 29, 2020 at 11:19:56PM +0200, Michael Niedermayer wrote:
> On Tue, Apr 28, 2020 at 08:02:34PM -0700, mindm...@gmail.com wrote:
> > From: Mark Reid 
> > 
> > ---
> >  libswscale/output.c  | 82 
> >  libswscale/slice.c   | 28 
> >  libswscale/swscale_unscaled.c| 33 ++
> >  libswscale/utils.c   |  8 +--
> >  tests/ref/fate/filter-pixdesc-gbrapf32be |  1 +
> >  tests/ref/fate/filter-pixdesc-gbrapf32le |  1 +
> >  tests/ref/fate/filter-pixdesc-gbrpf32be  |  1 +
> >  tests/ref/fate/filter-pixdesc-gbrpf32le  |  1 +
> >  tests/ref/fate/filter-pixfmts-copy   |  4 ++
> >  tests/ref/fate/filter-pixfmts-crop   |  4 ++
> >  tests/ref/fate/filter-pixfmts-field  |  4 ++
> >  tests/ref/fate/filter-pixfmts-fieldorder |  4 ++
> >  tests/ref/fate/filter-pixfmts-hflip  |  4 ++
> >  tests/ref/fate/filter-pixfmts-il |  4 ++
> >  tests/ref/fate/filter-pixfmts-null   |  4 ++
> >  tests/ref/fate/filter-pixfmts-scale  |  4 ++
> >  tests/ref/fate/filter-pixfmts-transpose  |  4 ++
> >  tests/ref/fate/filter-pixfmts-vflip  |  4 ++
> >  18 files changed, 180 insertions(+), 15 deletions(-)
> >  create mode 100644 tests/ref/fate/filter-pixdesc-gbrapf32be
> >  create mode 100644 tests/ref/fate/filter-pixdesc-gbrapf32le
> >  create mode 100644 tests/ref/fate/filter-pixdesc-gbrpf32be
> >  create mode 100644 tests/ref/fate/filter-pixdesc-gbrpf32le
> 
> Fails on qemu MIPS
> 
> --- src/tests/ref/fate/filter-pixfmts-scale 2020-04-29 22:18:07.326122866 
> +0200
> +++ tests/data/fate/filter-pixfmts-scale2020-04-29 23:06:16.167950113 
> +0200
> @@ -25,8 +25,8 @@
>  gbrap12le   bb1ba1c157717db3dd612a76d38a018e
>  gbrap16be   c72b935a6e57a8e1c37bff08c2db55b1
>  gbrap16le   13eb0e62b1ac9c1c86c81521eaefab5f
> -gbrapf32be  e6abe67df7fdd5f5dc5db7d852e50954
> -gbrapf32le  4d3043b206f7053f7d8d5672f430d680
> +gbrapf32be  982d646dc5b2dc718c65fa2a439828f5
> +gbrapf32le  f1ffa56441e29aab5e1fd982337bb8ac
>  gbrpdc3387f925f972c61aae7eb23cdc19f0
>  gbrp10be0277d4c3a8498d75e2783fb81379e481
>  gbrp10lef3d70f8ab845c3c9b8f7452e4a6e285a
> Test filter-pixfmts-scale failed. Look at 
> tests/data/fate/filter-pixfmts-scale.err for details.
> src/tests/Makefile:254: recipe for target 'fate-filter-pixfmts-scale' failed
> make: *** [fate-filter-pixfmts-scale] Error 1
> TESTh264-conformance-frext-pph422i5_panasonic_a
> TESTh264-conformance-frext-pph422i6_panasonic_a
> TESTh264-conformance-frext-pph422i7_panasonic_a
> TESTh264-conformance-hcbp2_hhi_a
> TESTh264-conformance-hcmp1_hhi_a
> 
> I also think for float, tests based on comparission instead of checksums
> would allow more use of floats in the computations which would
> differ rounding wise between platforms

and the 2 sws patches would otherwise be ok if they didnt break any tests

Thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin


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] libswscale: add output support for AV_PIX_FMT_GBRAPF32

2020-04-29 Thread Michael Niedermayer
On Tue, Apr 28, 2020 at 08:02:34PM -0700, mindm...@gmail.com wrote:
> From: Mark Reid 
> 
> ---
>  libswscale/output.c  | 82 
>  libswscale/slice.c   | 28 
>  libswscale/swscale_unscaled.c| 33 ++
>  libswscale/utils.c   |  8 +--
>  tests/ref/fate/filter-pixdesc-gbrapf32be |  1 +
>  tests/ref/fate/filter-pixdesc-gbrapf32le |  1 +
>  tests/ref/fate/filter-pixdesc-gbrpf32be  |  1 +
>  tests/ref/fate/filter-pixdesc-gbrpf32le  |  1 +
>  tests/ref/fate/filter-pixfmts-copy   |  4 ++
>  tests/ref/fate/filter-pixfmts-crop   |  4 ++
>  tests/ref/fate/filter-pixfmts-field  |  4 ++
>  tests/ref/fate/filter-pixfmts-fieldorder |  4 ++
>  tests/ref/fate/filter-pixfmts-hflip  |  4 ++
>  tests/ref/fate/filter-pixfmts-il |  4 ++
>  tests/ref/fate/filter-pixfmts-null   |  4 ++
>  tests/ref/fate/filter-pixfmts-scale  |  4 ++
>  tests/ref/fate/filter-pixfmts-transpose  |  4 ++
>  tests/ref/fate/filter-pixfmts-vflip  |  4 ++
>  18 files changed, 180 insertions(+), 15 deletions(-)
>  create mode 100644 tests/ref/fate/filter-pixdesc-gbrapf32be
>  create mode 100644 tests/ref/fate/filter-pixdesc-gbrapf32le
>  create mode 100644 tests/ref/fate/filter-pixdesc-gbrpf32be
>  create mode 100644 tests/ref/fate/filter-pixdesc-gbrpf32le

Fails on qemu MIPS

--- src/tests/ref/fate/filter-pixfmts-scale 2020-04-29 22:18:07.326122866 
+0200
+++ tests/data/fate/filter-pixfmts-scale2020-04-29 23:06:16.167950113 
+0200
@@ -25,8 +25,8 @@
 gbrap12le   bb1ba1c157717db3dd612a76d38a018e
 gbrap16be   c72b935a6e57a8e1c37bff08c2db55b1
 gbrap16le   13eb0e62b1ac9c1c86c81521eaefab5f
-gbrapf32be  e6abe67df7fdd5f5dc5db7d852e50954
-gbrapf32le  4d3043b206f7053f7d8d5672f430d680
+gbrapf32be  982d646dc5b2dc718c65fa2a439828f5
+gbrapf32le  f1ffa56441e29aab5e1fd982337bb8ac
 gbrpdc3387f925f972c61aae7eb23cdc19f0
 gbrp10be0277d4c3a8498d75e2783fb81379e481
 gbrp10lef3d70f8ab845c3c9b8f7452e4a6e285a
Test filter-pixfmts-scale failed. Look at 
tests/data/fate/filter-pixfmts-scale.err for details.
src/tests/Makefile:254: recipe for target 'fate-filter-pixfmts-scale' failed
make: *** [fate-filter-pixfmts-scale] Error 1
TESTh264-conformance-frext-pph422i5_panasonic_a
TESTh264-conformance-frext-pph422i6_panasonic_a
TESTh264-conformance-frext-pph422i7_panasonic_a
TESTh264-conformance-hcbp2_hhi_a
TESTh264-conformance-hcmp1_hhi_a

I also think for float, tests based on comparission instead of checksums
would allow more use of floats in the computations which would
differ rounding wise between platforms


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

No great genius has ever existed without some touch of madness. -- 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 0/3] Patch set to delay output live stream

2020-04-29 Thread Marton Balint



On Thu, 30 Apr 2020, Tao Zhang wrote:


Marton Balint  于2020年4月30日周四 上午12:03写道:




On Wed, 29 Apr 2020, leozhang wrote:

> In some applications, it is required to add delay to live streaming.

In what applications? And if you do this, why not run

sleep 20; ffmpeg 

In live streaming applications, someone wouldn't want broadcast what's
comming next immediately.
Sleep 20 then ffmpeg is not ok, because the stream is still
broadcasting immediately, and lost 20 seconds signal.


So you want to buffer 20 seconds of input, and then start the output?



I don't see how this is useful at all.

And what is -paced? What it is used for? Isn't it the same as using ffmpeg
-re? You really should better explain your use case.

-re read the input, -paced write the output.


But why do you want to delay every output packet?



Regards,
Marton

> For example, you can add 20 seconds to rtmp stream with below command:
> ffmpeg -i your_input_stream_address -c copy -map 0:a -map 0:v -f fifo -paced 
1 -queue_size 600
> -output_delay 2000 -fifo_format flv 
rtmp://example.com/live/delayed_stream_name
>
> leozhang (3):
>  avformat/fifo: add option to delay output
>  avformat/fifo: add option to write packets in paced way
>  doc/muxers: add command example how to delay output live stream
>
> doc/muxers.texi| 17 +
> libavformat/fifo.c | 26 ++
> 2 files changed, 43 insertions(+)
>
> --
> 1.8.3.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".
___
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 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 0/3] Patch set to delay output live stream

2020-04-29 Thread Tao Zhang
Marton Balint  于2020年4月30日周四 上午12:03写道:
>
>
>
> On Wed, 29 Apr 2020, leozhang wrote:
>
> > In some applications, it is required to add delay to live streaming.
>
> In what applications? And if you do this, why not run
>
> sleep 20; ffmpeg 
In live streaming applications, someone wouldn't want broadcast what's
comming next immediately.
Sleep 20 then ffmpeg is not ok, because the stream is still
broadcasting immediately, and lost 20 seconds signal.
>
> I don't see how this is useful at all.
>
> And what is -paced? What it is used for? Isn't it the same as using ffmpeg
> -re? You really should better explain your use case.
-re read the input, -paced write the output.
>
> Regards,
> Marton
>
> > For example, you can add 20 seconds to rtmp stream with below command:
> > ffmpeg -i your_input_stream_address -c copy -map 0:a -map 0:v -f fifo 
> > -paced 1 -queue_size 600
> > -output_delay 2000 -fifo_format flv 
> > rtmp://example.com/live/delayed_stream_name
> >
> > leozhang (3):
> >  avformat/fifo: add option to delay output
> >  avformat/fifo: add option to write packets in paced way
> >  doc/muxers: add command example how to delay output live stream
> >
> > doc/muxers.texi| 17 +
> > libavformat/fifo.c | 26 ++
> > 2 files changed, 43 insertions(+)
> >
> > --
> > 1.8.3.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".
> ___
> 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] avformat/utils: change the duration to int64_t for update_initial_durations

2020-04-29 Thread Michael Niedermayer
On Wed, Apr 29, 2020 at 04:01:29PM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavformat/utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

LGTM

thx

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

If you fake or manipulate statistics in a paper in physics you will never
get a job again.
If you fake or manipulate statistics in a paper in medicin you will get
a job for life at the pharma industry.


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] tools: fix const specifier for AVInputFormat

2020-04-29 Thread Michael Niedermayer
On Wed, Apr 29, 2020 at 12:00:23PM +0100, Josh de Kock wrote:
> Signed-off-by: Josh de Kock 
> ---
>  tools/probetest.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
>  Small fix for compiler warning caused by my earlier change.

LGTM

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] ppc: configure: Support Power ISA 3.0

2020-04-29 Thread Carl Eugen Hoyos
Am Mi., 29. Apr. 2020 um 18:27 Uhr schrieb Trung Le :
>
> POWER 9 supports VSX-3

Shouldn't --disable-power8 also disable power9 (assuming there is a difference)?

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".

Re: [FFmpeg-devel] [PATCH 1/5] avformat/dashenc: fix invalid pointer access if avio_get_dyn_buf failed

2020-04-29 Thread Nicolas George
lance.lmw...@gmail.com (12020-04-29):
> Thanks, I catch your point now. Most of existing code haven't return ERROR, 
> so I
> choose the same way to process it. If you think it's not OK, we'll change more
> code I think.

Maybe the other code needs to be fixed the same way. Maybe the other
code needs not return an error and this one does. Maybe your change is
actually valid.

You cannot know unless you first understand what the code does and what
it is supposed to do. You cannot program by imitation, it does not work.

And you have to test your changes: run a ffmpeg command line, make sure
the new code is triggered, and check the output file, compare it with
when the change is not triggered. If they are both correct, good. If one
is corrupted, then you know your change was bogus. And if you did not
test, then your change cannot be accepted.

Ideally we can trust regular contributors to have tested their changes
and run FATE before submitting patches.

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] avformat/hlsenc: add support for microseconds since epoch based sequence number

2020-04-29 Thread Marton Balint



On Sat, 18 Apr 2020, Marton Balint wrote:


Sequence numbers of segments should be unique, if an encoder is using shorter
than 1 second segments and it is restarted, then future segments will be using
already used sequence numbers if initial sequence number is based on the number
of seconds since epoch and not microseconds.


Ping.

Thanks,
Marton



Signed-off-by: Marton Balint 
---
doc/muxers.texi   |  3 +++
libavformat/hlsenc.c  | 13 ++---
libavformat/version.h |  2 +-
3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index e5b8debcb3..cf1c9a8622 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -640,6 +640,9 @@ Set the starting sequence numbers according to 
@var{start_number} option value.
@item epoch
The start number will be the seconds since epoch (1970-01-01 00:00:00)

+@item epoch_us
+The start number will be the microseconds since epoch (1970-01-01 00:00:00)
+
@item datetime
The start number will be based on the current date/time as mmddHHMMSS. e.g. 
20161231235759.

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index d75684741f..008a3f3947 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -41,6 +41,7 @@
#include "libavutil/random_seed.h"
#include "libavutil/opt.h"
#include "libavutil/log.h"
+#include "libavutil/time.h"
#include "libavutil/time_internal.h"

#include "avformat.h"
@@ -56,6 +57,8 @@ typedef enum {
HLS_START_SEQUENCE_AS_START_NUMBER = 0,
HLS_START_SEQUENCE_AS_SECONDS_SINCE_EPOCH = 1,
HLS_START_SEQUENCE_AS_FORMATTED_DATETIME = 2,  // MMDDhhmmss
+HLS_START_SEQUENCE_AS_MICROSECONDS_SINCE_EPOCH = 3,
+HLS_START_SEQUENCE_LAST, // unused
} StartSequenceSourceType;

typedef enum {
@@ -2788,9 +2791,12 @@ static int hls_init(AVFormatContext *s)
pattern = "%d.m4s";
}
if ((hls->start_sequence_source_type == 
HLS_START_SEQUENCE_AS_SECONDS_SINCE_EPOCH) ||
+(hls->start_sequence_source_type == 
HLS_START_SEQUENCE_AS_MICROSECONDS_SINCE_EPOCH) ||
(hls->start_sequence_source_type == 
HLS_START_SEQUENCE_AS_FORMATTED_DATETIME)) {
-time_t t = time(NULL); // we will need it in either case
-if (hls->start_sequence_source_type == 
HLS_START_SEQUENCE_AS_SECONDS_SINCE_EPOCH) {
+time_t t = time(NULL);
+if (hls->start_sequence_source_type == 
HLS_START_SEQUENCE_AS_MICROSECONDS_SINCE_EPOCH) {
+hls->start_sequence = av_gettime();
+} else if (hls->start_sequence_source_type == 
HLS_START_SEQUENCE_AS_SECONDS_SINCE_EPOCH) {
hls->start_sequence = (int64_t)t;
} else if (hls->start_sequence_source_type == 
HLS_START_SEQUENCE_AS_FORMATTED_DATETIME) {
char b[15];
@@ -3083,9 +3089,10 @@ static const AVOption options[] = {
{"event", "EVENT playlist", 0, AV_OPT_TYPE_CONST, {.i64 = PLAYLIST_TYPE_EVENT }, 
INT_MIN, INT_MAX, E, "pl_type" },
{"vod", "VOD playlist", 0, AV_OPT_TYPE_CONST, {.i64 = PLAYLIST_TYPE_VOD }, INT_MIN, 
INT_MAX, E, "pl_type" },
{"method", "set the HTTP method(default: PUT)", OFFSET(method), 
AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,E},
-{"hls_start_number_source", "set source of first number in sequence", 
OFFSET(start_sequence_source_type), AV_OPT_TYPE_INT, {.i64 = HLS_START_SEQUENCE_AS_START_NUMBER }, 0, 
HLS_START_SEQUENCE_AS_FORMATTED_DATETIME, E, "start_sequence_source_type" },
+{"hls_start_number_source", "set source of first number in sequence", 
OFFSET(start_sequence_source_type), AV_OPT_TYPE_INT, {.i64 = HLS_START_SEQUENCE_AS_START_NUMBER }, 0, 
HLS_START_SEQUENCE_LAST-1, E, "start_sequence_source_type" },
{"generic", "start_number value (default)", 0, AV_OPT_TYPE_CONST, {.i64 = 
HLS_START_SEQUENCE_AS_START_NUMBER }, INT_MIN, INT_MAX, E, "start_sequence_source_type" },
{"epoch", "seconds since epoch", 0, AV_OPT_TYPE_CONST, {.i64 = 
HLS_START_SEQUENCE_AS_SECONDS_SINCE_EPOCH }, INT_MIN, INT_MAX, E, "start_sequence_source_type" },
+{"epoch_us", "microseconds since epoch", 0, AV_OPT_TYPE_CONST, {.i64 = 
HLS_START_SEQUENCE_AS_MICROSECONDS_SINCE_EPOCH }, INT_MIN, INT_MAX, E, "start_sequence_source_type" 
},
{"datetime", "current datetime as MMDDhhmmss", 0, AV_OPT_TYPE_CONST, {.i64 = 
HLS_START_SEQUENCE_AS_FORMATTED_DATETIME }, INT_MIN, INT_MAX, E, "start_sequence_source_type" },
{"http_user_agent", "override User-Agent field in HTTP header", 
OFFSET(user_agent), AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,E},
{"var_stream_map", "Variant stream map string", OFFSET(var_stream_map), 
AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,E},
diff --git a/libavformat/version.h b/libavformat/version.h
index 18c2f5fec2..719cda6b98 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -33,7 +33,7 @@
// Also please add any ticket numbers that you believe might be affected here
#define LIBAVFORMAT_VERSION_MAJOR  58
#define LIBAVFORMAT_VERSION_MINOR  42
-#define LIBAVFORMAT_VERSION_MICRO 100
+#define LIBAVFORMAT_VERSION_MICRO 

[FFmpeg-devel] [PATCH] ppc: configure: Support Power ISA 3.0

2020-04-29 Thread Trung Le
POWER 9 supports VSX-3

Signed-off-by: Trung Le 
---
 configure | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 080d93a129..33045f5989 100755
--- a/configure
+++ b/configure
@@ -419,6 +419,7 @@ Optimization options (experts only):
   --disable-altivecdisable AltiVec optimizations
   --disable-vsxdisable VSX optimizations
   --disable-power8 disable POWER8 optimizations
+  --disable-power9 disable POWER9 optimizations
   --disable-amd3dnow   disable 3DNow! optimizations
   --disable-amd3dnowextdisable 3DNow! extended optimizations
   --disable-mmxdisable MMX optimizations
@@ -2050,6 +2051,7 @@ ARCH_EXT_LIST_PPC="
 dcbzl
 ldbrx
 power8
+power9
 ppc4xx
 vsx
 "
@@ -2538,6 +2540,7 @@ ldbrx_deps="ppc"
 ppc4xx_deps="ppc"
 vsx_deps="altivec"
 power8_deps="vsx"
+power9_deps="vsx"
 
 loongson2_deps="mips"
 loongson3_deps="mips"
@@ -5125,7 +5128,7 @@ elif enabled ppc; then
 cpuflags="-mcpu=$cpu"
 disable vsx
 ;;
-power[7-8]*)
+power[7-9]*)
 cpuflags="-mcpu=$cpu"
 ;;
 cell)
@@ -5896,6 +5899,10 @@ elif enabled ppc; then
 check_cpp_condition power8 "altivec.h" "defined(_ARCH_PWR8)"
 fi
 
+if enabled power9; then
+check_cpp_condition power9 "altivec.h" "defined(_ARCH_PWR9)"
+fi
+
 elif enabled x86; then
 
 check_builtin rdtscintrin.h   "__rdtsc()"
@@ -7262,6 +7269,7 @@ if enabled ppc; then
 echo "AltiVec enabled   ${altivec-no}"
 echo "VSX enabled   ${vsx-no}"
 echo "POWER8 enabled${power8-no}"
+echo "POWER9 enabled${power9-no}"
 echo "PPC 4xx optimizations ${ppc4xx-no}"
 echo "dcbzl available   ${dcbzl-no}"
 fi
-- 
2.26.2

___
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] avutil/opt: only skip evaluation for rational options

2020-04-29 Thread Marton Balint



On Sat, 18 Apr 2020, Marton Balint wrote:


Fixes problems when non-rational options were set using rational expressions,
causing rounding errors and the option range limits not to be enforced
properly.

ffmpeg -f lavfi -i "sine=r=96000/2"

This caused an assertion failure with assert level 2.

Signed-off-by: Marton Balint 
---
libavutil/opt.c | 14 --
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index bf2562737b..b792dec01c 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -229,13 +229,15 @@ static int set_string(void *obj, const AVOption *o, const 
char *val, uint8_t **d
static int set_string_number(void *obj, void *target_obj, const AVOption *o, 
const char *val, void *dst)
{
int ret = 0;
-int num, den;
-char c;

-if (sscanf(val, "%d%*1[:/]%d%c", , , ) == 2) {
-if ((ret = write_number(obj, o, dst, 1, den, num)) >= 0)
-return ret;
-ret = 0;
+if (o->type == AV_OPT_TYPE_RATIONAL || o->type == AV_OPT_TYPE_VIDEO_RATE) {
+int num, den;
+char c;
+if (sscanf(val, "%d%*1[:/]%d%c", , , ) == 2) {
+if ((ret = write_number(obj, o, dst, 1, den, num)) >= 0)
+return ret;
+ret = 0;
+}
}


Ping, will apply soon.

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".

[FFmpeg-devel] [PATCH V4 0/1] ffprobe add closed caption output to stream info

2020-04-29 Thread vectronic
ensure closed caption info which is visible in default stream dump is also
available in results when -show_streams is used and update test references
for closed_caption output in ffprobe stream results

changes from last version:

- ffprobe modifications are correctly within existing FF_API_LAVF_AVCTX checks
- added ffprobe xsd element is boolean

vectronic (1):
  ensure closed caption info which is visible in default stream dump is
also available in results when -show_streams is used

 doc/ffprobe.xsd   | 1 +
 fftools/ffprobe.c | 2 ++
 tests/ref/fate/concat-demuxer-extended-lavf-mxf   | 2 +-
 tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10   | 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf| 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10| 2 +-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 2 +-
 tests/ref/fate/ffprobe_compact| 4 ++--
 tests/ref/fate/ffprobe_csv| 4 ++--
 tests/ref/fate/ffprobe_default| 2 ++
 tests/ref/fate/ffprobe_flat   | 2 ++
 tests/ref/fate/ffprobe_ini| 2 ++
 tests/ref/fate/ffprobe_json   | 2 ++
 tests/ref/fate/ffprobe_xml| 4 ++--
 tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov | 1 +
 tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov | 1 +
 tests/ref/fate/mov-zombie | 2 +-
 tests/ref/fate/mxf-probe-d10  | 1 +
 tests/ref/fate/mxf-probe-dnxhd| 1 +
 tests/ref/fate/mxf-probe-dv25 | 1 +
 20 files changed, 28 insertions(+), 12 deletions(-)

-- 
2.24.2 (Apple Git-127)

___
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/1] ensure closed caption info which is visible in default stream dump is also available in results when -show_streams is used

2020-04-29 Thread vectronic
Signed-off-by: vectronic 
---
 doc/ffprobe.xsd   | 1 +
 fftools/ffprobe.c | 2 ++
 tests/ref/fate/concat-demuxer-extended-lavf-mxf   | 2 +-
 tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10   | 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf| 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10| 2 +-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 2 +-
 tests/ref/fate/ffprobe_compact| 4 ++--
 tests/ref/fate/ffprobe_csv| 4 ++--
 tests/ref/fate/ffprobe_default| 2 ++
 tests/ref/fate/ffprobe_flat   | 2 ++
 tests/ref/fate/ffprobe_ini| 2 ++
 tests/ref/fate/ffprobe_json   | 2 ++
 tests/ref/fate/ffprobe_xml| 4 ++--
 tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov | 1 +
 tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov | 1 +
 tests/ref/fate/mov-zombie | 2 +-
 tests/ref/fate/mxf-probe-d10  | 1 +
 tests/ref/fate/mxf-probe-dnxhd| 1 +
 tests/ref/fate/mxf-probe-dv25 | 1 +
 20 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/doc/ffprobe.xsd b/doc/ffprobe.xsd
index 97dc67def6..71cbd23ec6 100644
--- a/doc/ffprobe.xsd
+++ b/doc/ffprobe.xsd
@@ -226,6 +226,7 @@
   
   
   
+  
   
   
   
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 840fcb71e2..5515e1b31b 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2547,6 +2547,7 @@ static int show_stream(WriterContext *w, AVFormatContext 
*fmt_ctx, int stream_id
 if (dec_ctx) {
 print_int("coded_width",  dec_ctx->coded_width);
 print_int("coded_height", dec_ctx->coded_height);
+print_int("closed_captions", !!(dec_ctx->properties & 
FF_CODEC_PROPERTY_CLOSED_CAPTIONS));
 }
 #endif
 print_int("has_b_frames", par->video_delay);
@@ -2951,6 +2952,7 @@ static int open_input_file(InputFile *ifile, const char 
*filename,
 ist->dec_ctx->pkt_timebase = stream->time_base;
 ist->dec_ctx->framerate = stream->avg_frame_rate;
 #if FF_API_LAVF_AVCTX
+ist->dec_ctx->properties = stream->codec->properties;
 ist->dec_ctx->coded_width = stream->codec->coded_width;
 ist->dec_ctx->coded_height = stream->codec->coded_height;
 #endif
diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf 
b/tests/ref/fate/concat-demuxer-extended-lavf-mxf
index 2fb5fce4b1..e49915e407 100644
--- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf
+++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf
@@ -1 +1 @@
-a6fb9c37dc71cb43eb9664a8ae9f1c66 
*tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe
+861b9c23587d0a09caa78c3651faf5a0 
*tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe
diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 
b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
index 60d729b3da..e3e76f217a 100644
--- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
+++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
@@ -1 +1 @@
-cb7c8eac6f8917e39658e1fa4a250da8 
*tests/data/fate/concat-demuxer-extended-lavf-mxf_d10.ffprobe
+d66177ea3922692bc91cd0f8aa907650 
*tests/data/fate/concat-demuxer-extended-lavf-mxf_d10.ffprobe
diff --git a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf 
b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
index d18e35b7ba..a590f6f24b 100644
--- a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
+++ b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
@@ -120,5 +120,5 @@ 
audio|1|65280|1.36|65280|1.36|1920|0.04|N/A|N/A|3840|207872|K_|1
 Strings Metadata
 video|0|37|1.48|34|1.36|1|0.04|N/A|N/A|24786|212480|K_|1
 Strings Metadata
-0|mpeg2video|4|video|1/25|[0][0][0][0]|0x|352|288|0|0|1|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|N/A|1|N/A|25/1|25/1|1/25|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|51|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
+0|mpeg2video|4|video|1/25|[0][0][0][0]|0x|352|288|0|0|0|1|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|N/A|1|N/A|25/1|25/1|1/25|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|51|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
 
1|pcm_s16le|unknown|audio|1/48000|[0][0][0][0]|0x|s16|48000|1|unknown|16|N/A|0/0|0/0|1/48000|0|0.00|N/A|N/A|768000|N/A|N/A|N/A|N/A|50|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
diff --git a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10 
b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10
index e83d1bf847..79ce1e2306 100644
--- 

Re: [FFmpeg-devel] [PATCH 0/3] Patch set to delay output live stream

2020-04-29 Thread Marton Balint



On Wed, 29 Apr 2020, leozhang wrote:


In some applications, it is required to add delay to live streaming.


In what applications? And if you do this, why not run

sleep 20; ffmpeg 

I don't see how this is useful at all.

And what is -paced? What it is used for? Isn't it the same as using ffmpeg 
-re? You really should better explain your use case.


Regards,
Marton


For example, you can add 20 seconds to rtmp stream with below command:
ffmpeg -i your_input_stream_address -c copy -map 0:a -map 0:v -f fifo -paced 1 
-queue_size 600
-output_delay 2000 -fifo_format flv 
rtmp://example.com/live/delayed_stream_name

leozhang (3):
 avformat/fifo: add option to delay output
 avformat/fifo: add option to write packets in paced way
 doc/muxers: add command example how to delay output live stream

doc/muxers.texi| 17 +
libavformat/fifo.c | 26 ++
2 files changed, 43 insertions(+)

--
1.8.3.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".

___
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/5] avformat/dashenc: fix invalid pointer access if avio_get_dyn_buf failed

2020-04-29 Thread lance . lmwang
On Wed, Apr 29, 2020 at 05:39:36PM +0200, Nicolas George wrote:
> Limin Wang (12020-04-29):
> > yes, avio_write can process zero len with NULL pointer, but here it'll use 
> > buf+written_len, so
> > it's invalid access I think. So what's the broken? Maybe I haven't catch 
> > your point.
> 
> What's broken is that the code is supposed to do something, and with
> your change it does not do it.
> 
> These changes are therefore not acceptable.
> 
> The invalid access need to be fixed, but they need to be fixed properly:
> since they correspond to a memory allocation failure, there should be
> some kind of AVERROR(ENOMEM) in there.

Thanks, I catch your point now. Most of existing code haven't return ERROR, so I
choose the same way to process it. If you think it's not OK, we'll change more
code I think . Also some code weren't check the result, but for the len is 0 and
don't broken anything. But yes, the data isn't expected.

> 
> Regards,
> 
> -- 
>   Nicolas George



> ___
> 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".


-- 
Thanks,
Limin Wang
___
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/5] avformat/dashenc: fix invalid pointer access if avio_get_dyn_buf failed

2020-04-29 Thread Nicolas George
Limin Wang (12020-04-29):
> yes, avio_write can process zero len with NULL pointer, but here it'll use 
> buf+written_len, so
> it's invalid access I think. So what's the broken? Maybe I haven't catch your 
> point.

What's broken is that the code is supposed to do something, and with
your change it does not do it.

These changes are therefore not acceptable.

The invalid access need to be fixed, but they need to be fixed properly:
since they correspond to a memory allocation failure, there should be
some kind of AVERROR(ENOMEM) in there.

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/5] avformat/dashenc: fix invalid pointer access if avio_get_dyn_buf failed

2020-04-29 Thread Limin Wang
On Wed, Apr 29, 2020 at 05:18:18PM +0200, Nicolas George wrote:
> lance.lmw...@gmail.com (12020-04-29):
> > From: Limin Wang 
> > 
> > If an error occurs, avio_get_dyn_buf() will return 0 and buf is NULL, so 
> > it's necessary to check
> > the return value for the following code will access the buf pointer with 
> > index. In addition,
> > the buf len should be greater than written_len to avoid the buffer overflow 
> > access.
> > 
> > Signed-off-by: Limin Wang 
> > ---
> >  libavformat/dashenc.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> And if the allocation fails, the data is silently discarded. Seems
> broken. Did you test your change?

yes, avio_write can process zero len with NULL pointer, but here it'll use 
buf+written_len, so
it's invalid access I think. So what's the broken? Maybe I haven't catch your 
point.

> 
> Regards,
> 
> -- 
>   Nicolas George



-- 
Thanks,
Limin Wang
___
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] avformat/srtenc: split write time into function for better readability

2020-04-29 Thread Nicolas George
Limin Wang (12020-04-29):
> Sorry, the idea is coming from webvtt_write_time()

Well, I do not like Matthew Heaney's style. Everybody can use their
preferred style in their own files, of course.

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 2/5] avformat/matroskaenc: fix invalid pointer access if avio_get_dyn_buf failed

2020-04-29 Thread Nicolas George
lance.lmw...@gmail.com (12020-04-29):
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavformat/matroskaenc.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index 784973a951..f0474da44f 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -374,9 +374,12 @@ static void end_ebml_master_crc32(AVIOContext *pb, 
> AVIOContext **dyn_cp,
>  put_ebml_length(pb, size, length_size);
>  if (mkv->write_crc) {
>  skip = 6; /* Skip reserved 6-byte long void element from the dynamic 
> buffer. */
> +if (size > skip) {
>  AV_WL32(crc, av_crc(av_crc_get_table(AV_CRC_32_IEEE_LE), UINT32_MAX, 
> buf + skip, size - skip) ^ UINT32_MAX);
>  put_ebml_binary(pb, EBML_ID_CRC32, crc, sizeof(crc));
> +}
>  }
> +if (size > skip)

Same as previous: just skipping the work when the buffer is not big
enough seems broken.

>  avio_write(pb, buf + skip, size - skip);
>  
>  if (keep_buffer) {

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 4/5] avformat/movenc: check the return value of avio_get_dyn_buf()

2020-04-29 Thread Nicolas George
lance.lmw...@gmail.com (12020-04-29):
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavformat/movenc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index 32e8109268..1a97e7c883 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -5251,10 +5251,11 @@ static int mov_flush_fragment(AVFormatContext *s, int 
> force)
>  return 0;
>  }
>  
> -buf_size = avio_get_dyn_buf(mov->mdat_buf, );
> +if ((buf_size = avio_get_dyn_buf(mov->mdat_buf, )) > 0) {
>  avio_wb32(s->pb, buf_size + 8);
>  ffio_wfourcc(s->pb, "mdat");
>  avio_write(s->pb, buf, buf_size);
> +}
>  ffio_free_dyn_buf(>mdat_buf);
>  
>  if (mov->flags & FF_MOV_FLAG_GLOBAL_SIDX)

This one seems broken like the other two.

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/5] avformat/dashenc: fix invalid pointer access if avio_get_dyn_buf failed

2020-04-29 Thread Nicolas George
lance.lmw...@gmail.com (12020-04-29):
> From: Limin Wang 
> 
> If an error occurs, avio_get_dyn_buf() will return 0 and buf is NULL, so it's 
> necessary to check
> the return value for the following code will access the buf pointer with 
> index. In addition,
> the buf len should be greater than written_len to avoid the buffer overflow 
> access.
> 
> Signed-off-by: Limin Wang 
> ---
>  libavformat/dashenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

And if the allocation fails, the data is silently discarded. Seems
broken. Did you test your change?

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".

[FFmpeg-devel] [PATCH 4/5] avformat/movenc: check the return value of avio_get_dyn_buf()

2020-04-29 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavformat/movenc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 32e8109268..1a97e7c883 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5251,10 +5251,11 @@ static int mov_flush_fragment(AVFormatContext *s, int 
force)
 return 0;
 }
 
-buf_size = avio_get_dyn_buf(mov->mdat_buf, );
+if ((buf_size = avio_get_dyn_buf(mov->mdat_buf, )) > 0) {
 avio_wb32(s->pb, buf_size + 8);
 ffio_wfourcc(s->pb, "mdat");
 avio_write(s->pb, buf, buf_size);
+}
 ffio_free_dyn_buf(>mdat_buf);
 
 if (mov->flags & FF_MOV_FLAG_GLOBAL_SIDX)
-- 
2.21.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] [PATCH 5/5] avformat/movenc: reindent after the previous commit

2020-04-29 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavformat/movenc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 1a97e7c883..ad04143f14 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5252,9 +5252,9 @@ static int mov_flush_fragment(AVFormatContext *s, int 
force)
 }
 
 if ((buf_size = avio_get_dyn_buf(mov->mdat_buf, )) > 0) {
-avio_wb32(s->pb, buf_size + 8);
-ffio_wfourcc(s->pb, "mdat");
-avio_write(s->pb, buf, buf_size);
+avio_wb32(s->pb, buf_size + 8);
+ffio_wfourcc(s->pb, "mdat");
+avio_write(s->pb, buf, buf_size);
 }
 ffio_free_dyn_buf(>mdat_buf);
 
-- 
2.21.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] [PATCH 1/5] avformat/dashenc: fix invalid pointer access if avio_get_dyn_buf failed

2020-04-29 Thread lance . lmwang
From: Limin Wang 

If an error occurs, avio_get_dyn_buf() will return 0 and buf is NULL, so it's 
necessary to check
the return value for the following code will access the buf pointer with index. 
In addition,
the buf len should be greater than written_len to avoid the buffer overflow 
access.

Signed-off-by: Limin Wang 
---
 libavformat/dashenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 9f83785792..99fb7d67af 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -2260,7 +2260,7 @@ static int dash_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 uint8_t *buf = NULL;
 avio_flush(os->ctx->pb);
 len = avio_get_dyn_buf (os->ctx->pb, );
-if (os->out) {
+if (os->out && len > os->written_len) {
 avio_write(os->out, buf + os->written_len, len - os->written_len);
 avio_flush(os->out);
 }
-- 
2.21.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] [PATCH 2/5] avformat/matroskaenc: fix invalid pointer access if avio_get_dyn_buf failed

2020-04-29 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavformat/matroskaenc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 784973a951..f0474da44f 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -374,9 +374,12 @@ static void end_ebml_master_crc32(AVIOContext *pb, 
AVIOContext **dyn_cp,
 put_ebml_length(pb, size, length_size);
 if (mkv->write_crc) {
 skip = 6; /* Skip reserved 6-byte long void element from the dynamic 
buffer. */
+if (size > skip) {
 AV_WL32(crc, av_crc(av_crc_get_table(AV_CRC_32_IEEE_LE), UINT32_MAX, 
buf + skip, size - skip) ^ UINT32_MAX);
 put_ebml_binary(pb, EBML_ID_CRC32, crc, sizeof(crc));
+}
 }
+if (size > skip)
 avio_write(pb, buf + skip, size - skip);
 
 if (keep_buffer) {
-- 
2.21.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] [PATCH 3/5] avformat/matroskaenc: reindent after the previous commit

2020-04-29 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavformat/matroskaenc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index f0474da44f..41446c3825 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -375,12 +375,12 @@ static void end_ebml_master_crc32(AVIOContext *pb, 
AVIOContext **dyn_cp,
 if (mkv->write_crc) {
 skip = 6; /* Skip reserved 6-byte long void element from the dynamic 
buffer. */
 if (size > skip) {
-AV_WL32(crc, av_crc(av_crc_get_table(AV_CRC_32_IEEE_LE), UINT32_MAX, 
buf + skip, size - skip) ^ UINT32_MAX);
-put_ebml_binary(pb, EBML_ID_CRC32, crc, sizeof(crc));
+AV_WL32(crc, av_crc(av_crc_get_table(AV_CRC_32_IEEE_LE), 
UINT32_MAX, buf + skip, size - skip) ^ UINT32_MAX);
+put_ebml_binary(pb, EBML_ID_CRC32, crc, sizeof(crc));
 }
 }
 if (size > skip)
-avio_write(pb, buf + skip, size - skip);
+avio_write(pb, buf + skip, size - skip);
 
 if (keep_buffer) {
 ffio_reset_dyn_buf(*dyn_cp);
-- 
2.21.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".

Re: [FFmpeg-devel] [PATCH v2] avformat/srtenc: split write time into function for better readability

2020-04-29 Thread Limin Wang
On Wed, Apr 29, 2020 at 04:38:42PM +0200, Nicolas George wrote:
> lance.lmw...@gmail.com (12020-04-29):
> > From: Limin Wang 
> > 
> > Signed-off-by: Limin Wang 
> > ---
> >  libavformat/srtenc.c | 24 ++--
> >  1 file changed, 18 insertions(+), 6 deletions(-)
> > 
> > diff --git a/libavformat/srtenc.c b/libavformat/srtenc.c
> > index d811a4da0e..c53b227313 100644
> > --- a/libavformat/srtenc.c
> > +++ b/libavformat/srtenc.c
> > @@ -34,6 +34,20 @@ typedef struct SRTContext{
> >  unsigned index;
> >  } SRTContext;
> >  
> > +static void srt_write_time(AVIOContext *pb, int64_t millisec)
> > +{
> > +int64_t sec  = millisec / 1000;
> > +int64_t min  = sec / 60;
> > +int64_t hour = min / 60;
> > +
> > +millisec -= 1000 * sec;
> > +sec  -= 60 * min;
> > +min  -= 60 * hour;
> > +
> > +avio_printf(pb, "%02"PRId64":%02"PRId64":%02"PRId64",%03"PRId64"",
> > +hour, min, sec, millisec);
> > +}
> > +
> >  static int srt_write_header(AVFormatContext *avf)
> >  {
> >  SRTContext *srt = avf->priv_data;
> > @@ -85,12 +99,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
> >  return 0;
> >  }
> >  e = s + d;
> > -avio_printf(avf->pb, "%d\n%02d:%02d:%02d,%03d --> %02d:%02d:%02d,%03d",
> > -   srt->index,
> > -   (int)(s / 360),  (int)(s / 6) % 60,
> > -   (int)(s /1000) % 60, (int)(s %  1000),
> > -   (int)(e / 360),  (int)(e / 6) % 60,
> > -   (int)(e /1000) % 60, (int)(e %  1000));
> 
> I find the original code, with aligned divisions and explicit modulo
> more readable.
> 
> Your new code is fragile with regard to the order of operations, and it
> takes a little reflection to see it is correct. Not much, but more than
> (s / 6) % 60.

Sorry, the idea is coming from webvtt_write_time(), although I rewrite the code.
I think it's more readability to split the function with hour, minute, second, 
if you prefer to old code, then please ignore the patch.

> 
> Also, you are using PRId64 tu print numbers between 0 and 1000.
> 
> > +avio_printf(avf->pb, "%d\n", srt->index);
> > +srt_write_time(avf->pb, s);
> > +avio_printf(avf->pb, " --> ");
> > +srt_write_time(avf->pb, e);
> >  if (p)
> >  avio_printf(avf->pb, "  X1:%03d X2:%03d Y1:%03d Y2:%03d",
> >  x1, x2, y1, y2);
> 
> Regards,
> 
> -- 
>   Nicolas George



-- 
Thanks,
Limin Wang
___
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 v1] MAINTAINERS: add myself to the general developers list

2020-04-29 Thread Michael Niedermayer
On Sun, Apr 26, 2020 at 06:50:09PM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
> I have actively contributed to FFmpeg in the past year and should be familiar
> with the entire code base and the rules of the developers. Up to now, more 
> than
> one hundred patches have been accepted and pushed with the help of other 
> developers. However, some reviewed patches have not been pushed yet, so I am
> glad to request push access to the FFmpeg repository so that I can push them
> by the developer rules. I think being a committer is a duty, I prefer to 
> submit
> any patch to ML for review to avoid making mistakes.
> 
> Please the core team give comments or vote for my request.
> 
>  MAINTAINERS | 1 +
>  1 file changed, 1 insertion(+)

Will apply

thanks

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

Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad


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] oggdec: verify page checksum

2020-04-29 Thread Michael Niedermayer
On Tue, Apr 28, 2020 at 07:22:08PM +0200, Lynne wrote:
> Apr 28, 2020, 16:07 by d...@lynne.ee:
> 
> > Apr 28, 2020, 15:59 by mattias.wad...@gmail.com:
> >
> >>
> >>
> > Well, I consider CRC checking a part of correctly parsing ogg, so I think 
> > its best to leave it on
> > all the time.
> >
> 
> Did a new version of the patches.
> The first two are identical, save for some minor style tweaks.
> The last one now ensures the max page size, 65k, is available for seeking and 
> speeds up
> decoding on new/replacement streams since the offset was incorrect.
> I think its worth it.
> 
> I'm also close to figuring out how to make chained Opus work, will send a 
> patch once I do.
> 

This patchset seems to detect a crc error in:
Your patchset is probably correct in this as there are artifacts before, 
just reporting this as i noticed it.

./ffmpeg -i ~/tickets/2121/vlc-bug.oga c.wav

sample should be here: 
https://trac.ffmpeg.org/raw-attachment/ticket/2121/vlc-bug.oga

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates


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 v2] avformat/srtenc: split write time into function for better readability

2020-04-29 Thread Nicolas George
lance.lmw...@gmail.com (12020-04-29):
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavformat/srtenc.c | 24 ++--
>  1 file changed, 18 insertions(+), 6 deletions(-)
> 
> diff --git a/libavformat/srtenc.c b/libavformat/srtenc.c
> index d811a4da0e..c53b227313 100644
> --- a/libavformat/srtenc.c
> +++ b/libavformat/srtenc.c
> @@ -34,6 +34,20 @@ typedef struct SRTContext{
>  unsigned index;
>  } SRTContext;
>  
> +static void srt_write_time(AVIOContext *pb, int64_t millisec)
> +{
> +int64_t sec  = millisec / 1000;
> +int64_t min  = sec / 60;
> +int64_t hour = min / 60;
> +
> +millisec -= 1000 * sec;
> +sec  -= 60 * min;
> +min  -= 60 * hour;
> +
> +avio_printf(pb, "%02"PRId64":%02"PRId64":%02"PRId64",%03"PRId64"",
> +hour, min, sec, millisec);
> +}
> +
>  static int srt_write_header(AVFormatContext *avf)
>  {
>  SRTContext *srt = avf->priv_data;
> @@ -85,12 +99,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
>  return 0;
>  }
>  e = s + d;
> -avio_printf(avf->pb, "%d\n%02d:%02d:%02d,%03d --> %02d:%02d:%02d,%03d",
> -   srt->index,
> -   (int)(s / 360),  (int)(s / 6) % 60,
> -   (int)(s /1000) % 60, (int)(s %  1000),
> -   (int)(e / 360),  (int)(e / 6) % 60,
> -   (int)(e /1000) % 60, (int)(e %  1000));

I find the original code, with aligned divisions and explicit modulo
more readable.

Your new code is fragile with regard to the order of operations, and it
takes a little reflection to see it is correct. Not much, but more than
(s / 6) % 60.

Also, you are using PRId64 tu print numbers between 0 and 1000.

> +avio_printf(avf->pb, "%d\n", srt->index);
> +srt_write_time(avf->pb, s);
> +avio_printf(avf->pb, " --> ");
> +srt_write_time(avf->pb, e);
>  if (p)
>  avio_printf(avf->pb, "  X1:%03d X2:%03d Y1:%03d Y2:%03d",
>  x1, x2, y1, y2);

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 2/3] avformat/fifo: add option to write packets in paced way

2020-04-29 Thread Nicolas George
leozhang (12020-04-29):
> Signed-off-by: leozhang 
> ---
>  doc/muxers.texi|  3 +++
>  libavformat/fifo.c | 19 +++
>  2 files changed, 22 insertions(+)
> 
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index a74cbc4..5140c00 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -2274,6 +2274,9 @@ queue overflow or failure. This option is set to 0 
> (false) by default.
>  @item output_delay
>  Time to delay output, in microseconds. Default value is 0.
>  

> +@item paced
> +If set to 1 (true), write packets in paced way. Default value is 0 (false).

This does not explain to somebody who does not already know. Please have
a look at the doc for the filter "realtime" and use a similar wording,
preferably with cross-references.

> +
>  @end table
>  
>  @subsection Examples
> diff --git a/libavformat/fifo.c b/libavformat/fifo.c
> index bdecf2d..81b7e9e 100644
> --- a/libavformat/fifo.c
> +++ b/libavformat/fifo.c
> @@ -79,6 +79,12 @@ typedef struct FifoContext {
>  
>  /* Time to delay output, in microseconds */
>  uint64_t output_delay;
> +
> +/* If set to 1, write packets in paced way */
> +int paced;
> +
> +/* Time to start */

> +uint64_t start_time;

The return value of av_gettime_relative() is signed.

>  } FifoContext;
>  
>  typedef struct FifoThreadContext {
> @@ -184,6 +190,14 @@ static int fifo_thread_write_packet(FifoThreadContext 
> *ctx, AVPacket *pkt)
>  src_tb = avf->streams[s_idx]->time_base;
>  dst_tb = avf2->streams[s_idx]->time_base;
>  av_packet_rescale_ts(pkt, src_tb, dst_tb);
> +if (fifo->paced) {
> +uint64_t pts = av_rescale_q(pkt->dts, dst_tb, AV_TIME_BASE_Q);
> +uint64_t now = av_gettime_relative() - fifo->start_time;

> +av_assert0(now >= fifo->output_delay);

av_gettime_relative() is not guaranteed to be monotonic, an assert is
not acceptable here.

> +if (pts > now - fifo->output_delay) {

You probably need to make provisions for when the process was paused and
then resumed, and for timestamps discontinuities.

> +av_usleep(pts - (now - fifo->output_delay));

The argument to av_usleep() is unsigned, you are passing uint64_t, it
can overflow.

> +}

> +}
>  
>  ret = av_write_frame(avf2, pkt);
>  if (ret >= 0)
> @@ -515,6 +529,8 @@ static int fifo_init(AVFormatContext *avf)
>  return AVERROR(ret);
>  fifo->overflow_flag_lock_initialized = 1;
>  
> +fifo->start_time = av_gettime_relative();
> +
>  return 0;
>  }
>  
> @@ -637,6 +653,9 @@ static const AVOption options[] = {
>  {"output_delay", "Time to delay output, in microseconds", 
> OFFSET(output_delay),
>   AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, 
> AV_OPT_FLAG_ENCODING_PARAM},
>  
> +{"paced", "Write packets in paced way", OFFSET(paced),
> + AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
> +
>  {NULL},
>  };
>  

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 v6 1/5] lavc/libopenh264enc: Add qmin/qmax support

2020-04-29 Thread Fu, Linjie
> From: Martin Storsjö 
> Sent: Wednesday, April 29, 2020 16:52
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Cc: Fu, Linjie 
> Subject: Re: [FFmpeg-devel] [PATCH v6 1/5] lavc/libopenh264enc: Add
> qmin/qmax support
> 
> On Wed, 29 Apr 2020, Linjie Fu wrote:
> 
> > Clip iMinQp/iMaxQp to (1, 51) for user specified qp range.
> >
> > If not set, leave iMinQp/iMaxQp untouched and use the values (0, 51)
> > initialized in FillDefault(), and the QP range would be adjusted to the
> > defaults inside libopenh264 library according to the iUsageType, (12, 42)
> > for iUsageType == CAMERA_VIDEO_REAL_TIME which is default.
> >
> >
>  encoder_ext.cpp#L375>
> >
> > Signed-off-by: Linjie Fu 
> > ---
> > libavcodec/libopenh264enc.c | 11 +++
> > 1 file changed, 11 insertions(+)
> 
> LGTM
> 
Thanks for your review for the whole set, hope it would be merge soon: )

- Linjie

___
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] avformat/fifo: add option to delay output

2020-04-29 Thread Nicolas George
leozhang (12020-04-29):
> Signed-off-by: leozhang 
> ---
>  doc/muxers.texi| 3 +++
>  libavformat/fifo.c | 7 +++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index cb2bb42..a74cbc4 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -2271,6 +2271,9 @@ certain (usually permanent) errors the recovery is not 
> attempted even when
>  Specify whether to wait for the keyframe after recovering from
>  queue overflow or failure. This option is set to 0 (false) by default.
>  

> +@item output_delay
> +Time to delay output, in microseconds. Default value is 0.

This is not accurate enough. This will block every output packet for the
extra specified duration.

Not sure if it is very useful, compared with the other patch.

> +
>  @end table
>  
>  @subsection Examples
> diff --git a/libavformat/fifo.c b/libavformat/fifo.c
> index d11dc66..bdecf2d 100644
> --- a/libavformat/fifo.c
> +++ b/libavformat/fifo.c
> @@ -77,6 +77,8 @@ typedef struct FifoContext {
>  /* Value > 0 signals queue overflow */
>  volatile uint8_t overflow_flag;
>  
> +/* Time to delay output, in microseconds */
> +uint64_t output_delay;
>  } FifoContext;
>  
>  typedef struct FifoThreadContext {
> @@ -397,6 +399,8 @@ static void *fifo_consumer_thread(void *data)
>  memset(_thread_ctx, 0, sizeof(FifoThreadContext));
>  fifo_thread_ctx.avf = avf;
>  
> +av_usleep(fifo->output_delay);
> +
>  while (1) {
>  uint8_t just_flushed = 0;
>  
> @@ -630,6 +634,9 @@ static const AVOption options[] = {
>  {"recover_any_error", "Attempt recovery regardless of type of the 
> error", OFFSET(recover_any_error),
>   AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
>  

> +{"output_delay", "Time to delay output, in microseconds", 
> OFFSET(output_delay),
> + AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, 
> AV_OPT_FLAG_ENCODING_PARAM},

AV_OPT_TYPE_DURATION and adapt the description and documentation.

> +
>  {NULL},
>  };
>  

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] Add general_assembly_bootstrap.pl

2020-04-29 Thread Nicolas George
Josh de Kock (12020-04-29):
> To add to this:
> 
> We could decide to use this every time, but that would have to be done by a
> vote. But we can't vote on that with nothing, so hence we have this to begin
> somewhere.
> 
> The community and technical committees will be decided by the bootstrapped
> general assembly, along with formalising the voting procedures and
> processes. Going forward from there it should be a pretty simple case of
> just continuing the methods which were chosen.

Indeed. If using the commit count is one of the option on the ballot,
then we must have access to the exact implementation to vote: your code
must be present on the ballot, or as an annex to the ballot. The
mailing-list archives are a reasonable place.

But not in the official tree, not before the vote.

But for the record, I think that using this code for the bootstrap is a
good idea, but using an automatic commit count for future evolutions is
a bad idea.

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] Add general_assembly_bootstrap.pl

2020-04-29 Thread Josh de Kock

On 29/04/2020 14:00, Nicolas George wrote:

Anton Khirnov (12020-04-29):

  Better late than never, this patch will continue to put in place the
  voting systems for FFmpeg discussed at VDD 2019 and FOSDEM 2020.
  There is probably a better way to do this, but the aim is just to
  'bootstrap' and kickstart the process and commitees.

 ^

Since it is only useful once, is there a point in having it in the tree?

Why would it only be useful once? I thought we'd use the same procedure
for every vote.


We did not yet agree on the procedure for all votes, AFAIK, we only
agreed on the procedure for the first vote. Having a procedure already
implemented and in the official Git source tree would be pretty
disloyal.



To add to this:

We could decide to use this every time, but that would have to be done 
by a vote. But we can't vote on that with nothing, so hence we have this 
to begin somewhere.


The community and technical committees will be decided by the 
bootstrapped general assembly, along with formalising the voting 
procedures and processes. Going forward from there it should be a pretty 
simple case of just continuing the methods which were chosen.


--
Josh
___
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] Add general_assembly_bootstrap.pl

2020-04-29 Thread Nicolas George
Anton Khirnov (12020-04-29):
> > >  Better late than never, this patch will continue to put in place the
> > >  voting systems for FFmpeg discussed at VDD 2019 and FOSDEM 2020.
> > >  There is probably a better way to do this, but the aim is just to
> > >  'bootstrap' and kickstart the process and commitees.
^
> > Since it is only useful once, is there a point in having it in the tree?
> Why would it only be useful once? I thought we'd use the same procedure
> for every vote.

We did not yet agree on the procedure for all votes, AFAIK, we only
agreed on the procedure for the first vote. Having a procedure already
implemented and in the official Git source tree would be pretty
disloyal.

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 v2] avfilter/vf_v360: adjustment out_pad and in_pad maximum value to 1/10

2020-04-29 Thread Josh de Kock

On 26/04/2020 15:43, Steven Liu wrote:




2020年4月21日 下午10:54,Steven Liu  写道:

Because not every user know about in_pad and out_pad reasonable value range
so maybe try to set 1.0, but setting 1.0 is so hugh to get an fatal error.

Suggested-by: Paul B Mahol 
Signed-off-by: Steven Liu 
---
doc/filters.texi  | 1 +
libavfilter/vf_v360.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 80c33f5edb..740aba0642 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -18956,6 +18956,7 @@ No padding.
@end table

Default value is @b{@samp{0}}.
+Maximum value is @b{@samp{0.1}}.

@item fin_pad
@item fout_pad
diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index ebc281dfca..e5b75c7226 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -133,8 +133,8 @@ static const AVOption v360_options[] = {
 {"out_forder", "output cubemap face order", OFFSET(out_forder), AV_OPT_TYPE_STRING, 
{.str="rludfb"},0, NB_DIRECTIONS-1, FLAGS, "out_forder"},
 {   "in_frot", "input cubemap face rotation",  OFFSET(in_frot), AV_OPT_TYPE_STRING, 
{.str="00"},0, NB_DIRECTIONS-1, FLAGS, "in_frot"},
 {  "out_frot", "output cubemap face rotation",OFFSET(out_frot), AV_OPT_TYPE_STRING, 
{.str="00"},0, NB_DIRECTIONS-1, FLAGS, "out_frot"},
-{"in_pad", "percent input cubemap pads",OFFSET(in_pad), AV_OPT_TYPE_FLOAT,  
{.dbl=0.f},   0.f, 1.f,TFLAGS, "in_pad"},
-{   "out_pad", "percent output cubemap pads",  OFFSET(out_pad), AV_OPT_TYPE_FLOAT,  
{.dbl=0.f},   0.f, 1.f,TFLAGS, "out_pad"},
+{"in_pad", "percent input cubemap pads",OFFSET(in_pad), AV_OPT_TYPE_FLOAT,  
{.dbl=0.f},   0.f, 0.1,TFLAGS, "in_pad"},
+{   "out_pad", "percent output cubemap pads",  OFFSET(out_pad), AV_OPT_TYPE_FLOAT,  
{.dbl=0.f},   0.f, 0.1,TFLAGS, "out_pad"},
 {   "fin_pad", "fixed input cubemap pads", OFFSET(fin_pad), AV_OPT_TYPE_INT,
{.i64=0},   0, 100,TFLAGS, "fin_pad"},
 {  "fout_pad", "fixed output cubemap pads",   OFFSET(fout_pad), AV_OPT_TYPE_INT,
{.i64=0},   0, 100,TFLAGS, "fout_pad"},
 {   "yaw", "yaw rotation", OFFSET(yaw), AV_OPT_TYPE_FLOAT,  
{.dbl=0.f},-180.f,   180.f,TFLAGS, "yaw"},
--
2.25.0




Ping

Thanks

Steven Liu



Applied.

--
Josh

___
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] Add general_assembly_bootstrap.pl

2020-04-29 Thread Anton Khirnov
Quoting Nicolas George (2020-04-24 12:29:23)
> Josh de Kock (12020-04-24):
> > This script aims to extract contributors who are eligible for the
> > general assembly.
> > 
> > Signed-off-by: Josh de Kock 
> > ---
> > 
> >  Better late than never, this patch will continue to put in place the
> >  voting systems for FFmpeg discussed at VDD 2019 and FOSDEM 2020.
> >  There is probably a better way to do this, but the aim is just to
> >  'bootstrap' and kickstart the process and commitees.
> 
> Since it is only useful once, is there a point in having it in the tree?

Why would it only be useful once? I thought we'd use the same procedure
for every vote.

-- 
Anton Khirnov
___
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 v2] avformat/hlsenc: compute segment duration use current pts minus last segment end pts

2020-04-29 Thread Steven Liu
segment duration is using vs duration which compute by frame per second,
that can not fix problem of VFR video stream, so compute the duration
when split the segment, set the segment target duration use
current packet pts minus the prev segment end pts..

Reported-by: Zhao Jun 
Signed-off-by: Steven Liu 
---
 libavformat/hlsenc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index d75684741f..4a83db04e9 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -2460,7 +2460,8 @@ static int hls_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 }
 
 if (vs->start_pos || hls->segment_type != SEGMENT_TYPE_FMP4) {
-ret = hls_append_segment(s, hls, vs, vs->duration, vs->start_pos, 
vs->size);
+double cur_duration =  (double)(pkt->pts - vs->end_pts) * 
st->time_base.num / st->time_base.den;
+ret = hls_append_segment(s, hls, vs, cur_duration, vs->start_pos, 
vs->size);
 vs->end_pts = pkt->pts;
 vs->duration = 0;
 if (ret < 0) {
-- 
2.25.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".

Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: compute segment duration use current pts minus last segment end pts

2020-04-29 Thread Steven Liu


> 2020年4月29日 下午3:07,myp...@gmail.com 写道:
> 
> On Wed, Apr 29, 2020 at 12:44 PM Steven Liu  wrote:
>> 
>> segment duration is using vs duration which compute by frame per second,
>> that can not fix problem of VFR video stream, so compute the duration
>> when split the segment, set the segment target duration use
>> current packet pts minus the prev segment end pts and plus current
>> packet's duration.
>> 
>> Reported-by: Zhao Jun 
>> Signed-off-by: Steven Liu 
>> ---
>> libavformat/hlsenc.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>> index d75684741f..9e8b34d83c 100644
>> --- a/libavformat/hlsenc.c
>> +++ b/libavformat/hlsenc.c
>> @@ -2460,7 +2460,8 @@ static int hls_write_packet(AVFormatContext *s, 
>> AVPacket *pkt)
>> }
>> 
>> if (vs->start_pos || hls->segment_type != SEGMENT_TYPE_FMP4) {
>> -ret = hls_append_segment(s, hls, vs, vs->duration, 
>> vs->start_pos, vs->size);
>> +double cur_duration =  (double)(pkt->pts - vs->end_pts) * 
>> st->time_base.num / st->time_base.den + vs->dpp;
>> +ret = hls_append_segment(s, hls, vs, cur_duration, 
>> vs->start_pos, vs->size);
>> vs->end_pts = pkt->pts;
>> vs->duration = 0;
>> if (ret < 0) {
>> --
>> 2.25.0
>> 
>> 
> LGTM, Tested and verified, tks the quick fix.
Sorry I make a mistake, the pkt should not in current segment, it should in the 
next segment, so just remove the + vs->dpp
I will submit version 2 patch
> ___
> 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".

Thanks

Steven Liu



___
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] tests/api/api-h264-slice-test: remove unused bool header

2020-04-29 Thread Josh de Kock

On 29/04/2020 13:11, Fu, Linjie wrote:

From: ffmpeg-devel  On Behalf Of
Carl Eugen Hoyos
Sent: Thursday, April 2, 2020 03:23
To: FFmpeg development discussions and patches 
Subject: Re: [FFmpeg-devel] [PATCH] tests/api/api-h264-slice-test: remove
unused bool header

Am Mi., 1. Apr. 2020 um 06:58 Uhr schrieb Linjie Fu :


Signed-off-by: Linjie Fu 
---
  tests/api/api-h264-slice-test.c | 1 -
  1 file changed, 1 deletion(-)

diff --git a/tests/api/api-h264-slice-test.c b/tests/api/api-h264-slice-test.c
index dee93b8..b7aa405 100644
--- a/tests/api/api-h264-slice-test.c
+++ b/tests/api/api-h264-slice-test.c
@@ -24,7 +24,6 @@

  #include "config.h"

-#include 


Good idea.

Carl Eugen


Ping for this, thx.

  - Linjie


Thanks, applied.

--
Josh
___
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] tests/api/api-h264-slice-test: remove unused bool header

2020-04-29 Thread Fu, Linjie
> From: ffmpeg-devel  On Behalf Of
> Carl Eugen Hoyos
> Sent: Thursday, April 2, 2020 03:23
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH] tests/api/api-h264-slice-test: remove
> unused bool header
> 
> Am Mi., 1. Apr. 2020 um 06:58 Uhr schrieb Linjie Fu :
> >
> > Signed-off-by: Linjie Fu 
> > ---
> >  tests/api/api-h264-slice-test.c | 1 -
> >  1 file changed, 1 deletion(-)
> >
> > diff --git a/tests/api/api-h264-slice-test.c 
> > b/tests/api/api-h264-slice-test.c
> > index dee93b8..b7aa405 100644
> > --- a/tests/api/api-h264-slice-test.c
> > +++ b/tests/api/api-h264-slice-test.c
> > @@ -24,7 +24,6 @@
> >
> >  #include "config.h"
> >
> > -#include 
> 
> Good idea.
> 
> Carl Eugen

Ping for this, thx.

 - Linjie
___
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, v4] lavc/vp9: fix reference frame dimensions check for SINGLE_REFERENCE mode

2020-04-29 Thread Fu, Linjie
> From: ffmpeg-devel  On Behalf Of Fu,
> Linjie
> Sent: Friday, March 20, 2020 09:49
> To: Ronald S. Bultje ; FFmpeg development
> discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH, v4] lavc/vp9: fix reference frame
> dimensions check for SINGLE_REFERENCE mode
> 
> > From: Ronald S. Bultje 
> > Sent: Thursday, March 19, 2020 20:10
> > To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> > Cc: Fu, Linjie 
> > Subject: Re: [FFmpeg-devel] [PATCH, v4] lavc/vp9: fix reference frame
> dimensions check for SINGLE_REFERENCE mode
> >
> > Hi,
> >
> > On Tue, Mar 17, 2020 at 10:59 AM Linjie Fu
> mailto:linjie...@intel.com>> wrote:
> > With the description in frame size with refs semantics (SPEC 7.2.5),
> > it is a requirement of bitstream conformance that for at least one
> > reference frame has the valid dimensions.
> >
> > Modify the check to make sure the decoder works well in
> SINGLE_REFERENCE
> > mode that not all reference frames have valid dimensions.
> >
> > Check and error out if invalid reference frame is used in inter_recon.
> >
> > One of the failure case is a 480x272 inter frame (SINGLE_REFERENCE mode)
> > with following reference pool:
> >
> > 0.  960x544LASTvalid
> > 1. 1920x1088 GOLDEN  invalid, but not used in single reference mode
> > 2. 1920x1088 ALTREF  invalid, but not used in single reference mode
> > 3~7  ... Unused
> >
> > Identical logic in libvpx:
> >
>  ecodeframe.c#L736>
> >
> > Signed-off-by: Linjie Fu mailto:linjie...@intel.com>>
> > ---
> > [v3]: replace assert with check/return, tested in both multi frame/slice
> mode
> > [v4]: clear error_info to make decoding still work for other frames in this
> stream
> >
> > libavcodec/vp9.c  | 20 ++--
> > libavcodec/vp9dec.h   |  5 +
> > libavcodec/vp9recon.c | 10 ++
> > 3 files changed, 33 insertions(+), 2 deletions(-)
> >
> > LGTM, thanks for the revisions. (We have been discussing this on IRC.)
> 
> Thanks for the review and valuable suggestions.
> 
Ping for merge, thx.

- Linjie
___
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 0/2] fix for seeking in HLS with TS/FMP4 media

2020-04-29 Thread Josh de Kock

On 25/04/2020 22:42, Carl Eugen Hoyos wrote:

Am Fr., 24. Apr. 2020 um 17:21 Uhr schrieb vectronic
:


I am resubmitting a patch which fixes the following two tickets:



Do you not want to commit with your name rather than a handle here?


https://trac.ffmpeg.org/ticket/7359
https://trac.ffmpeg.org/ticket/7485


Are you Nick Ryan / did you write the attached patches?


The LinkedIn on his website suggests he is.

--
Josh
___
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] Add general_assembly_bootstrap.pl

2020-04-29 Thread Josh de Kock

On 24/04/2020 11:44, Josh de Kock wrote:

On 24/04/2020 11:29, Nicolas George wrote:

Josh de Kock (12020-04-24):

This script aims to extract contributors who are eligible for the
general assembly.

Signed-off-by: Josh de Kock 
---

  Better late than never, this patch will continue to put in place the
  voting systems for FFmpeg discussed at VDD 2019 and FOSDEM 2020.
  There is probably a better way to do this, but the aim is just to
  'bootstrap' and kickstart the process and commitees.


Since it is only useful once, is there a point in having it in the tree?

There is no particular need for it to stay in the tree. Regardless, I 
wanted to send it to the mailing list to avoid any complications vs if I 
had just sent the output of the script (so that it can be reviewed and 
tested by others).


My suggestion would be to actually commit it and then remove it later 
when we have another system properly setup so that it is in git history.




Ping for further comments. This will affect all developers.

--
Josh
___
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: Skip the dnxhd-uhd-hr-sq tests of large tests are disabled

2020-04-29 Thread Josh de Kock

On 23/04/2020 08:14, Martin Storsjö wrote:

These tests are also in the same size range as the previously
skipped 2k and 4k tests.
---
  tests/fate/vcodec.mak | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/fate/vcodec.mak b/tests/fate/vcodec.mak
index fc27da5456..ec2a9c339d 100644
--- a/tests/fate/vcodec.mak
+++ b/tests/fate/vcodec.mak
@@ -29,13 +29,14 @@ FATE_VCODEC-$(call ENCDEC, DNXHD, DNXHD) += dnxhd-720p  
\
  dnxhd-720p-rd   \
  dnxhd-720p-10bit\
  dnxhd-720p-hr-lb\
-dnxhd-uhd-hr-sq \
  dnxhd-edge1-hr  \
  dnxhd-edge2-hr  \
  dnxhd-edge3-hr
  
  FATE_VCODEC-$(call ALLYES, DNXHD_ENCODER DNXHD_DECODER LARGE_TESTS) += dnxhd-4k-hr-lb \

-   
dnxhd-2k-hr-hq
+   
dnxhd-2k-hr-hq \
+   
dnxhd-uhd-hr-sq
+
  
  FATE_VCODEC-$(call ENCDEC, VC2 DIRAC, MOV) += vc2-420p vc2-420p10 vc2-420p12 \

vc2-422p vc2-422p10 vc2-422p12 \



This was applied.

--
Josh
___
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/hls: disable persistent HTTP connections by default w/ schannel

2020-04-29 Thread Josh de Kock

On 26/04/2020 20:43, Jan Ekström wrote:

This TLS implementation has always had issues with the way that
libavformat implemented persistency, yet nobody seemed to be able to
figure out why. It currently can lead to completely stuck playback,
so disable it by default.

Additionally, update the documentation to match the new behavior.
---
  doc/demuxers.texi | 3 ++-
  libavformat/hls.c | 2 +-
  2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index 3c15ab9eee..35920af32d 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -337,7 +337,8 @@ Default value is 1000.
  
  @item http_persistent

  Use persistent HTTP connections. Applicable only for HTTP streams.
-Enabled by default.
+Enabled by default, except when the Windows schannel TLS implementation
+is utilized.
  
  @item http_multiple

  Use multiple HTTP connections for downloading HTTP segments.
diff --git a/libavformat/hls.c b/libavformat/hls.c
index fc45719d1c..f709f0c890 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -2343,7 +2343,7 @@ static const AVOption hls_options[] = {
  {"m3u8_hold_counters", "The maximum number of times to load m3u8 when it 
refreshes without new segments",
  OFFSET(m3u8_hold_counters), AV_OPT_TYPE_INT, {.i64 = 1000}, 0, 
INT_MAX, FLAGS},
  {"http_persistent", "Use persistent HTTP connections",
-OFFSET(http_persistent), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, FLAGS },
+OFFSET(http_persistent), AV_OPT_TYPE_BOOL, {.i64 = !CONFIG_SCHANNEL}, 
0, 1, FLAGS },
  {"http_multiple", "Use multiple HTTP connections for fetching segments",
  OFFSET(http_multiple), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, FLAGS},
  {"http_seekable", "Use HTTP partial requests, 0 = disable, 1 = enable, -1 = 
auto",



Whilst I'm not against a stop-gap change for this, did you already open 
a ticket for this? I think it would be good to track it.


--
Josh
___
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] tools: fix const specifier for AVInputFormat

2020-04-29 Thread Josh de Kock
Signed-off-by: Josh de Kock 
---
 tools/probetest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

 Small fix for compiler warning caused by my earlier change.

diff --git a/tools/probetest.c b/tools/probetest.c
index cfa309cabd..6f0e002b74 100644
--- a/tools/probetest.c
+++ b/tools/probetest.c
@@ -66,7 +66,7 @@ static void probe(AVProbeData *pd, int type, int p, int size)
 static void print_times(void)
 {
 int i = 0;
-AVInputFormat *fmt = NULL;
+const AVInputFormat *fmt = NULL;
 void *fmt_opaque = NULL;
 
 while ((fmt = av_demuxer_iterate(_opaque))) {
-- 
2.26.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] [PATCH v2] avformat/srtenc: split write time into function for better readability

2020-04-29 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavformat/srtenc.c | 24 ++--
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/libavformat/srtenc.c b/libavformat/srtenc.c
index d811a4da0e..c53b227313 100644
--- a/libavformat/srtenc.c
+++ b/libavformat/srtenc.c
@@ -34,6 +34,20 @@ typedef struct SRTContext{
 unsigned index;
 } SRTContext;
 
+static void srt_write_time(AVIOContext *pb, int64_t millisec)
+{
+int64_t sec  = millisec / 1000;
+int64_t min  = sec / 60;
+int64_t hour = min / 60;
+
+millisec -= 1000 * sec;
+sec  -= 60 * min;
+min  -= 60 * hour;
+
+avio_printf(pb, "%02"PRId64":%02"PRId64":%02"PRId64",%03"PRId64"",
+hour, min, sec, millisec);
+}
+
 static int srt_write_header(AVFormatContext *avf)
 {
 SRTContext *srt = avf->priv_data;
@@ -85,12 +99,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
 return 0;
 }
 e = s + d;
-avio_printf(avf->pb, "%d\n%02d:%02d:%02d,%03d --> %02d:%02d:%02d,%03d",
-   srt->index,
-   (int)(s / 360),  (int)(s / 6) % 60,
-   (int)(s /1000) % 60, (int)(s %  1000),
-   (int)(e / 360),  (int)(e / 6) % 60,
-   (int)(e /1000) % 60, (int)(e %  1000));
+avio_printf(avf->pb, "%d\n", srt->index);
+srt_write_time(avf->pb, s);
+avio_printf(avf->pb, " --> ");
+srt_write_time(avf->pb, e);
 if (p)
 avio_printf(avf->pb, "  X1:%03d X2:%03d Y1:%03d Y2:%03d",
 x1, x2, y1, y2);
-- 
2.21.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".

Re: [FFmpeg-devel] [PATCH] avformat/srtenc: split write time into function for better readability

2020-04-29 Thread lance . lmwang
On Wed, Apr 29, 2020 at 11:12:21AM +0200, Andreas Rheinhardt wrote:
> lance.lmw...@gmail.com:
> > From: Limin Wang 
> > 
> > Signed-off-by: Limin Wang 
> > ---
> >  libavformat/srtenc.c | 24 ++--
> >  1 file changed, 18 insertions(+), 6 deletions(-)
> > 
> > diff --git a/libavformat/srtenc.c b/libavformat/srtenc.c
> > index d811a4da0e..ca127354ed 100644
> > --- a/libavformat/srtenc.c
> > +++ b/libavformat/srtenc.c
> > @@ -34,6 +34,20 @@ typedef struct SRTContext{
> >  unsigned index;
> >  } SRTContext;
> >  
> > +static void srt_write_time(AVIOContext *pb, int64_t millisec)
> > +{
> > +int64_t sec = millisec / 1000;
> > +int64_t min = sec / 60;
> > +int64_t hour = min / 60;;
> 
> Superfluous ';'; also, you can align on '=' (above and below).

Sorry, I'll update and fix it.

> 
> > +
> > +millisec -= 1000 * sec;
> > +sec -= 60 * min;
> > +min -= 60 * hour;
> > +> +avio_printf(pb, "%02"PRId64":%02"PRId64":%02"PRId64",%03"PRId64"",
> > +hour, min, sec, millisec);
> 
> hour should be left-aligned with pb.
> 
> > +}
> > +
> >  static int srt_write_header(AVFormatContext *avf)
> >  {
> >  SRTContext *srt = avf->priv_data;
> > @@ -85,12 +99,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
> >  return 0;
> >  }
> >  e = s + d;
> > -avio_printf(avf->pb, "%d\n%02d:%02d:%02d,%03d --> %02d:%02d:%02d,%03d",
> > -   srt->index,
> > -   (int)(s / 360),  (int)(s / 6) % 60,
> > -   (int)(s /1000) % 60, (int)(s %  1000),
> > -   (int)(e / 360),  (int)(e / 6) % 60,
> > -   (int)(e /1000) % 60, (int)(e %  1000));
> > +avio_printf(avf->pb, "%d\n", srt->index);
> > +srt_write_time(avf->pb, s);
> > +avio_printf(avf->pb, " --> ");
> > +srt_write_time(avf->pb, e);
> >  if (p)
> >  avio_printf(avf->pb, "  X1:%03d X2:%03d Y1:%03d Y2:%03d",
> >  x1, x2, y1, y2);
> > 
> 
> ___
> 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".

-- 
Thanks,
Limin Wang
___
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/srtenc: split write time into function for better readability

2020-04-29 Thread Andreas Rheinhardt
lance.lmw...@gmail.com:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavformat/srtenc.c | 24 ++--
>  1 file changed, 18 insertions(+), 6 deletions(-)
> 
> diff --git a/libavformat/srtenc.c b/libavformat/srtenc.c
> index d811a4da0e..ca127354ed 100644
> --- a/libavformat/srtenc.c
> +++ b/libavformat/srtenc.c
> @@ -34,6 +34,20 @@ typedef struct SRTContext{
>  unsigned index;
>  } SRTContext;
>  
> +static void srt_write_time(AVIOContext *pb, int64_t millisec)
> +{
> +int64_t sec = millisec / 1000;
> +int64_t min = sec / 60;
> +int64_t hour = min / 60;;

Superfluous ';'; also, you can align on '=' (above and below).

> +
> +millisec -= 1000 * sec;
> +sec -= 60 * min;
> +min -= 60 * hour;
> +> +avio_printf(pb, "%02"PRId64":%02"PRId64":%02"PRId64",%03"PRId64"",
> +hour, min, sec, millisec);

hour should be left-aligned with pb.

> +}
> +
>  static int srt_write_header(AVFormatContext *avf)
>  {
>  SRTContext *srt = avf->priv_data;
> @@ -85,12 +99,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
>  return 0;
>  }
>  e = s + d;
> -avio_printf(avf->pb, "%d\n%02d:%02d:%02d,%03d --> %02d:%02d:%02d,%03d",
> -   srt->index,
> -   (int)(s / 360),  (int)(s / 6) % 60,
> -   (int)(s /1000) % 60, (int)(s %  1000),
> -   (int)(e / 360),  (int)(e / 6) % 60,
> -   (int)(e /1000) % 60, (int)(e %  1000));
> +avio_printf(avf->pb, "%d\n", srt->index);
> +srt_write_time(avf->pb, s);
> +avio_printf(avf->pb, " --> ");
> +srt_write_time(avf->pb, e);
>  if (p)
>  avio_printf(avf->pb, "  X1:%03d X2:%03d Y1:%03d Y2:%03d",
>  x1, x2, y1, y2);
> 

___
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/srtenc: split write time into function for better readability

2020-04-29 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavformat/srtenc.c | 24 ++--
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/libavformat/srtenc.c b/libavformat/srtenc.c
index d811a4da0e..ca127354ed 100644
--- a/libavformat/srtenc.c
+++ b/libavformat/srtenc.c
@@ -34,6 +34,20 @@ typedef struct SRTContext{
 unsigned index;
 } SRTContext;
 
+static void srt_write_time(AVIOContext *pb, int64_t millisec)
+{
+int64_t sec = millisec / 1000;
+int64_t min = sec / 60;
+int64_t hour = min / 60;;
+
+millisec -= 1000 * sec;
+sec -= 60 * min;
+min -= 60 * hour;
+
+avio_printf(pb, "%02"PRId64":%02"PRId64":%02"PRId64",%03"PRId64"",
+hour, min, sec, millisec);
+}
+
 static int srt_write_header(AVFormatContext *avf)
 {
 SRTContext *srt = avf->priv_data;
@@ -85,12 +99,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
 return 0;
 }
 e = s + d;
-avio_printf(avf->pb, "%d\n%02d:%02d:%02d,%03d --> %02d:%02d:%02d,%03d",
-   srt->index,
-   (int)(s / 360),  (int)(s / 6) % 60,
-   (int)(s /1000) % 60, (int)(s %  1000),
-   (int)(e / 360),  (int)(e / 6) % 60,
-   (int)(e /1000) % 60, (int)(e %  1000));
+avio_printf(avf->pb, "%d\n", srt->index);
+srt_write_time(avf->pb, s);
+avio_printf(avf->pb, " --> ");
+srt_write_time(avf->pb, e);
 if (p)
 avio_printf(avf->pb, "  X1:%03d X2:%03d Y1:%03d Y2:%03d",
 x1, x2, y1, y2);
-- 
2.21.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".

Re: [FFmpeg-devel] [PATCH v6 5/5] lavc/libopenh264enc: set slice_mode option to deprecated

2020-04-29 Thread Martin Storsjö

On Wed, 29 Apr 2020, Linjie Fu wrote:


"slice mode" option seems to be unnecessary since it could be
determined by -slices/max_nal_size.

default:SM_FIXEDSLCNUM_SLICE mode with cpu-number slices.
-slices N:  SM_FIXEDSLCNUM_SLICE mode with N slices.
-max_nal_size:  SM_SIZELIMITED_SLICE mode with limited size slices.

Add FF_API_OPENH264_SLICE_MODE macro to remove this option after
LIBAVCODEC_VERSION_MAJOR = 59.

Signed-off-by: Linjie Fu 
---
libavcodec/libopenh264enc.c | 7 +--
libavcodec/version.h| 3 +++
2 files changed, 8 insertions(+), 2 deletions(-)


LGTM

// Martin

___
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 v6 4/5] lavc/libopenh264enc: prompt slice number changing inside libopenh264

2020-04-29 Thread Martin Storsjö

On Wed, 29 Apr 2020, Linjie Fu wrote:


Libopenh264enc would set the slice according to the number of cpu cores
if uiSliceNum equals to 0 (auto) in SM_FIXEDSLCNUM_SLICE mode.

Prompt a warning for user to catch this.

Signed-off-by: Linjie Fu 
---
libavcodec/libopenh264enc.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index dc3bd53..29269f9 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -244,6 +244,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
param.sSpatialLayers[0].sSliceCfg.uiSliceMode   = s->slice_mode;
param.sSpatialLayers[0].sSliceCfg.sSliceArgument.uiSliceNum = avctx->slices;
#endif
+if (avctx->slices == 0 && s->slice_mode == SM_FIXEDSLCNUM_SLICE)
+av_log(avctx, AV_LOG_WARNING, "Slice count will be set 
automatically\n");

if (s->slice_mode == SM_SIZELIMITED_SLICE) {
if (s->max_nal_size) {
--
2.7.4


LGTM

// Martin

___
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 v6 3/5] lavc/libopenh264enc: add bit rate control select support

2020-04-29 Thread Martin Storsjö

On Wed, 29 Apr 2020, Linjie Fu wrote:


RC_BITRATE_MODE:
   set BITS_EXCEEDED to iCurrentBitsLevel and allows QP adjust
   in RcCalculatePictureQp().

RC_BUFFERBASED_MODE:
   use buffer status to adjust the video quality.

RC_TIMESTAMP_MODE:
   bit rate control based on timestamp, introduced in release 1.4.

Default to use RC_QUALITY_MODE.

Signed-off-by: Linjie Fu 
---
libavcodec/libopenh264enc.c | 15 ++-
1 file changed, 14 insertions(+), 1 deletion(-)


LGTM

// Martin

___
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 v6 1/5] lavc/libopenh264enc: Add qmin/qmax support

2020-04-29 Thread Martin Storsjö

On Wed, 29 Apr 2020, Linjie Fu wrote:


Clip iMinQp/iMaxQp to (1, 51) for user specified qp range.

If not set, leave iMinQp/iMaxQp untouched and use the values (0, 51)
initialized in FillDefault(), and the QP range would be adjusted to the
defaults inside libopenh264 library according to the iUsageType, (12, 42)
for iUsageType == CAMERA_VIDEO_REAL_TIME which is default.



Signed-off-by: Linjie Fu 
---
libavcodec/libopenh264enc.c | 11 +++
1 file changed, 11 insertions(+)


LGTM

// Martin

___
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 v6 2/5] lavc/libopenh264enc: add default gop size and bit rate

2020-04-29 Thread Martin Storsjö

On Wed, 29 Apr 2020, Linjie Fu wrote:


It would be 200kbps bitrate with gop size = 12 by default
which generated too many IDR frames in rather low bit rate.
The quality would be poor.

Set these default values to -1 to check whether it's specified
by user explicitly.

Use 2Mbps bitrate as nvenc sugguested, and leave gop size
untouched in libopenh264.

Signed-off-by: Linjie Fu 
---
libavcodec/libopenh264enc.c | 9 +++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index 265eb9c..245752d 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -37,6 +37,8 @@
#define SM_SIZELIMITED_SLICE SM_DYN_SLICE
#endif

+#define TARGET_BITRATE_DEFAULT 2*1000*1000
+
typedef struct SVCContext {
const AVClass *av_class;
ISVCEncoder *encoder;
@@ -132,7 +134,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
param.fMaxFrameRate  = 1/av_q2d(avctx->time_base);
param.iPicWidth  = avctx->width;
param.iPicHeight = avctx->height;
-param.iTargetBitrate = avctx->bit_rate;
+param.iTargetBitrate = avctx->bit_rate > 0 ? avctx->bit_rate : 
TARGET_BITRATE_DEFAULT;
param.iMaxBitrate= FFMAX(avctx->rc_max_rate, 
avctx->bit_rate);
param.iRCMode= RC_QUALITY_MODE;
if (avctx->qmax >= 0)
@@ -147,7 +149,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
param.bEnableFrameSkip   = s->skip_frames;
param.bEnableLongTermReference   = 0;
param.iLtrMarkPeriod = 30;
-param.uiIntraPeriod  = avctx->gop_size;
+if (avctx->gop_size >= 0)
+param.uiIntraPeriod  = avctx->gop_size;
#if OPENH264_VER_AT_LEAST(1, 4)
param.eSpsPpsIdStrategy  = CONSTANT_ID;
#else
@@ -336,6 +339,8 @@ static int svc_encode_frame(AVCodecContext *avctx, AVPacket 
*avpkt,
}

static const AVCodecDefault svc_enc_defaults[] = {
+{ "b", "0" },
+{ "g", "-1"},
{ "qmin",  "-1"},
{ "qmax",  "-1"},
{ NULL },
--
2.7.4


LGTM

// Martin

___
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/utils: change the duration to int64_t for update_initial_durations

2020-04-29 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavformat/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 3b53f97bee..44109d866d 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1174,7 +1174,7 @@ static void update_initial_timestamps(AVFormatContext *s, 
int stream_index,
 }
 
 static void update_initial_durations(AVFormatContext *s, AVStream *st,
- int stream_index, int duration)
+ int stream_index, int64_t duration)
 {
 AVPacketList *pktl = s->internal->packet_buffer ? 
s->internal->packet_buffer : s->internal->parse_queue;
 int64_t cur_dts= RELATIVE_TS_BASE;
-- 
2.21.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] [PATCH v1] avcodec/v4l2_m2m_enc: Set bitrate mode to cbr by default

2020-04-29 Thread Ming Qian
Without this setting, bitrate may have no effect
if the default value of bitrate mode is VBR.

Signed-off-by: Ming Qian 
---
 libavcodec/v4l2_m2m_enc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c
index 8454e2326c..6296ad88c6 100644
--- a/libavcodec/v4l2_m2m_enc.c
+++ b/libavcodec/v4l2_m2m_enc.c
@@ -191,6 +191,7 @@ static int v4l2_prepare_encoder(V4L2m2mContext *s)
 
 /* set ext ctrls */
 v4l2_set_ext_ctrl(s, MPEG_CID(HEADER_MODE), 
MPEG_VIDEO(HEADER_MODE_SEPARATE), "header mode", 0);
+v4l2_set_ext_ctrl(s, MPEG_CID(BITRATE_MODE), MPEG_VIDEO(BITRATE_MODE_CBR), 
"bit rate mode", 1);
 v4l2_set_ext_ctrl(s, MPEG_CID(BITRATE) , avctx->bit_rate, "bit rate", 1);
 v4l2_set_ext_ctrl(s, MPEG_CID(FRAME_RC_ENABLE), 1, "frame level rate 
control", 0);
 v4l2_set_ext_ctrl(s, MPEG_CID(GOP_SIZE), avctx->gop_size,"gop size", 1);
-- 
2.26.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".

Re: [FFmpeg-devel] [PATCH v2] lavf/mp3enc: fix ID3v1 year metadata setting issue

2020-04-29 Thread myp...@gmail.com
On Sun, Apr 26, 2020 at 10:20 PM myp...@gmail.com  wrote:
>
> On Wed, Apr 22, 2020 at 3:57 PM Jun Zhao  wrote:
> >
> > From: Jun Zhao 
> >
> > Follow the http://id3.org/ID3v1, setting the year metadata
> > for ID3v1.
> >
> > fix #8623
> >
> > Signed-off-by: Jun Zhao 
> > ---
> >  libavformat/mp3enc.c | 13 -
> >  1 file changed, 12 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
> > index 34b753f..14d4b6e 100644
> > --- a/libavformat/mp3enc.c
> > +++ b/libavformat/mp3enc.c
> > @@ -45,6 +45,7 @@ static int id3v1_set_string(AVFormatContext *s, const 
> > char *key,
> >  return !!tag;
> >  }
> >
> > +// refer to: http://id3.org/ID3v1
> >  static int id3v1_create_tag(AVFormatContext *s, uint8_t *buf)
> >  {
> >  AVDictionaryEntry *tag;
> > @@ -58,7 +59,17 @@ static int id3v1_create_tag(AVFormatContext *s, uint8_t 
> > *buf)
> >  count += id3v1_set_string(s, "TIT2",buf +  3, 30 + 1);   
> > //title
> >  count += id3v1_set_string(s, "TPE1",buf + 33, 30 + 1);   
> > //author|artist
> >  count += id3v1_set_string(s, "TALB",buf + 63, 30 + 1);   
> > //album
> > -count += id3v1_set_string(s, "TDRC",buf + 93,  4 + 1);   //date
> > +if ((tag = av_dict_get(s->metadata, "TYER", NULL, 0))) { //year
> > +av_strlcpy(buf + 93, tag->value, 4 + 1);
> > +count++;
> > +} else if ((tag = av_dict_get(s->metadata, "TDRC", NULL, 0))) {
> > +av_strlcpy(buf + 93, tag->value, 4 + 1);
> > +count++;
> > +} else if ((tag = av_dict_get(s->metadata, "TDAT", NULL, 0))) {
> > +av_strlcpy(buf + 93, tag->value, 4 + 1);
> > +count++;
> > +}
> > +
> >  count += id3v1_set_string(s, "comment", buf + 97, 30 + 1);
> >  if ((tag = av_dict_get(s->metadata, "TRCK", NULL, 0))) { //track
> >  buf[125] = 0;
> > --
> > 2.7.4
> >
> ping ?
Will apply, tks
___
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: compute segment duration use current pts minus last segment end pts

2020-04-29 Thread myp...@gmail.com
On Wed, Apr 29, 2020 at 12:44 PM Steven Liu  wrote:
>
> segment duration is using vs duration which compute by frame per second,
> that can not fix problem of VFR video stream, so compute the duration
> when split the segment, set the segment target duration use
> current packet pts minus the prev segment end pts and plus current
> packet's duration.
>
> Reported-by: Zhao Jun 
> Signed-off-by: Steven Liu 
> ---
>  libavformat/hlsenc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index d75684741f..9e8b34d83c 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -2460,7 +2460,8 @@ static int hls_write_packet(AVFormatContext *s, 
> AVPacket *pkt)
>  }
>
>  if (vs->start_pos || hls->segment_type != SEGMENT_TYPE_FMP4) {
> -ret = hls_append_segment(s, hls, vs, vs->duration, 
> vs->start_pos, vs->size);
> +double cur_duration =  (double)(pkt->pts - vs->end_pts) * 
> st->time_base.num / st->time_base.den + vs->dpp;
> +ret = hls_append_segment(s, hls, vs, cur_duration, 
> vs->start_pos, vs->size);
>  vs->end_pts = pkt->pts;
>  vs->duration = 0;
>  if (ret < 0) {
> --
> 2.25.0
>
>
LGTM, Tested and verified, tks the quick fix.
___
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 v1 4/6] avformat/dashenc: use av_reallocp_array()

2020-04-29 Thread Jeyapal, Karthick

On 4/26/20 5:34 PM, Jeyapal, Karthick wrote:
>
> On 4/26/20 3:19 PM, lance.lmw...@gmail.com wrote:
>> From: Limin Wang 
>>
>> Signed-off-by: Limin Wang 
>> ---
>>  libavformat/dashenc.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
>> index 96c0ea3..e3e187c 100644
>> --- a/libavformat/dashenc.c
>> +++ b/libavformat/dashenc.c
>> @@ -1731,7 +1731,7 @@ static int add_segment(OutputStream *os, const char 
>> *file,
>>  Segment *seg;
>>  if (os->nb_segments >= os->segments_size) {
>>  os->segments_size = (os->segments_size + 1) * 2;
>> -if ((err = av_reallocp(>segments, sizeof(*os->segments) *
>> +if ((err = av_reallocp_array(>segments, sizeof(*os->segments),
>> os->segments_size)) < 0) {
>>  os->segments_size = 0;
>>  os->nb_segments = 0;
> LGTM

Pushed all three dashenc patches from this patchset.

>
> ___
> 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".