Due to an influx of spam, we have had to impose restrictions on new accounts. Please see this wiki page for instructions on how to get full permissions. Sorry for the inconvenience.
Admin message
Welcome to our new datacenter. The migration is still not over, but we try to bring up the service to the best we can. There are some parts not working yet (shared runners, previous job logs, previous job artifacts, ... ) but we try to do our best.
We do not guarantee data while the migration is not over, please consider this as read-only
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.
Version: 1.10.x
Designs
Child items
0
Show closed items
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Linked items
0
Link issues together to show that they're related.
Learn more.
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?
in fact the non multi stream api tells:
"If the return value is 2 bytes or less, then the packet does not need to be transmitted (DTX)"
I was not able to find a reasonable information about the multi stream api.
so I played around with the amount of channels and encoding parameters.
It looks like, if opus is able to actually perform dtx it adds a TOC and a 0 length octet, skipping the length octet for the last stream.
is checking for dtx property enough?
does it make sense to check for
outsize > (2*(enc->n_channels - enc->n_stereo_streams))
imo >= should not be needed, as adding another length octet would require a payload to exists.
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.
RFC 7587 does not include multiple streams as also rtpopuspay does not include it
You should push a GAP event instead of a buffer. It seems that the base class has nothing to help, so something like ret = gst_pad_push (encoder->srcpad, timestamp, duration); should be enough if the finish frame didnt return an error.
the buffer wrapped around the data in the adapter does not carry the time information. Should this be generated by gst_audio_encoder_push_buffers?
Maybe it is a good idea to go the way speexenc did?
Just marking the buffer with GST_BUFFER_FLAG_GAP, and dropping it in rtpopuspay?
Another option would be to add the event to gst_audio_encoder_finish_frame where all required information seems to be available, but I'm unsure about this.
Sorry for bothering you with another question.
Do you think the dtx-drop feature should be optional?
Without a property this may break existing implementations.
The comfort noise generation in opus is not triggered,
also the jitterbuffer goes crazy, maybe dropping valid audio data.
This is the same situation for speex, but it may be acceptable depending on the use-case.
having a dtx aware jitterbuffer would be cool, but this is another story, and much more complicated than this simple changes...
Marking it as FLAG_GAP, and then dropping it either in the payloader or pre_push() both seem fine. The question is how muxing to Ogg (or other containers) is affected by dropping DTX frames.
Comfort noise generation should be triggered when the jitterbuffer emits an event because an expected buffer is missing.
I'm not sure what a drop-dtx property would do more than just turning off DTX in practice, for Opus, the codec compresses enough that I would expect that the overhead of sending "empty" dtx packets would make you lose half of the benefit anyway.
If the jitterbuffer goes crazy in presence of DTX, this is definitely something that should be fixed in the JB. DTX is a real world feature we should support.
Marking it as FLAG_GAP, and then dropping it either in the payloader or
pre_push() both seem fine. The question is how muxing to Ogg (or other
containers) is affected by dropping DTX frames.
I decided to drop in the payloader, so everything on a local machine is not affected by this change. I expect the issues in a muxer will be the same as for e.g. pulsesink "discontinuity in audio"
Comfort noise generation should be triggered when the jitterbuffer emits an
event because an expected buffer is missing.
see below
I'm not sure what a drop-dtx property would do more than just turning off
DTX in practice, for Opus, the codec compresses enough that I would expect
that the overhead of sending "empty" dtx packets would make you lose half of
the benefit anyway.
100% ACK.
If the jitterbuffer goes crazy in presence of DTX, this is definitely
something that should be fixed in the JB. DTX is a real world feature we
should support.
I'm in doubt I won't have the time to look into this in the near future.
At least I opened a new bug report documenting what I know so far.