mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
rtpasfpay: set padding field to 0 on rtp asf packets
The ASF RTP spec demands that packets have their padding removed and the padding size field set to 0 for packets when puting them inside the RTP packets
This commit is contained in:
parent
7583bf6813
commit
88e399aac2
3 changed files with 40 additions and 1 deletions
|
@ -521,6 +521,7 @@ gst_asf_parse_packet (GstBuffer * buffer, GstAsfPacketInfo * packet,
|
|||
GstByteReader *reader;
|
||||
gboolean ret = TRUE;
|
||||
guint8 first;
|
||||
guint8 err_length = 0; /* length of the error fields */
|
||||
guint8 aux;
|
||||
guint8 packet_len_type;
|
||||
guint8 padding_len_type;
|
||||
|
@ -543,6 +544,7 @@ gst_asf_parse_packet (GstBuffer * buffer, GstAsfPacketInfo * packet,
|
|||
|
||||
if (first & 0x80) { /* error correction present */
|
||||
guint8 err_cor_len;
|
||||
err_length += 1;
|
||||
GST_DEBUG ("Packet contains error correction");
|
||||
if (first & 0x60) {
|
||||
GST_ERROR ("Error correction data length should be "
|
||||
|
@ -550,9 +552,12 @@ gst_asf_parse_packet (GstBuffer * buffer, GstAsfPacketInfo * packet,
|
|||
return FALSE;
|
||||
}
|
||||
err_cor_len = (first & 0x0F);
|
||||
err_length += err_cor_len;
|
||||
GST_DEBUG ("Error correction data length: %d", (gint) err_cor_len);
|
||||
if (!gst_byte_reader_skip (reader, err_cor_len))
|
||||
goto error;
|
||||
|
||||
/* put payload parsing info first byte in aux var */
|
||||
if (!gst_byte_reader_get_uint8 (reader, &aux))
|
||||
goto error;
|
||||
} else {
|
||||
|
@ -631,6 +636,11 @@ gst_asf_parse_packet (GstBuffer * buffer, GstAsfPacketInfo * packet,
|
|||
packet->send_time = send_time;
|
||||
packet->duration = duration;
|
||||
packet->has_keyframe = has_keyframe;
|
||||
packet->multiple_payloads = mult_payloads ? TRUE : FALSE;
|
||||
packet->padd_field_type = padding_len_type;
|
||||
packet->packet_field_type = packet_len_type;
|
||||
packet->seq_field_type = seq_len_type;
|
||||
packet->err_cor_len = err_length;
|
||||
|
||||
gst_byte_reader_free (reader);
|
||||
return ret;
|
||||
|
|
|
@ -46,6 +46,12 @@ typedef struct _GstAsfFileInfo
|
|||
|
||||
typedef struct _GstAsfPacketInfo
|
||||
{
|
||||
guint8 err_cor_len;
|
||||
gboolean multiple_payloads;
|
||||
guint8 padd_field_type;
|
||||
guint8 packet_field_type;
|
||||
guint8 seq_field_type;
|
||||
|
||||
guint32 packet_size;
|
||||
guint32 padding;
|
||||
guint32 send_time;
|
||||
|
|
|
@ -154,7 +154,30 @@ gst_rtp_asf_pay_handle_packet (GstRtpAsfPay * rtpasfpay, GstBuffer * buffer)
|
|||
", padding: %" G_GUINT32_FORMAT, packetinfo->packet_size,
|
||||
packetinfo->padding);
|
||||
|
||||
/* FIXME - should update the padding field to 0 */
|
||||
/* update padding field to 0 */
|
||||
if (packetinfo->padding > 0) {
|
||||
GstAsfPacketInfo info;
|
||||
/* find padding field offset */
|
||||
guint offset = packetinfo->err_cor_len + 2 +
|
||||
gst_asf_get_var_size_field_len (packetinfo->packet_field_type) +
|
||||
gst_asf_get_var_size_field_len (packetinfo->seq_field_type);
|
||||
buffer = gst_buffer_make_writable (buffer);
|
||||
switch (packetinfo->padd_field_type) {
|
||||
case ASF_FIELD_TYPE_DWORD:
|
||||
GST_WRITE_UINT32_LE (&(GST_BUFFER_DATA (buffer)[offset]), 0);
|
||||
break;
|
||||
case ASF_FIELD_TYPE_WORD:
|
||||
GST_WRITE_UINT16_LE (&(GST_BUFFER_DATA (buffer)[offset]), 0);
|
||||
break;
|
||||
case ASF_FIELD_TYPE_BYTE:
|
||||
GST_BUFFER_DATA (buffer)[offset] = 0;
|
||||
break;
|
||||
case ASF_FIELD_TYPE_NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
gst_asf_parse_packet (buffer, &info, FALSE);
|
||||
}
|
||||
|
||||
packet_util_size = packetinfo->packet_size - packetinfo->padding;
|
||||
packet_offset = 0;
|
||||
|
|
Loading…
Reference in a new issue