diff mbox series

[FFmpeg-devel] avcodec/dolby_e: set constant frame_size

Message ID 20201001132237.1409-1-nicolas.gaullier@cji.paris
State Superseded
Headers show
Series [FFmpeg-devel] avcodec/dolby_e: set constant frame_size | expand

Checks

Context Check Description
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Nicolas Gaullier Oct. 1, 2020, 1:22 p.m. UTC
Fixes pts generation.
---
 libavcodec/dolby_e.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Anton Khirnov Oct. 2, 2020, 9:34 a.m. UTC | #1
Quoting Nicolas Gaullier (2020-10-01 15:22:37)
> Fixes pts generation.
> ---
>  libavcodec/dolby_e.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavcodec/dolby_e.c b/libavcodec/dolby_e.c
> index 429612ec08..b0e6d6aee3 100644
> --- a/libavcodec/dolby_e.c
> +++ b/libavcodec/dolby_e.c
> @@ -577,6 +577,7 @@ static int filter_frame(DBEContext *s, AVFrame *frame)
>          reorder = ch_reorder_n;
>  
>      frame->nb_samples = FRAME_SAMPLES;
> +    s->avctx->frame_size = FRAME_SAMPLES;

Wouldn't it make more sense to set it in decoder init?
Nicolas Gaullier Oct. 2, 2020, 10:12 p.m. UTC | #2
>Wouldn't it make more sense to set it in decoder init?
>Anton Khirnov

Yes, you're right, in the actual code, this would seem the best place.
But, I have in mind to add support for s337m in wav (I am just getting back on this work I started some months ago).
Take a 48k wav with dolby_e in it which rate is 44800 for example (this is my test case actually).
Here is the diff (+frame_size set on init / -frame_size set on decode frame)
-0,          0,          0,     1920,    11496, 0x05a9c147
-0,       1920,       1920,     1920,    11496, 0x1d44d2b4
-0,       3840,       3840,     1920,    11496, 0x4e078953
-0,       5760,       5760,     1920,    11496, 0x1c73b1a1
-0,       7680,       7680,     1920,    11262, 0xfa179fc8
+0,          0,          0,     1792,    11496, 0x05a9c147
+0,       1792,       1792,     1920,    11496, 0x1d44d2b4
+0,       3712,       3712,     1920,    11496, 0x4e078953
+0,       5632,       5632,     1920,    11496, 0x1c73b1a1
+0,       7552,       7552,     1920,    11262, 0xfa179fc8

The problem is the duration of the first audio frame. The mismatch is because of the difference of sample_rate between the mux/wav and the stream/dolby_e.
Anyway, my proposal is that I will send my complete patchset including this patch, so you can review the global project and continue the discussion.
I think the way I have integrated s377m in wav is ok, but the lack of a parser for dolby_e (and thus early sample rate detection) makes things a little bit tricky.

Nicolas
diff mbox series

Patch

diff --git a/libavcodec/dolby_e.c b/libavcodec/dolby_e.c
index 429612ec08..b0e6d6aee3 100644
--- a/libavcodec/dolby_e.c
+++ b/libavcodec/dolby_e.c
@@ -577,6 +577,7 @@  static int filter_frame(DBEContext *s, AVFrame *frame)
         reorder = ch_reorder_n;
 
     frame->nb_samples = FRAME_SAMPLES;
+    s->avctx->frame_size = FRAME_SAMPLES;
     if ((ret = ff_get_buffer(s->avctx, frame, 0)) < 0)
         return ret;