opusparse: subtract clipped audio to buffer duration
@ntrrgc
Submitted by Alicia Boya García Link to original bug (#791099)
Description
opusparse is not subtracting codec delay from the buffer duration.
Generate test vector:
$ gst-launch-1.0 audiotestsrc num-buffers=1 samplesperbuffer=24000 ! audio/x-raw, rate=48000 ! opusenc ! identity error-after=2 ! webmmux ! filesink location=/tmp/audio-clipping-test-vector.webm
Test:
$ gst-launch-1.0 -v pushfilesrc location=/tmp/audio-clipping-test-vector.webm \
! matroskademux ! identity name="after_matroskademux" silent=false \
! opusparse ! identity name="after_opusparse" silent=false \
! opusdec ! identity name="after_opusdec" silent=false \
! fakesink 2>&1 |grep chain
/GstPipeline:pipeline0/GstIdentity:after_matroskademux: last-message = chain ******* (after_matroskademux:sink) (160 bytes, dts: none, pts: 0:00:00.000000000, duration: 0:00:00.013500000, offset: -1, offset_end: -1, flags: 00004040 discont tag-memory , meta: GstAudioClippingMeta) 0x7f13c800a060
/GstPipeline:pipeline0/GstIdentity:after_opusparse: last-message = chain ******* (after_opusparse:sink) (160 bytes, dts: 0:00:00.000000000, pts: 0:00:00.000000000, duration: 0:00:00.020000000, offset: 20000000, offset_end: 960, flags: 00004040 discont tag-memory , meta: GstAudioClippingMeta) 0x7f13c800a060
/GstPipeline:pipeline0/GstIdentity:after_opusdec: last-message = chain ******* (after_opusdec:sink) (1296 bytes, dts: none, pts: 0:00:00.000000000, duration: 0:00:00.013500000, offset: -1, offset_end: -1, flags: 00000040 discont , meta: none) 0x7f13c800ab00
Note the inconsistency in durations and GstAudioClippingMeta:
Expected*:
matroskademux ------------> opusparse -----------> opusdec ------------>
13.5ms 13.5ms 13.5ms
clip meta clip meta no clip meta
Actual:
matroskademux ------------> opusparse -----------> opusdec ------------>
13.5ms 20.0ms 13.5ms
clip meta clip meta no clip meta
- I'm supposing that GstBuffer durations should already have GstAudioClippingMeta subtracted. I could not find any hints in the documentation one way or the other, so I'm picking sides with matroskademux because is gst-plugins-good. In any case, the current behavior is definitively inconsistent because matroskademux is subtracting them while opusparse is not.