Commit 83ab7f73 authored by Håvard Graff's avatar Håvard Graff Committed by Håvard Graff

rtpjitterbuffer: add DTX functionality

Some audio-codecs (like opus) uses DTX (Discontinuous transmission),
in the way that they simply stop sending audio-packets when there is
no audio detected.

The expectation is then that the codec will use its internal PLC (packet
loss concealment) to create packets in place of those missing.

This patch is reusing the timer already existing for RTX and lost-events,
scheduling a lost-timer for the next sequence-number based on the
inter-packet spacing.
parent 1095a80e
Pipeline #156520 passed with stages
in 27 minutes and 32 seconds
This diff is collapsed.
......@@ -680,6 +680,25 @@ rtp_timer_queue_set_deadline (RtpTimerQueue * queue, guint16 seqnum,
0, offset);
}
/**
* rtp_timer_queue_set_dtx:
* @queue: the #RtpTimerQueue
* @senum: the timer seqnum
* @timeout: the timer timeout
* @duration: the duration of the event related to the timer
* @offset: offset that can be used to convert the timeout to timestamp
*
* Specialized version of rtp_timer_queue_set_timer() that creates or updates a
* timer with type %RTP_TIMER_DTX.
*/
void
rtp_timer_queue_set_dtx (RtpTimerQueue * queue, guint16 seqnum,
GstClockTime timeout, GstClockTime duration, GstClockTimeDiff offset)
{
rtp_timer_queue_set_timer (queue, RTP_TIMER_DTX, seqnum, timeout, 0,
duration, offset);
}
/**
* rtp_timer_queue_update_timer:
* @queue: the #RtpTimerQueue
......
......@@ -45,13 +45,16 @@ G_DECLARE_FINAL_TYPE (RtpTimerQueue, rtp_timer_queue, RTP_TIMER, QUEUE, GObject)
* @RTP_TIMER_DEADLINE: This is used to track when the jitterbuffer should
* start pushing buffers.
* @RTP_TIMER_EOS: This is used to track when end of stream is reached.
* @RTP_TIMER_DTX: This is used to track when to push out a GAP event
for decoders to do concealment.
*/
typedef enum
{
RTP_TIMER_EXPECTED,
RTP_TIMER_LOST,
RTP_TIMER_DEADLINE,
RTP_TIMER_EOS
RTP_TIMER_EOS,
RTP_TIMER_DTX,
} RtpTimerType;
typedef struct
......@@ -119,6 +122,9 @@ void rtp_timer_queue_set_eos (RtpTimerQueue * queue, GstClockTime tim
GstClockTimeDiff offset);
void rtp_timer_queue_set_deadline (RtpTimerQueue * queue, guint16 seqnum,
GstClockTime timeout, GstClockTimeDiff offset);
void rtp_timer_queue_set_dtx (RtpTimerQueue * queue, guint16 seqnum,
GstClockTime timeout, GstClockTime duration,
GstClockTimeDiff offset);
void rtp_timer_queue_update_timer (RtpTimerQueue * queue, RtpTimer * timer, guint16 seqnum,
GstClockTime timeout, GstClockTime delay,
GstClockTimeDiff offset, gboolean reset);
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment