opusenc does not discard silence if DTX enabled
Submitted by Nubosch
if dtx is enabled and silence is detected opusenc should only encode 1 frame each 400ms, as stated in RFC 6716, 2.1.9.
in function gst_opus_enc_encode() 1 is returned from opus_multistream_encode(), signaling the frame should be discarded cause of detected silence.
Each 400ms a value != 1 is returned from opus_multistream_encode().
I use the attached patch to discard the frame.
can you tell me why this might be a bad idea?
I use this pipeline for testing
gst-launch-1.0 pulsesrc ! "audio/x-raw,channels=1,rate=48000" ! opusenc audio-type=2048 bandwidth=1103 bitrate=20000 bitrate-type=1 inband-fec=TRUE packet-loss-percentage=1 dtx=TRUE ! fakesink
I came across this while measuring network bandwidth using opusenc with dtx and rtpopuspay.
The packet rate was constant, one packet each 20ms.
There where packets containing only one single RTP payload byte.
With the attached patch the packet rate is irregular with a minimum of one packet each 400ms, always containing multiple bytes.