From a5e93b70620bb737fb48d1d992e819a78bea1fbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alicia=20Boya=20Garc=C3=ADa?= Date: Fri, 16 Feb 2018 23:40:50 +0100 Subject: [PATCH] matroskademux: Add comment about Opus clipping https://bugzilla.gnome.org/show_bug.cgi?id=793523 --- gst/matroska/matroska-demux.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c index f3bf76366b..fa9edc7055 100644 --- a/gst/matroska/matroska-demux.c +++ b/gst/matroska/matroska-demux.c @@ -4057,6 +4057,13 @@ gst_matroska_demux_parse_blockgroup_or_simpleblock (GstMatroskaDemux * demux, GST_BUFFER_PTS (sub) -= stream->codec_delay; } else { GST_BUFFER_PTS (sub) = 0; + + /* Opus GstAudioClippingMeta units are scaled by 48000/sample_rate. + That is, if a Opus track has audio encoded at 24000 Hz and 132 + samples need to be clipped, GstAudioClippingMeta.start will be + set to 264. (This is also the case for buffer offsets.) + Opus sample rates are always divisors of 48000 Hz, which is the + maximum allowed sample rate. */ start_clip = gst_util_uint64_scale_round (stream->codec_delay, 48000, GST_SECOND);