mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-20 04:56:24 +00:00
basertpaudiopayload: Add extra frame for non-complete frame lengths
Some payloaders like rtpg729pay can add a shorter frame at the end of a RTP packet. We need to count it like a full frame for timestamps. https://bugzilla.gnome.org/show_bug.cgi?id=618324
This commit is contained in:
parent
8a2b81a576
commit
0a24137100
1 changed files with 13 additions and 2 deletions
|
@ -722,16 +722,27 @@ static GstClockTime
|
||||||
gst_base_rtp_audio_payload_frame_bytes_to_time (GstBaseRTPAudioPayload *
|
gst_base_rtp_audio_payload_frame_bytes_to_time (GstBaseRTPAudioPayload *
|
||||||
payload, guint64 bytes)
|
payload, guint64 bytes)
|
||||||
{
|
{
|
||||||
return (bytes / payload->frame_size) * (payload->priv->frame_duration_ns);
|
guint64 framecount;
|
||||||
|
|
||||||
|
framecount = bytes / payload->frame_size;
|
||||||
|
if (G_UNLIKELY (bytes % payload->frame_size))
|
||||||
|
framecount++;
|
||||||
|
|
||||||
|
return framecount * payload->priv->frame_duration_ns;
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint32
|
static guint32
|
||||||
gst_base_rtp_audio_payload_frame_bytes_to_rtptime (GstBaseRTPAudioPayload *
|
gst_base_rtp_audio_payload_frame_bytes_to_rtptime (GstBaseRTPAudioPayload *
|
||||||
payload, guint64 bytes)
|
payload, guint64 bytes)
|
||||||
{
|
{
|
||||||
|
guint64 framecount;
|
||||||
guint64 time;
|
guint64 time;
|
||||||
|
|
||||||
time = (bytes / payload->frame_size) * (payload->priv->frame_duration_ns);
|
framecount = bytes / payload->frame_size;
|
||||||
|
if (G_UNLIKELY (bytes % payload->frame_size))
|
||||||
|
framecount++;
|
||||||
|
|
||||||
|
time = framecount * payload->priv->frame_duration_ns;
|
||||||
|
|
||||||
return gst_util_uint64_scale_int (time,
|
return gst_util_uint64_scale_int (time,
|
||||||
GST_BASE_RTP_PAYLOAD (payload)->clock_rate, GST_SECOND);
|
GST_BASE_RTP_PAYLOAD (payload)->clock_rate, GST_SECOND);
|
||||||
|
|
Loading…
Reference in a new issue