Re: [FFmpeg-devel] [PATCH] lavf/dauddec: set timebase to 1/samplerate

2023-04-27 Thread Paul B Mahol
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".


[FFmpeg-devel] [PATCH] lavf/dauddec: set timebase to 1/samplerate

2023-04-27 Thread Anton Khirnov
Prevents lavf from generating inexact timestamps with the default
timebase of 1/9.
---
 libavformat/dauddec.c |  4 
 tests/ref/fate/d-cinema-demux | 10 +-
 tests/ref/fate/dcinema-encode | 26 +-
 3 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/libavformat/dauddec.c b/libavformat/dauddec.c
index 0cbf7e4e36..7e411091ec 100644
--- a/libavformat/dauddec.c
+++ b/libavformat/dauddec.c
@@ -21,6 +21,7 @@
 
 #include "libavutil/channel_layout.h"
 #include "avformat.h"
+#include "internal.h"
 
 static int daud_header(AVFormatContext *s) {
 AVStream *st = avformat_new_stream(s, NULL);
@@ -34,6 +35,9 @@ static int daud_header(AVFormatContext *s) {
 st->codecpar->bit_rate = 3 * 6 * 96000 * 8;
 st->codecpar->block_align = 3 * 6;
 st->codecpar->bits_per_coded_sample = 24;
+
+avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
+
 return 0;
 }
 
diff --git a/tests/ref/fate/d-cinema-demux b/tests/ref/fate/d-cinema-demux
index f1e8b5f755..e517c20e76 100644
--- a/tests/ref/fate/d-cinema-demux
+++ b/tests/ref/fate/d-cinema-demux
@@ -1,9 +1,9 @@
-#tb 0: 1/9
+#tb 0: 1/96000
 #media_type 0: audio
 #codec_id 0: pcm_s24daud
 #sample_rate 0: 96000
 #channel_layout_name 0: 5.1(side)
-0,  0,  0, 1875,36000, 0xd592781d
-0,   1875,   1875, 1875,36000, 0xd592781d
-0,   3750,   3750, 1875,36000, 0xd592781d
-0,   5625,   5625, 1200,23056, 0xde81f0d6, F=0x3
+0,  0,  0, 2000,36000, 0xd592781d
+0,   2000,   2000, 2000,36000, 0xd592781d
+0,   4000,   4000, 2000,36000, 0xd592781d
+0,   6000,   6000, 1280,23056, 0xde81f0d6, F=0x3
diff --git a/tests/ref/fate/dcinema-encode b/tests/ref/fate/dcinema-encode
index 471820dbda..fabbc034f0 100644
--- a/tests/ref/fate/dcinema-encode
+++ b/tests/ref/fate/dcinema-encode
@@ -9,21 +9,21 @@
 #stream#, dts,pts, duration, size, hash
 0,  0,  0,  341, 4092, 697cddfcd0e21f24782af0705b7048f3
 0,341,341,  341, 4092, a057b18cd493923fed33c18578f61e0b
-0,683,683,  341, 4092, f4eacfd888566040067b8e5ce7d276c6
-0,   1024,   1024,  341, 4092, 4de78d332ce2047014880a110c160dc2
+0,682,682,  341, 4092, f4eacfd888566040067b8e5ce7d276c6
+0,   1023,   1023,  341, 4092, 4de78d332ce2047014880a110c160dc2
 0,   1364,   1364,  341, 4092, 138ee3fc206538feca6de3d6d62d08eb
-0,   1706,   1706,  341, 4092, 187a2f2998aa1c0ba0130c57dd1d6c86
-0,   2047,   2047,  341, 4092, 54e6c3db8a5f8c09b47f025659a36b17
+0,   1705,   1705,  341, 4092, 187a2f2998aa1c0ba0130c57dd1d6c86
+0,   2046,   2046,  341, 4092, 54e6c3db8a5f8c09b47f025659a36b17
 0,   2387,   2387,  341, 4092, 8abfdf44a24c158429c71e01cee31e20
-0,   2729,   2729,  341, 4092, bd08f5018edc5dc4520739e913ed89a3
-0,   3070,   3070,  341, 4092, 9f60ba4275646344e4a9b3c647efffe9
-0,   3411,   3411,  341, 4092, 00cefc1f27230cdd06ecd43132e16327
+0,   2728,   2728,  341, 4092, bd08f5018edc5dc4520739e913ed89a3
+0,   3069,   3069,  341, 4092, 9f60ba4275646344e4a9b3c647efffe9
+0,   3410,   3410,  341, 4092, 00cefc1f27230cdd06ecd43132e16327
 0,   3751,   3751,  341, 4092, d4d13047cd639ed722a4ae1bc1f06991
-0,   4093,   4093,  341, 4092, 16b227e4f968c11cba279506f00d5172
-0,   4434,   4434,  341, 4092, 70f4046f709fdd4d80e2f2ffc862f21a
+0,   4092,   4092,  341, 4092, 16b227e4f968c11cba279506f00d5172
+0,   4433,   4433,  341, 4092, 70f4046f709fdd4d80e2f2ffc862f21a
 0,   4774,   4774,  341, 4092, adbef4b4ef728f0c2a31b4b0baba50a0
-0,   5116,   5116,  341, 4092, fe009b6cc96b9d1098dcc5fba0e6b3fa
-0,   5457,   5457,  341, 4092, 4462b2f1654c9b31fdd7ab04ffb84192
+0,   5115,   5115,  341, 4092, fe009b6cc96b9d1098dcc5fba0e6b3fa
+0,   5456,   5456,  341, 4092, 4462b2f1654c9b31fdd7ab04ffb84192
 0,   5797,   5797,  341, 4092, 2e96ba3bd13de03f9cfdc2b8c3ea0620
-0,   6139,   6139,  341, 4092, 395c920f10cce6670029a98095eba027
-0,   6480,   6480,  341, 4092, 28d4c2f6364f31cb61f4aa144badc734
+0,   6138,   6138,  341, 4092, 395c920f10cce6670029a98095eba027
+0,   6479,   6479,  341, 4092, 28d4c2f6364f31cb61f4aa144badc734
-- 
2.39.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".