rtp: Copy metadata in the (de)payloader, but only the relevant ones

The payloader didn't copy anything so far, the depayloader copied every
possible meta. Let's make it consistent and just copy all metas without
tags or with only the video tag.

https://bugzilla.gnome.org/show_bug.cgi?id=751774
This commit is contained in:
Sebastian Dröge 2015-08-04 20:59:17 +03:00
parent 288b0bbb38
commit b1089fb520
69 changed files with 628 additions and 122 deletions

View file

@ -84,7 +84,8 @@ libgstrtp_la_SOURCES = \
gstrtpvrawdepay.c \ gstrtpvrawdepay.c \
gstrtpvrawpay.c \ gstrtpvrawpay.c \
gstrtpstreampay.c \ gstrtpstreampay.c \
gstrtpstreamdepay.c gstrtpstreamdepay.c \
gstrtputils.c
libgstrtp_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) \ libgstrtp_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) \
$(GST_CFLAGS) -Dvp8_norm=gst_rtpvp8_vp8_norm \ $(GST_CFLAGS) -Dvp8_norm=gst_rtpvp8_vp8_norm \
@ -185,6 +186,7 @@ noinst_HEADERS = \
gstrtpvrawdepay.h \ gstrtpvrawdepay.h \
gstrtpvrawpay.h \ gstrtpvrawpay.h \
gstrtpstreampay.h \ gstrtpstreampay.h \
gstrtpstreamdepay.h gstrtpstreamdepay.h \
gstrtputils.h
EXTRA_DIST = dboolhuff.LICENSE EXTRA_DIST = dboolhuff.LICENSE

View file

@ -44,6 +44,7 @@
#include "gstrtpL16depay.h" #include "gstrtpL16depay.h"
#include "gstrtpchannels.h" #include "gstrtpchannels.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpL16depay_debug); GST_DEBUG_CATEGORY_STATIC (rtpL16depay_debug);
#define GST_CAT_DEFAULT (rtpL16depay_debug) #define GST_CAT_DEFAULT (rtpL16depay_debug)
@ -257,6 +258,9 @@ gst_rtp_L16_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
goto reorder_failed; goto reorder_failed;
} }
gst_rtp_drop_meta (GST_ELEMENT_CAST (rtpL16depay), outbuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
return outbuf; return outbuf;
/* ERRORS */ /* ERRORS */

View file

@ -44,6 +44,7 @@
#include "gstrtpL24depay.h" #include "gstrtpL24depay.h"
#include "gstrtpchannels.h" #include "gstrtpchannels.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpL24depay_debug); GST_DEBUG_CATEGORY_STATIC (rtpL24depay_debug);
#define GST_CAT_DEFAULT (rtpL24depay_debug) #define GST_CAT_DEFAULT (rtpL24depay_debug)
@ -228,6 +229,10 @@ gst_rtp_L24_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
} }
outbuf = gst_buffer_make_writable (outbuf); outbuf = gst_buffer_make_writable (outbuf);
if (outbuf) {
gst_rtp_drop_meta (GST_ELEMENT_CAST (rtpL24depay), outbuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
}
if (rtpL24depay->order && if (rtpL24depay->order &&
!gst_audio_buffer_reorder_channels (outbuf, !gst_audio_buffer_reorder_channels (outbuf,
rtpL24depay->info.finfo->format, rtpL24depay->info.channels, rtpL24depay->info.finfo->format, rtpL24depay->info.channels,

View file

@ -38,9 +38,11 @@
#endif #endif
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include <string.h> #include <string.h>
#include "gstrtpac3depay.h" #include "gstrtpac3depay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpac3depay_debug); GST_DEBUG_CATEGORY_STATIC (rtpac3depay_debug);
#define GST_CAT_DEFAULT (rtpac3depay_debug) #define GST_CAT_DEFAULT (rtpac3depay_debug)
@ -153,9 +155,12 @@ gst_rtp_ac3_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
/* We don't bother with fragmented packets yet */ /* We don't bother with fragmented packets yet */
outbuf = gst_rtp_buffer_get_payload_subbuffer (rtp, 2, -1); outbuf = gst_rtp_buffer_get_payload_subbuffer (rtp, 2, -1);
if (outbuf) if (outbuf) {
gst_rtp_drop_meta (GST_ELEMENT_CAST (rtpac3depay), outbuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
GST_DEBUG_OBJECT (rtpac3depay, "pushing buffer of size %" G_GSIZE_FORMAT, GST_DEBUG_OBJECT (rtpac3depay, "pushing buffer of size %" G_GSIZE_FORMAT,
gst_buffer_get_size (outbuf)); gst_buffer_get_size (outbuf));
}
return outbuf; return outbuf;

View file

@ -40,8 +40,10 @@
#include <string.h> #include <string.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtpac3pay.h" #include "gstrtpac3pay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpac3pay_debug); GST_DEBUG_CATEGORY_STATIC (rtpac3pay_debug);
#define GST_CAT_DEFAULT (rtpac3pay_debug) #define GST_CAT_DEFAULT (rtpac3pay_debug)
@ -321,6 +323,9 @@ gst_rtp_ac3_pay_flush (GstRtpAC3Pay * rtpac3pay)
payload_buffer = payload_buffer =
gst_adapter_take_buffer_fast (rtpac3pay->adapter, payload_len); gst_adapter_take_buffer_fast (rtpac3pay->adapter, payload_len);
gst_rtp_copy_meta (GST_ELEMENT_CAST (rtpac3pay), outbuf, payload_buffer,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
outbuf = gst_buffer_append (outbuf, payload_buffer); outbuf = gst_buffer_append (outbuf, payload_buffer);
avail -= payload_len; avail -= payload_len;

View file

@ -44,10 +44,12 @@
#endif #endif
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "gstrtpamrdepay.h" #include "gstrtpamrdepay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpamrdepay_debug); GST_DEBUG_CATEGORY_STATIC (rtpamrdepay_debug);
#define GST_CAT_DEFAULT (rtpamrdepay_debug) #define GST_CAT_DEFAULT (rtpamrdepay_debug)
@ -304,6 +306,7 @@ gst_rtp_amr_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
gint i, num_packets, num_nonempty_packets; gint i, num_packets, num_nonempty_packets;
gint amr_len; gint amr_len;
gint ILL, ILP; gint ILL, ILP;
GstBuffer *buf;
payload_len = gst_rtp_buffer_get_payload_len (rtp); payload_len = gst_rtp_buffer_get_payload_len (rtp);
@ -424,6 +427,11 @@ gst_rtp_amr_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
GST_DEBUG_OBJECT (depayload, "pushing buffer of size %" G_GSIZE_FORMAT, GST_DEBUG_OBJECT (depayload, "pushing buffer of size %" G_GSIZE_FORMAT,
gst_buffer_get_size (outbuf)); gst_buffer_get_size (outbuf));
buf = gst_rtp_buffer_get_payload_buffer (rtp);
gst_rtp_copy_meta (GST_ELEMENT_CAST (rtpamrdepay), outbuf, buf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
gst_buffer_unref (buf);
} }
return outbuf; return outbuf;

View file

@ -53,8 +53,10 @@
#include <string.h> #include <string.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtpamrpay.h" #include "gstrtpamrpay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpamrpay_debug); GST_DEBUG_CATEGORY_STATIC (rtpamrpay_debug);
#define GST_CAT_DEFAULT (rtpamrpay_debug) #define GST_CAT_DEFAULT (rtpamrpay_debug)
@ -388,10 +390,13 @@ gst_rtp_amr_pay_handle_buffer (GstRTPBasePayload * basepayload,
} }
gst_buffer_unmap (buffer, &map); gst_buffer_unmap (buffer, &map);
gst_buffer_unref (buffer);
gst_rtp_buffer_unmap (&rtp); gst_rtp_buffer_unmap (&rtp);
gst_rtp_copy_meta (GST_ELEMENT_CAST (rtpamrpay), outbuf, buffer,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
gst_buffer_unref (buffer);
ret = gst_rtp_base_payload_push (basepayload, outbuf); ret = gst_rtp_base_payload_push (basepayload, outbuf);
return ret; return ret;

View file

@ -33,7 +33,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtpbvdepay.h" #include "gstrtpbvdepay.h"
#include "gstrtputils.h"
static GstStaticPadTemplate gst_rtp_bv_depay_sink_template = static GstStaticPadTemplate gst_rtp_bv_depay_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink", GST_STATIC_PAD_TEMPLATE ("sink",
@ -173,6 +175,11 @@ gst_rtp_bv_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_RESYNC); GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_RESYNC);
} }
if (outbuf) {
gst_rtp_drop_meta (GST_ELEMENT_CAST (depayload), outbuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
}
return outbuf; return outbuf;
} }

View file

@ -24,8 +24,10 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtpceltdepay.h" #include "gstrtpceltdepay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpceltdepay_debug); GST_DEBUG_CATEGORY_STATIC (rtpceltdepay_debug);
#define GST_CAT_DEFAULT (rtpceltdepay_debug) #define GST_CAT_DEFAULT (rtpceltdepay_debug)
@ -258,6 +260,9 @@ gst_rtp_celt_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
GST_TIME_ARGS (GST_BUFFER_PTS (outbuf)), GST_TIME_ARGS (GST_BUFFER_PTS (outbuf)),
GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf))); GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf)));
gst_rtp_drop_meta (GST_ELEMENT_CAST (depayload), outbuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
gst_rtp_base_depayload_push (depayload, outbuf); gst_rtp_base_depayload_push (depayload, outbuf);
} }

View file

@ -24,8 +24,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtpceltpay.h" #include "gstrtpceltpay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpceltpay_debug); GST_DEBUG_CATEGORY_STATIC (rtpceltpay_debug);
#define GST_CAT_DEFAULT (rtpceltpay_debug) #define GST_CAT_DEFAULT (rtpceltpay_debug)
@ -350,6 +352,9 @@ gst_rtp_celt_pay_flush_queued (GstRtpCELTPay * rtpceltpay)
gst_buffer_extract (buf, 0, payload, size); gst_buffer_extract (buf, 0, payload, size);
payload += size; payload += size;
gst_rtp_copy_meta (GST_ELEMENT_CAST (rtpceltpay), outbuf, buf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
gst_buffer_unref (buf); gst_buffer_unref (buf);
} }
gst_rtp_buffer_unmap (&rtp); gst_rtp_buffer_unmap (&rtp);

View file

@ -33,6 +33,7 @@
#include <gst/gst.h> #include <gst/gst.h>
#include "gstrtpdvdepay.h" #include "gstrtpdvdepay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY (rtpdvdepay_debug); GST_DEBUG_CATEGORY (rtpdvdepay_debug);
#define GST_CAT_DEFAULT (rtpdvdepay_debug) #define GST_CAT_DEFAULT (rtpdvdepay_debug)
@ -280,6 +281,13 @@ calculate_difblock_location (guint8 * block)
return location; return location;
} }
static gboolean
foreach_metadata_drop (GstBuffer * inbuf, GstMeta ** meta, gpointer user_data)
{
*meta = NULL;
return TRUE;
}
/* Process one RTP packet. Accumulate RTP payload in the proper place in a DV /* Process one RTP packet. Accumulate RTP payload in the proper place in a DV
* frame, and return that frame if we detect a new frame, or NULL otherwise. * frame, and return that frame if we detect a new frame, or NULL otherwise.
* We assume a DV frame is 144000 bytes. That should accomodate PAL as well as * We assume a DV frame is 144000 bytes. That should accomodate PAL as well as
@ -289,6 +297,7 @@ static GstBuffer *
gst_rtp_dv_depay_process (GstRTPBaseDepayload * base, GstRTPBuffer * rtp) gst_rtp_dv_depay_process (GstRTPBaseDepayload * base, GstRTPBuffer * rtp)
{ {
GstBuffer *out = NULL; GstBuffer *out = NULL;
GstBuffer *payload_buf;
guint8 *payload; guint8 *payload;
guint32 rtp_ts; guint32 rtp_ts;
guint payload_len, location; guint payload_len, location;
@ -311,11 +320,13 @@ gst_rtp_dv_depay_process (GstRTPBaseDepayload * base, GstRTPBuffer * rtp)
/* return copy of accumulator. */ /* return copy of accumulator. */
out = gst_buffer_copy (dvdepay->acc); out = gst_buffer_copy (dvdepay->acc);
gst_buffer_foreach_meta (dvdepay->acc, foreach_metadata_drop, NULL);
} }
/* Extract the payload */ /* Extract the payload */
payload_len = gst_rtp_buffer_get_payload_len (rtp); payload_len = gst_rtp_buffer_get_payload_len (rtp);
payload = gst_rtp_buffer_get_payload (rtp); payload = gst_rtp_buffer_get_payload (rtp);
payload_buf = gst_rtp_buffer_get_payload_buffer (rtp);
/* copy all DIF chunks in their place. */ /* copy all DIF chunks in their place. */
gst_buffer_map (dvdepay->acc, &map, GST_MAP_READWRITE); gst_buffer_map (dvdepay->acc, &map, GST_MAP_READWRITE);
@ -341,6 +352,8 @@ gst_rtp_dv_depay_process (GstRTPBaseDepayload * base, GstRTPBuffer * rtp)
/* And copy it in, provided the location is sane. */ /* And copy it in, provided the location is sane. */
if (offset <= dvdepay->frame_size - 80) { if (offset <= dvdepay->frame_size - 80) {
memcpy (map.data + offset, payload, 80); memcpy (map.data + offset, payload, 80);
gst_rtp_copy_meta (GST_ELEMENT_CAST (dvdepay), dvdepay->acc,
payload_buf, 0);
} }
} }
@ -348,6 +361,7 @@ gst_rtp_dv_depay_process (GstRTPBaseDepayload * base, GstRTPBuffer * rtp)
payload_len -= 80; payload_len -= 80;
} }
gst_buffer_unmap (dvdepay->acc, &map); gst_buffer_unmap (dvdepay->acc, &map);
gst_buffer_unref (payload_buf);
if (marker) { if (marker) {
GST_DEBUG_OBJECT (dvdepay, "marker bit complete frame %u", rtp_ts); GST_DEBUG_OBJECT (dvdepay, "marker bit complete frame %u", rtp_ts);
@ -357,6 +371,7 @@ gst_rtp_dv_depay_process (GstRTPBaseDepayload * base, GstRTPBuffer * rtp)
* will change the timestamp but we won't copy the accumulator again because * will change the timestamp but we won't copy the accumulator again because
* we set the prev_ts to -1. */ * we set the prev_ts to -1. */
out = gst_buffer_copy (dvdepay->acc); out = gst_buffer_copy (dvdepay->acc);
gst_buffer_foreach_meta (dvdepay->acc, foreach_metadata_drop, NULL);
} else { } else {
GST_WARNING_OBJECT (dvdepay, "waiting for frame headers %02x", GST_WARNING_OBJECT (dvdepay, "waiting for frame headers %02x",
dvdepay->header_mask); dvdepay->header_mask);

View file

@ -27,6 +27,7 @@
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include "gstrtpdvpay.h" #include "gstrtpdvpay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY (rtpdvpay_debug); GST_DEBUG_CATEGORY (rtpdvpay_debug);
#define GST_CAT_DEFAULT (rtpdvpay_debug) #define GST_CAT_DEFAULT (rtpdvpay_debug)
@ -372,6 +373,7 @@ gst_rtp_dv_pay_handle_buffer (GstRTPBasePayload * basepayload,
/* Push out the created piece, and check for errors. */ /* Push out the created piece, and check for errors. */
gst_rtp_buffer_unmap (&rtp); gst_rtp_buffer_unmap (&rtp);
gst_rtp_copy_meta (GST_ELEMENT_CAST (basepayload), outbuf, buffer, 0);
ret = gst_rtp_base_payload_push (basepayload, outbuf); ret = gst_rtp_base_payload_push (basepayload, outbuf);
if (ret != GST_FLOW_OK) if (ret != GST_FLOW_OK)
break; break;

View file

@ -28,6 +28,7 @@
#include "gstrtpg722depay.h" #include "gstrtpg722depay.h"
#include "gstrtpchannels.h" #include "gstrtpchannels.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpg722depay_debug); GST_DEBUG_CATEGORY_STATIC (rtpg722depay_debug);
#define GST_CAT_DEFAULT (rtpg722depay_debug) #define GST_CAT_DEFAULT (rtpg722depay_debug)
@ -238,6 +239,11 @@ gst_rtp_g722_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_RESYNC); GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_RESYNC);
} }
if (outbuf) {
gst_rtp_drop_meta (GST_ELEMENT_CAST (rtpg722depay), outbuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
}
return outbuf; return outbuf;
/* ERRORS */ /* ERRORS */

View file

@ -26,8 +26,10 @@
#include <string.h> #include <string.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/base/gstadapter.h> #include <gst/base/gstadapter.h>
#include <gst/audio/audio.h>
#include "gstrtpg723pay.h" #include "gstrtpg723pay.h"
#include "gstrtputils.h"
#define G723_FRAME_DURATION (30 * GST_MSECOND) #define G723_FRAME_DURATION (30 * GST_MSECOND)
@ -162,7 +164,8 @@ gst_rtp_g723_pay_flush (GstRTPG723Pay * pay)
pay->discont = FALSE; pay->discont = FALSE;
} }
gst_rtp_buffer_unmap (&rtp); gst_rtp_buffer_unmap (&rtp);
gst_rtp_drop_meta (GST_ELEMENT_CAST (pay), outbuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
outbuf = gst_buffer_append (outbuf, payload_buf); outbuf = gst_buffer_append (outbuf, payload_buf);
ret = gst_rtp_base_payload_push (GST_RTP_BASE_PAYLOAD (pay), outbuf); ret = gst_rtp_base_payload_push (GST_RTP_BASE_PAYLOAD (pay), outbuf);

View file

@ -28,8 +28,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtpg726depay.h" #include "gstrtpg726depay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpg726depay_debug); GST_DEBUG_CATEGORY_STATIC (rtpg726depay_debug);
#define GST_CAT_DEFAULT (rtpg726depay_debug) #define GST_CAT_DEFAULT (rtpg726depay_debug)
@ -226,6 +228,8 @@ gst_rtp_g726_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
outbuf = gst_rtp_buffer_get_payload_buffer (rtp); outbuf = gst_rtp_buffer_get_payload_buffer (rtp);
if (!outbuf) if (!outbuf)
goto bad_len; goto bad_len;
gst_rtp_drop_meta (GST_ELEMENT_CAST (depay), outbuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
} else { } else {
guint8 *in, *out, tmp; guint8 *in, *out, tmp;
guint len; guint len;
@ -239,6 +243,9 @@ gst_rtp_g726_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
goto bad_len; goto bad_len;
outbuf = gst_buffer_make_writable (outbuf); outbuf = gst_buffer_make_writable (outbuf);
gst_rtp_drop_meta (GST_ELEMENT_CAST (depay), outbuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
gst_buffer_map (outbuf, &map, GST_MAP_WRITE); gst_buffer_map (outbuf, &map, GST_MAP_WRITE);
out = map.data; out = map.data;

View file

@ -21,10 +21,12 @@
#endif #endif
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "gstrtpg729depay.h" #include "gstrtpg729depay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpg729depay_debug); GST_DEBUG_CATEGORY_STATIC (rtpg729depay_debug);
#define GST_CAT_DEFAULT (rtpg729depay_debug) #define GST_CAT_DEFAULT (rtpg729depay_debug)
@ -200,6 +202,9 @@ gst_rtp_g729_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_RESYNC); GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_RESYNC);
} }
gst_rtp_drop_meta (GST_ELEMENT_CAST (depayload), outbuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
GST_LOG_OBJECT (depayload, "pushing buffer of size %" G_GSIZE_FORMAT, GST_LOG_OBJECT (depayload, "pushing buffer of size %" G_GSIZE_FORMAT,
gst_buffer_get_size (outbuf)); gst_buffer_get_size (outbuf));

View file

@ -32,8 +32,10 @@
#include <string.h> #include <string.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/base/gstadapter.h> #include <gst/base/gstadapter.h>
#include <gst/audio/audio.h>
#include "gstrtpg729pay.h" #include "gstrtpg729pay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpg729pay_debug); GST_DEBUG_CATEGORY_STATIC (rtpg729pay_debug);
#define GST_CAT_DEFAULT (rtpg729pay_debug) #define GST_CAT_DEFAULT (rtpg729pay_debug)
@ -188,6 +190,8 @@ gst_rtp_g729_pay_push (GstRTPG729Pay * rtpg729pay, GstBuffer * buf)
gst_rtp_buffer_unmap (&rtp); gst_rtp_buffer_unmap (&rtp);
/* append payload */ /* append payload */
gst_rtp_copy_meta (GST_ELEMENT_CAST (basepayload), outbuf, buf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
outbuf = gst_buffer_append (outbuf, buf); outbuf = gst_buffer_append (outbuf, buf);
ret = gst_rtp_base_payload_push (basepayload, outbuf); ret = gst_rtp_base_payload_push (basepayload, outbuf);

View file

@ -24,7 +24,9 @@
#include <string.h> #include <string.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtpgsmdepay.h" #include "gstrtpgsmdepay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpgsmdepay_debug); GST_DEBUG_CATEGORY_STATIC (rtpgsmdepay_debug);
#define GST_CAT_DEFAULT (rtpgsmdepay_debug) #define GST_CAT_DEFAULT (rtpgsmdepay_debug)
@ -135,6 +137,11 @@ gst_rtp_gsm_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_RESYNC); GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_RESYNC);
} }
if (outbuf) {
gst_rtp_drop_meta (GST_ELEMENT_CAST (depayload), outbuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
}
return outbuf; return outbuf;
} }

View file

@ -25,8 +25,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtpgsmpay.h" #include "gstrtpgsmpay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpgsmpay_debug); GST_DEBUG_CATEGORY_STATIC (rtpgsmpay_debug);
#define GST_CAT_DEFAULT (rtpgsmpay_debug) #define GST_CAT_DEFAULT (rtpgsmpay_debug)

View file

@ -25,6 +25,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "gstrtpgstdepay.h" #include "gstrtpgstdepay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpgstdepay_debug); GST_DEBUG_CATEGORY_STATIC (rtpgstdepay_debug);
#define GST_CAT_DEFAULT (rtpgstdepay_debug) #define GST_CAT_DEFAULT (rtpgstdepay_debug)
@ -523,6 +524,10 @@ gst_rtp_gst_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
} }
} }
if (outbuf) {
gst_rtp_drop_meta (GST_ELEMENT_CAST (rtpgstdepay), outbuf, 0);
}
return outbuf; return outbuf;
/* ERRORS */ /* ERRORS */

View file

@ -26,6 +26,7 @@
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include "gstrtpgstpay.h" #include "gstrtpgstpay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (gst_rtp_pay_debug); GST_DEBUG_CATEGORY_STATIC (gst_rtp_pay_debug);
#define GST_CAT_DEFAULT gst_rtp_pay_debug #define GST_CAT_DEFAULT gst_rtp_pay_debug
@ -336,6 +337,7 @@ gst_rtp_gst_pay_create_from_adapter (GstRtpGSTPay * rtpgstpay,
paybuf = gst_adapter_take_buffer_fast (rtpgstpay->adapter, payload_len); paybuf = gst_adapter_take_buffer_fast (rtpgstpay->adapter, payload_len);
/* create a new group to hold the rtp header and the payload */ /* create a new group to hold the rtp header and the payload */
gst_rtp_copy_meta (GST_ELEMENT_CAST (rtpgstpay), outbuf, paybuf, 0);
outbuf = gst_buffer_append (outbuf, paybuf); outbuf = gst_buffer_append (outbuf, paybuf);
GST_BUFFER_PTS (outbuf) = timestamp; GST_BUFFER_PTS (outbuf) = timestamp;

View file

@ -45,8 +45,10 @@
#include <string.h> #include <string.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/video/video.h>
#include "gstrtph261depay.h" #include "gstrtph261depay.h"
#include "gstrtph261pay.h" /* GstRtpH261PayHeader */ #include "gstrtph261pay.h" /* GstRtpH261PayHeader */
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtph261depay_debug); GST_DEBUG_CATEGORY_STATIC (rtph261depay_debug);
#define GST_CAT_DEFAULT (rtph261depay_debug) #define GST_CAT_DEFAULT (rtph261depay_debug)
@ -168,6 +170,8 @@ skip:
avail = gst_adapter_available (depay->adapter); avail = gst_adapter_available (depay->adapter);
outbuf = gst_adapter_take_buffer (depay->adapter, avail); outbuf = gst_adapter_take_buffer (depay->adapter, avail);
gst_rtp_drop_meta (GST_ELEMENT_CAST (depay), outbuf,
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
/* Note that the I flag does not mean intra frame, but that the entire /* Note that the I flag does not mean intra frame, but that the entire
* stream is intra coded. */ * stream is intra coded. */

View file

@ -49,7 +49,9 @@
#endif #endif
#include "gstrtph261pay.h" #include "gstrtph261pay.h"
#include "gstrtputils.h"
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/video/video.h>
#include <gst/base/gstbitreader.h> #include <gst/base/gstbitreader.h>
#include <string.h> #include <string.h>
@ -798,9 +800,9 @@ gst_rtp_h261_pay_init_gobs (GstRtpH261Pay * pay, Gob * gobs, gint num_gobs,
} }
static GstFlowReturn static GstFlowReturn
gst_rtp_h261_pay_fragment_push (GstRtpH261Pay * pay, const guint8 * bits, gst_rtp_h261_pay_fragment_push (GstRtpH261Pay * pay, GstBuffer * buffer,
guint start, guint end, const Macroblock * last_mb_in_previous_packet, const guint8 * bits, guint start, guint end,
gboolean marker) const Macroblock * last_mb_in_previous_packet, gboolean marker)
{ {
GstBuffer *outbuf; GstBuffer *outbuf;
guint8 *payload; guint8 *payload;
@ -848,12 +850,15 @@ gst_rtp_h261_pay_fragment_push (GstRtpH261Pay * pay, const guint8 * bits,
gst_rtp_buffer_unmap (&rtp); gst_rtp_buffer_unmap (&rtp);
gst_rtp_copy_meta (GST_ELEMENT_CAST (pay), outbuf, buffer,
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
return gst_rtp_base_payload_push (GST_RTP_BASE_PAYLOAD_CAST (pay), outbuf); return gst_rtp_base_payload_push (GST_RTP_BASE_PAYLOAD_CAST (pay), outbuf);
} }
static GstFlowReturn static GstFlowReturn
gst_rtp_h261_packetize_and_push (GstRtpH261Pay * pay, const guint8 * bits, gst_rtp_h261_packetize_and_push (GstRtpH261Pay * pay, GstBuffer * buffer,
gsize len) const guint8 * bits, gsize len)
{ {
GstFlowReturn ret = GST_FLOW_OK; GstFlowReturn ret = GST_FLOW_OK;
GstBitReader br_; GstBitReader br_;
@ -923,7 +928,7 @@ gst_rtp_h261_packetize_and_push (GstRtpH261Pay * pay, const guint8 * bits,
goto beach; goto beach;
marker = result == PARSE_END_OF_FRAME; marker = result == PARSE_END_OF_FRAME;
ret = gst_rtp_h261_pay_fragment_push (pay, bits, startpos, endpos, ret = gst_rtp_h261_pay_fragment_push (pay, buffer, bits, startpos, endpos,
&last_mb_in_previous_packet, marker); &last_mb_in_previous_packet, marker);
last_mb_in_previous_packet = gob->last; last_mb_in_previous_packet = gob->last;
@ -1003,7 +1008,7 @@ gst_rtp_h261_pay_handle_buffer (GstRTPBasePayload * payload, GstBuffer * buffer)
shift = pay->offset - psc_offset; shift = pay->offset - psc_offset;
bits = gst_rtp_h261_pay_shift_buffer (pay, map.data, map.size, shift, &len); bits = gst_rtp_h261_pay_shift_buffer (pay, map.data, map.size, shift, &len);
ret = gst_rtp_h261_packetize_and_push (pay, bits, len); ret = gst_rtp_h261_packetize_and_push (pay, buffer, bits, len);
g_free (bits); g_free (bits);
beach: beach:

View file

@ -30,7 +30,9 @@
#include <string.h> #include <string.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/video/video.h>
#include "gstrtph263depay.h" #include "gstrtph263depay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtph263depay_debug); GST_DEBUG_CATEGORY_STATIC (rtph263depay_debug);
#define GST_CAT_DEFAULT (rtph263depay_debug) #define GST_CAT_DEFAULT (rtph263depay_debug)
@ -384,6 +386,9 @@ skip:
GST_DEBUG ("Pushing out a buffer of %d bytes", avail); GST_DEBUG ("Pushing out a buffer of %d bytes", avail);
gst_rtp_drop_meta (GST_ELEMENT_CAST (rtph263depay), outbuf,
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
gst_rtp_base_depayload_push (depayload, outbuf); gst_rtp_base_depayload_push (depayload, outbuf);
rtph263depay->offset = 0; rtph263depay->offset = 0;
rtph263depay->leftover = 0; rtph263depay->leftover = 0;

View file

@ -27,8 +27,10 @@
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/video/video.h>
#include "gstrtph263pay.h" #include "gstrtph263pay.h"
#include "gstrtputils.h"
typedef enum typedef enum
{ {
@ -1307,6 +1309,9 @@ gst_rtp_h263_pay_push (GstRtpH263Pay * rtph263pay,
gst_buffer_copy_into (package->outbuf, rtph263pay->current_buffer, gst_buffer_copy_into (package->outbuf, rtph263pay->current_buffer,
GST_BUFFER_COPY_MEMORY, package->payload_start - rtph263pay->map.data, GST_BUFFER_COPY_MEMORY, package->payload_start - rtph263pay->map.data,
package->payload_len); package->payload_len);
gst_rtp_copy_meta (GST_ELEMENT_CAST (rtph263pay), package->outbuf,
rtph263pay->current_buffer,
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
ret = ret =
gst_rtp_base_payload_push (GST_RTP_BASE_PAYLOAD (rtph263pay), gst_rtp_base_payload_push (GST_RTP_BASE_PAYLOAD (rtph263pay),

View file

@ -24,7 +24,9 @@
#include <string.h> #include <string.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/video/video.h>
#include "gstrtph263pdepay.h" #include "gstrtph263pdepay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtph263pdepay_debug); GST_DEBUG_CATEGORY_STATIC (rtph263pdepay_debug);
#define GST_CAT_DEFAULT (rtph263pdepay_debug) #define GST_CAT_DEFAULT (rtph263pdepay_debug)
@ -329,6 +331,9 @@ gst_rtp_h263p_depay_process (GstRTPBaseDepayload * depayload,
outbuf = gst_buffer_append (outbuf, padbuf); outbuf = gst_buffer_append (outbuf, padbuf);
} }
gst_rtp_drop_meta (GST_ELEMENT_CAST (rtph263pdepay), outbuf,
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
return outbuf; return outbuf;
} else { } else {
/* frame not completed: store in adapter */ /* frame not completed: store in adapter */

View file

@ -26,8 +26,10 @@
#include <stdio.h> #include <stdio.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/video/video.h>
#include "gstrtph263ppay.h" #include "gstrtph263ppay.h"
#include "gstrtputils.h"
#define DEFAULT_FRAGMENTATION_MODE GST_FRAGMENTATION_MODE_NORMAL #define DEFAULT_FRAGMENTATION_MODE GST_FRAGMENTATION_MODE_NORMAL
@ -735,6 +737,8 @@ gst_rtp_h263p_pay_flush (GstRtpH263PPay * rtph263ppay)
gst_rtp_buffer_unmap (&rtp); gst_rtp_buffer_unmap (&rtp);
payload_buf = gst_adapter_take_buffer_fast (rtph263ppay->adapter, towrite); payload_buf = gst_adapter_take_buffer_fast (rtph263ppay->adapter, towrite);
gst_rtp_copy_meta (GST_ELEMENT_CAST (rtph263ppay), outbuf, payload_buf,
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
outbuf = gst_buffer_append (outbuf, payload_buf); outbuf = gst_buffer_append (outbuf, payload_buf);
avail -= towrite; avail -= towrite;

View file

@ -27,7 +27,9 @@
#include <gst/base/gstbitreader.h> #include <gst/base/gstbitreader.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/pbutils/pbutils.h> #include <gst/pbutils/pbutils.h>
#include <gst/video/video.h>
#include "gstrtph264depay.h" #include "gstrtph264depay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtph264depay_debug); GST_DEBUG_CATEGORY_STATIC (rtph264depay_debug);
#define GST_CAT_DEFAULT (rtph264depay_debug) #define GST_CAT_DEFAULT (rtph264depay_debug)
@ -880,12 +882,18 @@ gst_rtp_h264_depay_handle_nal (GstRtpH264Depay * rtph264depay, GstBuffer * nal,
/* prepend codec_data */ /* prepend codec_data */
if (rtph264depay->codec_data) { if (rtph264depay->codec_data) {
GST_DEBUG_OBJECT (depayload, "prepending codec_data"); GST_DEBUG_OBJECT (depayload, "prepending codec_data");
gst_rtp_copy_meta (GST_ELEMENT_CAST (rtph264depay),
rtph264depay->codec_data, outbuf,
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
outbuf = gst_buffer_append (rtph264depay->codec_data, outbuf); outbuf = gst_buffer_append (rtph264depay->codec_data, outbuf);
rtph264depay->codec_data = NULL; rtph264depay->codec_data = NULL;
out_keyframe = TRUE; out_keyframe = TRUE;
} }
outbuf = gst_buffer_make_writable (outbuf); outbuf = gst_buffer_make_writable (outbuf);
gst_rtp_drop_meta (GST_ELEMENT_CAST (rtph264depay), outbuf,
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
GST_BUFFER_PTS (outbuf) = out_timestamp; GST_BUFFER_PTS (outbuf) = out_timestamp;
if (out_keyframe) if (out_keyframe)
@ -947,6 +955,7 @@ static GstBuffer *
gst_rtp_h264_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp) gst_rtp_h264_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{ {
GstRtpH264Depay *rtph264depay; GstRtpH264Depay *rtph264depay;
GstBuffer *buf;
GstBuffer *outbuf = NULL; GstBuffer *outbuf = NULL;
guint8 nal_unit_type; guint8 nal_unit_type;
@ -973,6 +982,7 @@ gst_rtp_h264_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
payload_len = gst_rtp_buffer_get_payload_len (rtp); payload_len = gst_rtp_buffer_get_payload_len (rtp);
payload = gst_rtp_buffer_get_payload (rtp); payload = gst_rtp_buffer_get_payload (rtp);
buf = gst_rtp_buffer_get_payload_buffer (rtp);
marker = gst_rtp_buffer_get_marker (rtp); marker = gst_rtp_buffer_get_marker (rtp);
GST_DEBUG_OBJECT (rtph264depay, "receiving %d bytes", payload_len); GST_DEBUG_OBJECT (rtph264depay, "receiving %d bytes", payload_len);
@ -1057,6 +1067,9 @@ gst_rtp_h264_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
memcpy (map.data + sizeof (sync_bytes), payload, nalu_size); memcpy (map.data + sizeof (sync_bytes), payload, nalu_size);
gst_buffer_unmap (outbuf, &map); gst_buffer_unmap (outbuf, &map);
gst_rtp_copy_meta (GST_ELEMENT_CAST (rtph264depay), outbuf, buf,
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
outbuf = outbuf =
gst_rtp_h264_depay_handle_nal (rtph264depay, outbuf, timestamp, gst_rtp_h264_depay_handle_nal (rtph264depay, outbuf, timestamp,
marker); marker);
@ -1140,6 +1153,9 @@ gst_rtp_h264_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
map.data[sizeof (sync_bytes)] = nal_header; map.data[sizeof (sync_bytes)] = nal_header;
gst_buffer_unmap (outbuf, &map); gst_buffer_unmap (outbuf, &map);
gst_rtp_copy_meta (GST_ELEMENT_CAST (rtph264depay), outbuf, buf,
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
GST_DEBUG_OBJECT (rtph264depay, "queueing %d bytes", outsize); GST_DEBUG_OBJECT (rtph264depay, "queueing %d bytes", outsize);
/* and assemble in the adapter */ /* and assemble in the adapter */
@ -1153,6 +1169,9 @@ gst_rtp_h264_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
outbuf = gst_buffer_new_and_alloc (outsize); outbuf = gst_buffer_new_and_alloc (outsize);
gst_buffer_fill (outbuf, 0, payload, outsize); gst_buffer_fill (outbuf, 0, payload, outsize);
gst_rtp_copy_meta (GST_ELEMENT_CAST (rtph264depay), outbuf, buf,
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
GST_DEBUG_OBJECT (rtph264depay, "queueing %d bytes", outsize); GST_DEBUG_OBJECT (rtph264depay, "queueing %d bytes", outsize);
/* and assemble in the adapter */ /* and assemble in the adapter */
@ -1188,6 +1207,9 @@ gst_rtp_h264_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
memcpy (map.data + sizeof (sync_bytes), payload, nalu_size); memcpy (map.data + sizeof (sync_bytes), payload, nalu_size);
gst_buffer_unmap (outbuf, &map); gst_buffer_unmap (outbuf, &map);
gst_rtp_copy_meta (GST_ELEMENT_CAST (rtph264depay), outbuf, buf,
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
outbuf = gst_rtp_h264_depay_handle_nal (rtph264depay, outbuf, timestamp, outbuf = gst_rtp_h264_depay_handle_nal (rtph264depay, outbuf, timestamp,
marker); marker);
break; break;
@ -1195,29 +1217,35 @@ gst_rtp_h264_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
} }
} }
gst_buffer_unref (buf);
return outbuf; return outbuf;
/* ERRORS */ /* ERRORS */
empty_packet: empty_packet:
{ {
GST_DEBUG_OBJECT (rtph264depay, "empty packet"); GST_DEBUG_OBJECT (rtph264depay, "empty packet");
gst_buffer_unref (buf);
return NULL; return NULL;
} }
undefined_type: undefined_type:
{ {
GST_ELEMENT_WARNING (rtph264depay, STREAM, DECODE, GST_ELEMENT_WARNING (rtph264depay, STREAM, DECODE,
(NULL), ("Undefined packet type")); (NULL), ("Undefined packet type"));
gst_buffer_unref (buf);
return NULL; return NULL;
} }
waiting_start: waiting_start:
{ {
GST_DEBUG_OBJECT (rtph264depay, "waiting for start"); GST_DEBUG_OBJECT (rtph264depay, "waiting for start");
gst_buffer_unref (buf);
return NULL; return NULL;
} }
not_implemented: not_implemented:
{ {
GST_ELEMENT_ERROR (rtph264depay, STREAM, FORMAT, GST_ELEMENT_ERROR (rtph264depay, STREAM, FORMAT,
(NULL), ("NAL unit type %d not supported yet", nal_unit_type)); (NULL), ("NAL unit type %d not supported yet", nal_unit_type));
gst_buffer_unref (buf);
return NULL; return NULL;
} }
} }

View file

@ -26,11 +26,13 @@
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/pbutils/pbutils.h> #include <gst/pbutils/pbutils.h>
#include <gst/video/video.h>
/* Included to not duplicate gst_rtp_h264_add_sps_pps () */ /* Included to not duplicate gst_rtp_h264_add_sps_pps () */
#include "gstrtph264depay.h" #include "gstrtph264depay.h"
#include "gstrtph264pay.h" #include "gstrtph264pay.h"
#include "gstrtputils.h"
#define IDR_TYPE_ID 5 #define IDR_TYPE_ID 5
@ -877,6 +879,8 @@ gst_rtp_h264_pay_payload_nal (GstRTPBasePayload * basepayload,
gst_rtp_buffer_unmap (&rtp); gst_rtp_buffer_unmap (&rtp);
/* insert payload memory block */ /* insert payload memory block */
gst_rtp_copy_meta (GST_ELEMENT_CAST (rtph264pay), outbuf, paybuf,
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
outbuf = gst_buffer_append (outbuf, paybuf); outbuf = gst_buffer_append (outbuf, paybuf);
/* push the buffer to the next element */ /* push the buffer to the next element */
@ -936,9 +940,10 @@ gst_rtp_h264_pay_payload_nal (GstRTPBasePayload * basepayload,
gst_rtp_buffer_unmap (&rtp); gst_rtp_buffer_unmap (&rtp);
/* insert payload memory block */ /* insert payload memory block */
gst_buffer_append (outbuf, gst_rtp_copy_meta (GST_ELEMENT_CAST (rtph264pay), outbuf, paybuf,
gst_buffer_copy_region (paybuf, GST_BUFFER_COPY_MEMORY, pos, g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
limitedSize)); gst_buffer_copy_into (outbuf, paybuf, GST_BUFFER_COPY_MEMORY, pos,
limitedSize);
if (!delta_unit) if (!delta_unit)
/* Only the first packet sent should not have the flag */ /* Only the first packet sent should not have the flag */
@ -1088,7 +1093,7 @@ gst_rtp_h264_pay_handle_buffer (GstRTPBasePayload * basepayload,
end_of_au = TRUE; end_of_au = TRUE;
} }
paybuf = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_MEMORY, offset, paybuf = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, offset,
nal_len); nal_len);
ret = ret =
gst_rtp_h264_pay_payload_nal (basepayload, paybuf, dts, pts, gst_rtp_h264_pay_payload_nal (basepayload, paybuf, dts, pts,

View file

@ -24,7 +24,9 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtpilbcdepay.h" #include "gstrtpilbcdepay.h"
#include "gstrtputils.h"
/* RtpiLBCDepay signals and args */ /* RtpiLBCDepay signals and args */
enum enum
@ -188,6 +190,11 @@ gst_rtp_ilbc_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_RESYNC); GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_RESYNC);
} }
if (outbuf) {
gst_rtp_drop_meta (GST_ELEMENT_CAST (depayload), outbuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
}
return outbuf; return outbuf;
} }

View file

@ -22,9 +22,11 @@
#endif #endif
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/video/video.h>
#include <string.h> #include <string.h>
#include "gstrtpj2kdepay.h" #include "gstrtpj2kdepay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpj2kdepay_debug); GST_DEBUG_CATEGORY_STATIC (rtpj2kdepay_debug);
#define GST_CAT_DEFAULT (rtpj2kdepay_debug) #define GST_CAT_DEFAULT (rtpj2kdepay_debug)
@ -400,8 +402,12 @@ gst_rtp_j2k_depay_flush_frame (GstRTPBaseDepayload * depayload)
buflist = gst_buffer_list_new (); buflist = gst_buffer_list_new ();
for (walk = list; walk; walk = g_list_next (walk)) for (walk = list; walk; walk = g_list_next (walk)) {
gst_rtp_drop_meta (GST_ELEMENT_CAST (depayload),
GST_BUFFER_CAST (walk->data),
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
gst_buffer_list_add (buflist, GST_BUFFER_CAST (walk->data)); gst_buffer_list_add (buflist, GST_BUFFER_CAST (walk->data));
}
g_list_free (list); g_list_free (list);

View file

@ -34,8 +34,10 @@
#include <string.h> #include <string.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/video/video.h>
#include "gstrtpj2kpay.h" #include "gstrtpj2kpay.h"
#include "gstrtputils.h"
static GstStaticPadTemplate gst_rtp_j2k_pay_sink_template = static GstStaticPadTemplate gst_rtp_j2k_pay_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink", GST_STATIC_PAD_TEMPLATE ("sink",
@ -481,9 +483,10 @@ gst_rtp_j2k_pay_handle_buffer (GstRTPBasePayload * basepayload,
gst_rtp_buffer_unmap (&rtp); gst_rtp_buffer_unmap (&rtp);
/* make subbuffer of j2k data */ /* make subbuffer of j2k data */
paybuf = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_MEMORY, paybuf = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL,
offset, data_size); offset, data_size);
gst_rtp_copy_meta (GST_ELEMENT_CAST (basepayload), outbuf, paybuf,
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
outbuf = gst_buffer_append (outbuf, paybuf); outbuf = gst_buffer_append (outbuf, paybuf);
gst_buffer_list_add (list, outbuf); gst_buffer_list_add (list, outbuf);

View file

@ -22,12 +22,14 @@
#endif #endif
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/video/video.h>
#include <math.h> #include <math.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "gstrtpjpegdepay.h" #include "gstrtpjpegdepay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpjpegdepay_debug); GST_DEBUG_CATEGORY_STATIC (rtpjpegdepay_debug);
#define GST_CAT_DEFAULT (rtpjpegdepay_debug) #define GST_CAT_DEFAULT (rtpjpegdepay_debug)
@ -712,6 +714,9 @@ gst_rtp_jpeg_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
rtpjpegdepay->discont = FALSE; rtpjpegdepay->discont = FALSE;
} }
gst_rtp_drop_meta (GST_ELEMENT_CAST (rtpjpegdepay), outbuf,
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
GST_DEBUG_OBJECT (rtpjpegdepay, "returning %u bytes", avail); GST_DEBUG_OBJECT (rtpjpegdepay, "returning %u bytes", avail);
} }

View file

@ -38,8 +38,10 @@
#include <string.h> #include <string.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/video/video.h>
#include "gstrtpjpegpay.h" #include "gstrtpjpegpay.h"
#include "gstrtputils.h"
static GstStaticPadTemplate gst_rtp_jpeg_pay_sink_template = static GstStaticPadTemplate gst_rtp_jpeg_pay_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink", GST_STATIC_PAD_TEMPLATE ("sink",
@ -891,10 +893,12 @@ gst_rtp_jpeg_pay_handle_buffer (GstRTPBasePayload * basepayload,
gst_rtp_buffer_unmap (&rtp); gst_rtp_buffer_unmap (&rtp);
/* create a new buf to hold the payload */ /* create a new buf to hold the payload */
paybuf = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_MEMORY, paybuf = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL,
jpeg_header_size + offset, payload_size); jpeg_header_size + offset, payload_size);
/* join memory parts */ /* join memory parts */
gst_rtp_copy_meta (GST_ELEMENT_CAST (pay), outbuf, paybuf,
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
outbuf = gst_buffer_append (outbuf, paybuf); outbuf = gst_buffer_append (outbuf, paybuf);
GST_BUFFER_PTS (outbuf) = timestamp; GST_BUFFER_PTS (outbuf) = timestamp;

View file

@ -25,6 +25,7 @@
#include <string.h> #include <string.h>
#include "gstrtpmp1sdepay.h" #include "gstrtpmp1sdepay.h"
#include "gstrtputils.h"
/* RtpMP1SDepay signals and args */ /* RtpMP1SDepay signals and args */
enum enum
@ -124,10 +125,13 @@ gst_rtp_mp1s_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
outbuf = gst_rtp_buffer_get_payload_buffer (rtp); outbuf = gst_rtp_buffer_get_payload_buffer (rtp);
if (outbuf) if (outbuf) {
GST_DEBUG ("gst_rtp_mp1s_depay_chain: pushing buffer of size %" GST_DEBUG ("gst_rtp_mp1s_depay_chain: pushing buffer of size %"
G_GSIZE_FORMAT, gst_buffer_get_size (outbuf)); G_GSIZE_FORMAT, gst_buffer_get_size (outbuf));
gst_rtp_drop_meta (GST_ELEMENT_CAST (depayload), outbuf, 0);
}
return outbuf; return outbuf;
} }

View file

@ -25,6 +25,7 @@
#include <string.h> #include <string.h>
#include "gstrtpmp2tdepay.h" #include "gstrtpmp2tdepay.h"
#include "gstrtputils.h"
/* RtpMP2TDepay signals and args */ /* RtpMP2TDepay signals and args */
enum enum
@ -180,10 +181,13 @@ gst_rtp_mp2t_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
gst_rtp_buffer_get_payload_subbuffer (rtp, gst_rtp_buffer_get_payload_subbuffer (rtp,
rtpmp2tdepay->skip_first_bytes, payload_len); rtpmp2tdepay->skip_first_bytes, payload_len);
if (outbuf) if (outbuf) {
GST_DEBUG ("gst_rtp_mp2t_depay_chain: pushing buffer of size %" GST_DEBUG ("gst_rtp_mp2t_depay_chain: pushing buffer of size %"
G_GSIZE_FORMAT, gst_buffer_get_size (outbuf)); G_GSIZE_FORMAT, gst_buffer_get_size (outbuf));
gst_rtp_drop_meta (GST_ELEMENT_CAST (depayload), outbuf, 0);
}
return outbuf; return outbuf;
/* ERRORS */ /* ERRORS */

View file

@ -26,6 +26,7 @@
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include "gstrtpmp2tpay.h" #include "gstrtpmp2tpay.h"
#include "gstrtputils.h"
static GstStaticPadTemplate gst_rtp_mp2t_pay_sink_template = static GstStaticPadTemplate gst_rtp_mp2t_pay_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink", GST_STATIC_PAD_TEMPLATE ("sink",
@ -155,6 +156,7 @@ gst_rtp_mp2t_pay_flush (GstRTPMP2TPay * rtpmp2tpay)
/* get payload */ /* get payload */
paybuf = gst_adapter_take_buffer_fast (rtpmp2tpay->adapter, payload_len); paybuf = gst_adapter_take_buffer_fast (rtpmp2tpay->adapter, payload_len);
gst_rtp_copy_meta (GST_ELEMENT_CAST (rtpmp2tpay), outbuf, paybuf, 0);
outbuf = gst_buffer_append (outbuf, paybuf); outbuf = gst_buffer_append (outbuf, paybuf);
avail -= payload_len; avail -= payload_len;

View file

@ -23,9 +23,11 @@
#include <gst/base/gstbitreader.h> #include <gst/base/gstbitreader.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include <string.h> #include <string.h>
#include "gstrtpmp4adepay.h" #include "gstrtpmp4adepay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpmp4adepay_debug); GST_DEBUG_CATEGORY_STATIC (rtpmp4adepay_debug);
#define GST_CAT_DEFAULT (rtpmp4adepay_debug) #define GST_CAT_DEFAULT (rtpmp4adepay_debug)
@ -359,8 +361,7 @@ gst_rtp_mp4a_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
/* take data out, skip the header */ /* take data out, skip the header */
pos += skip; pos += skip;
tmp = gst_buffer_copy_region (outbuf, GST_BUFFER_COPY_MEMORY, pos, tmp = gst_buffer_copy_region (outbuf, GST_BUFFER_COPY_ALL, pos, data_len);
data_len);
/* skip data too */ /* skip data too */
skip += data_len; skip += data_len;
@ -371,6 +372,8 @@ gst_rtp_mp4a_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
avail -= skip; avail -= skip;
GST_BUFFER_PTS (tmp) = timestamp; GST_BUFFER_PTS (tmp) = timestamp;
gst_rtp_drop_meta (GST_ELEMENT_CAST (depayload), tmp,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
gst_rtp_base_depayload_push (depayload, tmp); gst_rtp_base_depayload_push (depayload, tmp);
/* shift ts for next buffers */ /* shift ts for next buffers */

View file

@ -24,8 +24,10 @@
#include <string.h> #include <string.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtpmp4apay.h" #include "gstrtpmp4apay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpmp4apay_debug); GST_DEBUG_CATEGORY_STATIC (rtpmp4apay_debug);
#define GST_CAT_DEFAULT (rtpmp4apay_debug) #define GST_CAT_DEFAULT (rtpmp4apay_debug)
@ -433,6 +435,8 @@ gst_rtp_mp4a_pay_handle_buffer (GstRTPBasePayload * basepayload,
offset, payload_len); offset, payload_len);
/* join memory parts */ /* join memory parts */
gst_rtp_copy_meta (GST_ELEMENT_CAST (rtpmp4apay), outbuf, paybuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
outbuf = gst_buffer_append (outbuf, paybuf); outbuf = gst_buffer_append (outbuf, paybuf);
gst_buffer_list_add (list, outbuf); gst_buffer_list_add (list, outbuf);
offset += payload_len; offset += payload_len;

View file

@ -26,6 +26,7 @@
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include "gstrtpmp4gdepay.h" #include "gstrtpmp4gdepay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpmp4gdepay_debug); GST_DEBUG_CATEGORY_STATIC (rtpmp4gdepay_debug);
#define GST_CAT_DEFAULT (rtpmp4gdepay_debug) #define GST_CAT_DEFAULT (rtpmp4gdepay_debug)
@ -347,6 +348,7 @@ gst_rtp_mp4g_depay_flush_queue (GstRtpMP4GDepay * rtpmp4gdepay)
} }
GST_DEBUG_OBJECT (rtpmp4gdepay, "pushing AU_index %u", AU_index); GST_DEBUG_OBJECT (rtpmp4gdepay, "pushing AU_index %u", AU_index);
gst_rtp_drop_meta (GST_ELEMENT_CAST (rtpmp4gdepay), outbuf, 0);
gst_rtp_base_depayload_push (GST_RTP_BASE_DEPAYLOAD (rtpmp4gdepay), outbuf); gst_rtp_base_depayload_push (GST_RTP_BASE_DEPAYLOAD (rtpmp4gdepay), outbuf);
rtpmp4gdepay->next_AU_index = AU_index + 1; rtpmp4gdepay->next_AU_index = AU_index + 1;
} }
@ -367,6 +369,7 @@ gst_rtp_mp4g_depay_queue (GstRtpMP4GDepay * rtpmp4gdepay, GstBuffer * outbuf)
/* we received the expected packet, push it and flush as much as we can from /* we received the expected packet, push it and flush as much as we can from
* the queue */ * the queue */
gst_rtp_drop_meta (GST_ELEMENT_CAST (rtpmp4gdepay), outbuf, 0);
gst_rtp_base_depayload_push (GST_RTP_BASE_DEPAYLOAD (rtpmp4gdepay), outbuf); gst_rtp_base_depayload_push (GST_RTP_BASE_DEPAYLOAD (rtpmp4gdepay), outbuf);
rtpmp4gdepay->next_AU_index++; rtpmp4gdepay->next_AU_index++;
@ -379,6 +382,7 @@ gst_rtp_mp4g_depay_queue (GstRtpMP4GDepay * rtpmp4gdepay, GstBuffer * outbuf)
GST_DEBUG_OBJECT (rtpmp4gdepay, "pushing expected AU_index %u", GST_DEBUG_OBJECT (rtpmp4gdepay, "pushing expected AU_index %u",
AU_index); AU_index);
outbuf = g_queue_pop_head (rtpmp4gdepay->packets); outbuf = g_queue_pop_head (rtpmp4gdepay->packets);
gst_rtp_drop_meta (GST_ELEMENT_CAST (rtpmp4gdepay), outbuf, 0);
gst_rtp_base_depayload_push (GST_RTP_BASE_DEPAYLOAD (rtpmp4gdepay), gst_rtp_base_depayload_push (GST_RTP_BASE_DEPAYLOAD (rtpmp4gdepay),
outbuf); outbuf);
rtpmp4gdepay->next_AU_index++; rtpmp4gdepay->next_AU_index++;

View file

@ -27,6 +27,7 @@
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include "gstrtpmp4gpay.h" #include "gstrtpmp4gpay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpmp4gpay_debug); GST_DEBUG_CATEGORY_STATIC (rtpmp4gpay_debug);
#define GST_CAT_DEFAULT (rtpmp4gpay_debug) #define GST_CAT_DEFAULT (rtpmp4gpay_debug)
@ -533,6 +534,7 @@ gst_rtp_mp4g_pay_flush (GstRtpMP4GPay * rtpmp4gpay)
gst_rtp_buffer_unmap (&rtp); gst_rtp_buffer_unmap (&rtp);
paybuf = gst_adapter_take_buffer_fast (rtpmp4gpay->adapter, payload_len); paybuf = gst_adapter_take_buffer_fast (rtpmp4gpay->adapter, payload_len);
gst_rtp_copy_meta (GST_ELEMENT_CAST (rtpmp4gpay), outbuf, paybuf, 0);
outbuf = gst_buffer_append (outbuf, paybuf); outbuf = gst_buffer_append (outbuf, paybuf);
GST_BUFFER_PTS (outbuf) = rtpmp4gpay->first_timestamp; GST_BUFFER_PTS (outbuf) = rtpmp4gpay->first_timestamp;

View file

@ -22,9 +22,11 @@
#endif #endif
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/video/video.h>
#include <string.h> #include <string.h>
#include "gstrtpmp4vdepay.h" #include "gstrtpmp4vdepay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpmp4vdepay_debug); GST_DEBUG_CATEGORY_STATIC (rtpmp4vdepay_debug);
#define GST_CAT_DEFAULT (rtpmp4vdepay_debug) #define GST_CAT_DEFAULT (rtpmp4vdepay_debug)
@ -185,7 +187,10 @@ gst_rtp_mp4v_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
GST_DEBUG ("gst_rtp_mp4v_depay_chain: pushing buffer of size %" GST_DEBUG ("gst_rtp_mp4v_depay_chain: pushing buffer of size %"
G_GSIZE_FORMAT, gst_buffer_get_size (outbuf)); G_GSIZE_FORMAT, gst_buffer_get_size (outbuf));
gst_rtp_drop_meta (GST_ELEMENT_CAST (rtpmp4vdepay), outbuf,
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
} }
return outbuf; return outbuf;
} }

View file

@ -24,8 +24,10 @@
#include <string.h> #include <string.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/video/video.h>
#include "gstrtpmp4vpay.h" #include "gstrtpmp4vpay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpmp4vpay_debug); GST_DEBUG_CATEGORY_STATIC (rtpmp4vpay_debug);
#define GST_CAT_DEFAULT (rtpmp4vpay_debug) #define GST_CAT_DEFAULT (rtpmp4vpay_debug)
@ -285,7 +287,8 @@ gst_rtp_mp4v_pay_flush (GstRtpMP4VPay * rtpmp4vpay)
gst_rtp_buffer_map (outbuf, GST_MAP_WRITE, &rtp); gst_rtp_buffer_map (outbuf, GST_MAP_WRITE, &rtp);
gst_rtp_buffer_set_marker (&rtp, avail == 0); gst_rtp_buffer_set_marker (&rtp, avail == 0);
gst_rtp_buffer_unmap (&rtp); gst_rtp_buffer_unmap (&rtp);
gst_rtp_copy_meta (GST_ELEMENT_CAST (rtpmp4vpay), outbuf, outbuf_data,
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
outbuf = gst_buffer_append (outbuf, outbuf_data); outbuf = gst_buffer_append (outbuf, outbuf_data);
GST_BUFFER_PTS (outbuf) = rtpmp4vpay->first_timestamp; GST_BUFFER_PTS (outbuf) = rtpmp4vpay->first_timestamp;
@ -462,7 +465,7 @@ gst_rtp_mp4v_pay_handle_buffer (GstRTPBasePayload * basepayload,
(gint) size - strip); (gint) size - strip);
/* strip off header */ /* strip off header */
subbuf = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_MEMORY, strip, subbuf = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, strip,
size - strip); size - strip);
GST_BUFFER_PTS (subbuf) = timestamp; GST_BUFFER_PTS (subbuf) = timestamp;
gst_buffer_unref (buffer); gst_buffer_unref (buffer);

View file

@ -22,9 +22,11 @@
#endif #endif
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include <string.h> #include <string.h>
#include "gstrtpmpadepay.h" #include "gstrtpmpadepay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpmpadepay_debug); GST_DEBUG_CATEGORY_STATIC (rtpmpadepay_debug);
#define GST_CAT_DEFAULT (rtpmpadepay_debug) #define GST_CAT_DEFAULT (rtpmpadepay_debug)
@ -154,6 +156,11 @@ gst_rtp_mpa_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
"gst_rtp_mpa_depay_chain: pushing buffer of size %" G_GSIZE_FORMAT "", "gst_rtp_mpa_depay_chain: pushing buffer of size %" G_GSIZE_FORMAT "",
gst_buffer_get_size (outbuf)); gst_buffer_get_size (outbuf));
if (outbuf) {
gst_rtp_drop_meta (GST_ELEMENT_CAST (rtpmpadepay), outbuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
}
/* FIXME, we can push half mpeg frames when they are split over multiple /* FIXME, we can push half mpeg frames when they are split over multiple
* RTP packets */ * RTP packets */
return outbuf; return outbuf;

View file

@ -24,8 +24,10 @@
#include <string.h> #include <string.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtpmpapay.h" #include "gstrtpmpapay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpmpapay_debug); GST_DEBUG_CATEGORY_STATIC (rtpmpapay_debug);
#define GST_CAT_DEFAULT (rtpmpapay_debug) #define GST_CAT_DEFAULT (rtpmpapay_debug)
@ -241,6 +243,8 @@ gst_rtp_mpa_pay_flush (GstRtpMPAPay * rtpmpapay)
gst_rtp_buffer_unmap (&rtp); gst_rtp_buffer_unmap (&rtp);
paybuf = gst_adapter_take_buffer_fast (rtpmpapay->adapter, payload_len); paybuf = gst_adapter_take_buffer_fast (rtpmpapay->adapter, payload_len);
gst_rtp_copy_meta (GST_ELEMENT_CAST (rtpmpapay), outbuf, paybuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
outbuf = gst_buffer_append (outbuf, paybuf); outbuf = gst_buffer_append (outbuf, paybuf);
GST_BUFFER_PTS (outbuf) = rtpmpapay->first_ts; GST_BUFFER_PTS (outbuf) = rtpmpapay->first_ts;

View file

@ -22,9 +22,11 @@
#endif #endif
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/video/video.h>
#include <string.h> #include <string.h>
#include "gstrtpmpvdepay.h" #include "gstrtpmpvdepay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpmpvdepay_debug); GST_DEBUG_CATEGORY_STATIC (rtpmpvdepay_debug);
#define GST_CAT_DEFAULT (rtpmpvdepay_debug) #define GST_CAT_DEFAULT (rtpmpvdepay_debug)
@ -172,6 +174,9 @@ gst_rtp_mpv_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
GST_DEBUG_OBJECT (rtpmpvdepay, GST_DEBUG_OBJECT (rtpmpvdepay,
"gst_rtp_mpv_depay_chain: pushing buffer of size %" G_GSIZE_FORMAT, "gst_rtp_mpv_depay_chain: pushing buffer of size %" G_GSIZE_FORMAT,
gst_buffer_get_size (outbuf)); gst_buffer_get_size (outbuf));
gst_rtp_drop_meta (GST_ELEMENT_CAST (rtpmpvdepay), outbuf,
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
} }
} }

View file

@ -24,8 +24,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/video/video.h>
#include "gstrtpmpvpay.h" #include "gstrtpmpvpay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpmpvpay_debug); GST_DEBUG_CATEGORY_STATIC (rtpmpvpay_debug);
#define GST_CAT_DEFAULT (rtpmpvpay_debug) #define GST_CAT_DEFAULT (rtpmpvpay_debug)
@ -226,6 +228,8 @@ gst_rtp_mpv_pay_flush (GstRTPMPVPay * rtpmpvpay)
gst_rtp_buffer_unmap (&rtp); gst_rtp_buffer_unmap (&rtp);
paybuf = gst_adapter_take_buffer_fast (rtpmpvpay->adapter, payload_len); paybuf = gst_adapter_take_buffer_fast (rtpmpvpay->adapter, payload_len);
gst_rtp_copy_meta (GST_ELEMENT_CAST (rtpmpvpay), outbuf, paybuf,
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
outbuf = gst_buffer_append (outbuf, paybuf); outbuf = gst_buffer_append (outbuf, paybuf);
GST_BUFFER_PTS (outbuf) = rtpmpvpay->first_ts; GST_BUFFER_PTS (outbuf) = rtpmpvpay->first_ts;

View file

@ -25,7 +25,9 @@
#include <string.h> #include <string.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtppcmadepay.h" #include "gstrtppcmadepay.h"
#include "gstrtputils.h"
/* RtpPcmaDepay signals and args */ /* RtpPcmaDepay signals and args */
enum enum
@ -147,6 +149,9 @@ gst_rtp_pcma_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
/* mark start of talkspurt with RESYNC */ /* mark start of talkspurt with RESYNC */
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_RESYNC); GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_RESYNC);
} }
gst_rtp_drop_meta (GST_ELEMENT_CAST (depayload), outbuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
} }
return outbuf; return outbuf;

View file

@ -25,7 +25,9 @@
#include <string.h> #include <string.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtppcmudepay.h" #include "gstrtppcmudepay.h"
#include "gstrtputils.h"
/* RtpPcmuDepay signals and args */ /* RtpPcmuDepay signals and args */
enum enum
@ -148,6 +150,9 @@ gst_rtp_pcmu_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
/* mark start of talkspurt with RESYNC */ /* mark start of talkspurt with RESYNC */
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_RESYNC); GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_RESYNC);
} }
gst_rtp_drop_meta (GST_ELEMENT_CAST (depayload), outbuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
} }
return outbuf; return outbuf;

View file

@ -22,10 +22,12 @@
#endif #endif
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "gstrtpqcelpdepay.h" #include "gstrtpqcelpdepay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpqcelpdepay_debug); GST_DEBUG_CATEGORY_STATIC (rtpqcelpdepay_debug);
#define GST_CAT_DEFAULT (rtpqcelpdepay_debug) #define GST_CAT_DEFAULT (rtpqcelpdepay_debug)
@ -355,6 +357,9 @@ gst_rtp_qcelp_depay_process (GstRTPBaseDepayload * depayload,
GST_BUFFER_PTS (outbuf) = timestamp; GST_BUFFER_PTS (outbuf) = timestamp;
GST_BUFFER_DURATION (outbuf) = FRAME_DURATION; GST_BUFFER_DURATION (outbuf) = FRAME_DURATION;
gst_rtp_drop_meta (GST_ELEMENT_CAST (depayload), outbuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
if (!depay->interleaved || index == 0) { if (!depay->interleaved || index == 0) {
/* not interleaved or first frame in packet, just push */ /* not interleaved or first frame in packet, just push */
gst_rtp_base_depayload_push (depayload, outbuf); gst_rtp_base_depayload_push (depayload, outbuf);

View file

@ -24,7 +24,9 @@
#include <string.h> #include <string.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtpqdmdepay.h" #include "gstrtpqdmdepay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY (rtpqdm2depay_debug); GST_DEBUG_CATEGORY (rtpqdm2depay_debug);
#define GST_CAT_DEFAULT rtpqdm2depay_debug #define GST_CAT_DEFAULT rtpqdm2depay_debug

View file

@ -25,7 +25,9 @@
#endif #endif
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtpsbcdepay.h" #include "gstrtpsbcdepay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpsbcdepay_debug); GST_DEBUG_CATEGORY_STATIC (rtpsbcdepay_debug);
#define GST_CAT_DEFAULT (rtpsbcdepay_debug) #define GST_CAT_DEFAULT (rtpsbcdepay_debug)
@ -241,6 +243,8 @@ gst_rtp_sbc_depay_process (GstRTPBaseDepayload * base, GstRTPBuffer * rtp)
if (last) { if (last) {
data = gst_adapter_take_buffer (depay->adapter, data = gst_adapter_take_buffer (depay->adapter,
gst_adapter_available (depay->adapter)); gst_adapter_available (depay->adapter));
gst_rtp_drop_meta (GST_ELEMENT_CAST (depay), data,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
} else } else
data = NULL; data = NULL;

View file

@ -23,9 +23,11 @@
#include <config.h> #include <config.h>
#endif #endif
#include <gst/audio/audio.h>
#include "gstrtpsbcpay.h" #include "gstrtpsbcpay.h"
#include <math.h> #include <math.h>
#include <string.h> #include <string.h>
#include "gstrtputils.h"
#define RTP_SBC_PAYLOAD_HEADER_SIZE 1 #define RTP_SBC_PAYLOAD_HEADER_SIZE 1
#define DEFAULT_MIN_FRAMES 0 #define DEFAULT_MIN_FRAMES 0
@ -199,6 +201,8 @@ gst_rtp_sbc_pay_flush_buffers (GstRtpSBCPay * sbcpay)
gst_rtp_buffer_unmap (&rtp); gst_rtp_buffer_unmap (&rtp);
paybuf = gst_adapter_take_buffer_fast (sbcpay->adapter, payload_length); paybuf = gst_adapter_take_buffer_fast (sbcpay->adapter, payload_length);
gst_rtp_copy_meta (GST_ELEMENT_CAST (sbcpay), outbuf, paybuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
outbuf = gst_buffer_append (outbuf, paybuf); outbuf = gst_buffer_append (outbuf, paybuf);
/* FIXME: what about duration? */ /* FIXME: what about duration? */

View file

@ -26,7 +26,9 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtpsirendepay.h" #include "gstrtpsirendepay.h"
#include "gstrtputils.h"
static GstStaticPadTemplate gst_rtp_siren_depay_sink_template = static GstStaticPadTemplate gst_rtp_siren_depay_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink", GST_STATIC_PAD_TEMPLATE ("sink",
@ -108,6 +110,11 @@ gst_rtp_siren_depay_process (GstRTPBaseDepayload * depayload,
outbuf = gst_rtp_buffer_get_payload_buffer (rtp); outbuf = gst_rtp_buffer_get_payload_buffer (rtp);
if (outbuf) {
gst_rtp_drop_meta (GST_ELEMENT_CAST (depayload), outbuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
}
return outbuf; return outbuf;
} }

View file

@ -24,8 +24,10 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtpspeexdepay.h" #include "gstrtpspeexdepay.h"
#include "gstrtputils.h"
/* RtpSPEEXDepay signals and args */ /* RtpSPEEXDepay signals and args */
enum enum
@ -208,8 +210,11 @@ gst_rtp_speex_depay_process (GstRTPBaseDepayload * depayload,
/* nothing special to be done */ /* nothing special to be done */
outbuf = gst_rtp_buffer_get_payload_buffer (rtp); outbuf = gst_rtp_buffer_get_payload_buffer (rtp);
if (outbuf) if (outbuf) {
GST_BUFFER_DURATION (outbuf) = 20 * GST_MSECOND; GST_BUFFER_DURATION (outbuf) = 20 * GST_MSECOND;
gst_rtp_drop_meta (GST_ELEMENT_CAST (depayload), outbuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
}
return outbuf; return outbuf;
} }

View file

@ -24,8 +24,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtpspeexpay.h" #include "gstrtpspeexpay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpspeexpay_debug); GST_DEBUG_CATEGORY_STATIC (rtpspeexpay_debug);
#define GST_CAT_DEFAULT (rtpspeexpay_debug) #define GST_CAT_DEFAULT (rtpspeexpay_debug)
@ -287,6 +289,8 @@ gst_rtp_speex_pay_handle_buffer (GstRTPBasePayload * basepayload,
GST_BUFFER_PTS (outbuf) = timestamp; GST_BUFFER_PTS (outbuf) = timestamp;
GST_BUFFER_DURATION (outbuf) = duration; GST_BUFFER_DURATION (outbuf) = duration;
gst_rtp_copy_meta (GST_ELEMENT_CAST (basepayload), outbuf, buffer,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
outbuf = gst_buffer_append (outbuf, buffer); outbuf = gst_buffer_append (outbuf, buffer);
buffer = NULL; buffer = NULL;

View file

@ -24,7 +24,9 @@
#include <string.h> #include <string.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/video/video.h>
#include "gstrtpsv3vdepay.h" #include "gstrtpsv3vdepay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY (rtpsv3vdepay_debug); GST_DEBUG_CATEGORY (rtpsv3vdepay_debug);
#define GST_CAT_DEFAULT rtpsv3vdepay_debug #define GST_CAT_DEFAULT rtpsv3vdepay_debug
@ -263,6 +265,8 @@ gst_rtp_sv3v_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
avail = gst_adapter_available (rtpsv3vdepay->adapter); avail = gst_adapter_available (rtpsv3vdepay->adapter);
GST_DEBUG ("Returning completed output buffer [%d bytes]", avail); GST_DEBUG ("Returning completed output buffer [%d bytes]", avail);
outbuf = gst_adapter_take_buffer (rtpsv3vdepay->adapter, avail); outbuf = gst_adapter_take_buffer (rtpsv3vdepay->adapter, avail);
gst_rtp_drop_meta (GST_ELEMENT_CAST (rtpsv3vdepay), outbuf,
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
} }
} }

View file

@ -23,9 +23,11 @@
#include <gst/tag/tag.h> #include <gst/tag/tag.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/video/video.h>
#include <string.h> #include <string.h>
#include "gstrtptheoradepay.h" #include "gstrtptheoradepay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtptheoradepay_debug); GST_DEBUG_CATEGORY_STATIC (rtptheoradepay_debug);
#define GST_CAT_DEFAULT (rtptheoradepay_debug) #define GST_CAT_DEFAULT (rtptheoradepay_debug)
@ -253,8 +255,9 @@ gst_rtp_theora_depay_parse_configuration (GstRtpTheoraDepay * rtptheoradepay,
GST_DEBUG_OBJECT (rtptheoradepay, "reading header %d, size %u", j, GST_DEBUG_OBJECT (rtptheoradepay, "reading header %d, size %u", j,
h_size); h_size);
buf = gst_buffer_new_and_alloc (h_size); buf =
gst_buffer_fill (buf, 0, data, h_size); gst_buffer_copy_region (confbuf, GST_BUFFER_COPY_ALL, data - map.data,
h_size);
conf->headers = g_list_append (conf->headers, buf); conf->headers = g_list_append (conf->headers, buf);
data += h_size; data += h_size;
size -= h_size; size -= h_size;
@ -395,13 +398,16 @@ gst_rtp_theora_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer *outbuf; GstBuffer *outbuf;
GstFlowReturn ret; GstFlowReturn ret;
gint payload_len; gint payload_len;
guint8 *payload, *to_free = NULL; GstMapInfo map;
GstBuffer *payload_buffer = NULL;
guint8 *payload;
guint32 header, ident; guint32 header, ident;
guint8 F, TDT, packets; guint8 F, TDT, packets;
guint length; guint length;
rtptheoradepay = GST_RTP_THEORA_DEPAY (depayload); rtptheoradepay = GST_RTP_THEORA_DEPAY (depayload);
payload = gst_rtp_buffer_get_payload (rtp);
payload_len = gst_rtp_buffer_get_payload_len (rtp); payload_len = gst_rtp_buffer_get_payload_len (rtp);
GST_DEBUG_OBJECT (depayload, "got RTP packet of size %d", payload_len); GST_DEBUG_OBJECT (depayload, "got RTP packet of size %d", payload_len);
@ -453,10 +459,6 @@ gst_rtp_theora_depay_process (GstRTPBaseDepayload * depayload,
} }
} }
/* skip header */
payload += 4;
payload_len -= 4;
/* fragmented packets, assemble */ /* fragmented packets, assemble */
if (F != 0) { if (F != 0) {
GstBuffer *vdata; GstBuffer *vdata;
@ -485,20 +487,18 @@ gst_rtp_theora_depay_process (GstRTPBaseDepayload * depayload,
goto no_output; goto no_output;
/* construct assembled buffer */ /* construct assembled buffer */
payload_len = gst_adapter_available (rtptheoradepay->adapter); payload_buffer =
payload = gst_adapter_take (rtptheoradepay->adapter, payload_len); gst_adapter_take_buffer (rtptheoradepay->adapter, payload_len);
/* use this length */
length = payload_len - 2;
to_free = payload;
} else { } else {
/* read length from data */ payload_buffer = gst_rtp_buffer_get_payload_subbuffer (rtp, 4, -1);
length = 0;
} }
GST_DEBUG_OBJECT (depayload, "assemble done, payload_len %d", payload_len); GST_DEBUG_OBJECT (depayload, "assemble done, payload_len %d", payload_len);
gst_buffer_map (payload_buffer, &map, GST_MAP_READ);
payload = map.data;
payload_len = map.size;
/* we not assembling anymore now */ /* we not assembling anymore now */
rtptheoradepay->assembling = FALSE; rtptheoradepay->assembling = FALSE;
gst_adapter_clear (rtptheoradepay->adapter); gst_adapter_clear (rtptheoradepay->adapter);
@ -519,9 +519,6 @@ gst_rtp_theora_depay_process (GstRTPBaseDepayload * depayload,
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+* * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+*
*/ */
while (payload_len >= 2) { while (payload_len >= 2) {
if (length == 0)
length = GST_READ_UINT16_BE (payload);
payload += 2; payload += 2;
payload_len -= 2; payload_len -= 2;
@ -542,15 +539,9 @@ gst_rtp_theora_depay_process (GstRTPBaseDepayload * depayload,
} }
/* create buffer for packet */ /* create buffer for packet */
if (G_UNLIKELY (to_free)) { outbuf =
outbuf = gst_buffer_copy_region (payload_buffer, GST_BUFFER_COPY_ALL,
gst_buffer_new_wrapped_full (0, to_free, (payload - to_free) + length, payload - map.data, length);
payload - to_free, length, to_free, g_free);
to_free = NULL;
} else {
outbuf = gst_buffer_new_and_alloc (length);
gst_buffer_fill (outbuf, 0, payload, length);
}
if (payload_len > 0 && (payload[0] & 0xC0) == 0x0) { if (payload_len > 0 && (payload[0] & 0xC0) == 0x0) {
rtptheoradepay->needs_keyframe = FALSE; rtptheoradepay->needs_keyframe = FALSE;
@ -574,7 +565,11 @@ gst_rtp_theora_depay_process (GstRTPBaseDepayload * depayload,
out: out:
no_output: no_output:
g_free (to_free); if (payload_buffer) {
gst_buffer_unmap (payload_buffer, &map);
gst_buffer_unref (payload_buffer);
}
return NULL; return NULL;
/* ERORRS */ /* ERORRS */

View file

@ -24,9 +24,11 @@
#include <string.h> #include <string.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/video/video.h>
#include "fnv1hash.h" #include "fnv1hash.h"
#include "gstrtptheorapay.h" #include "gstrtptheorapay.h"
#include "gstrtputils.h"
#define THEORA_ID_LEN 42 #define THEORA_ID_LEN 42
@ -151,6 +153,11 @@ gst_rtp_theora_pay_clear_packet (GstRtpTheoraPay * rtptheorapay)
if (rtptheorapay->packet) if (rtptheorapay->packet)
gst_buffer_unref (rtptheorapay->packet); gst_buffer_unref (rtptheorapay->packet);
rtptheorapay->packet = NULL; rtptheorapay->packet = NULL;
g_list_foreach (rtptheorapay->packet_buffers, (GFunc) gst_mini_object_unref,
NULL);
g_list_free (rtptheorapay->packet_buffers);
rtptheorapay->packet_buffers = NULL;
} }
static void static void
@ -279,6 +286,11 @@ gst_rtp_theora_pay_init_packet (GstRtpTheoraPay * rtptheorapay, guint8 TDT,
if (rtptheorapay->packet) if (rtptheorapay->packet)
gst_buffer_unref (rtptheorapay->packet); gst_buffer_unref (rtptheorapay->packet);
g_list_foreach (rtptheorapay->packet_buffers, (GFunc) gst_mini_object_unref,
NULL);
g_list_free (rtptheorapay->packet_buffers);
rtptheorapay->packet_buffers = NULL;
/* new packet allocate max packet size */ /* new packet allocate max packet size */
rtptheorapay->packet = rtptheorapay->packet =
gst_rtp_buffer_new_allocate_len (GST_RTP_BASE_PAYLOAD_MTU gst_rtp_buffer_new_allocate_len (GST_RTP_BASE_PAYLOAD_MTU
@ -295,6 +307,7 @@ gst_rtp_theora_pay_flush_packet (GstRtpTheoraPay * rtptheorapay)
guint8 *payload; guint8 *payload;
guint hlen; guint hlen;
GstRTPBuffer rtp = { NULL }; GstRTPBuffer rtp = { NULL };
GList *l;
/* check for empty packet */ /* check for empty packet */
if (!rtptheorapay->packet || rtptheorapay->payload_pos <= 4) if (!rtptheorapay->packet || rtptheorapay->payload_pos <= 4)
@ -332,6 +345,15 @@ gst_rtp_theora_pay_flush_packet (GstRtpTheoraPay * rtptheorapay)
GST_BUFFER_DURATION (rtptheorapay->packet) = rtptheorapay->payload_duration; GST_BUFFER_DURATION (rtptheorapay->packet) = rtptheorapay->payload_duration;
for (l = g_list_last (rtptheorapay->packet_buffers); l; l = l->prev) {
GstBuffer *buf = GST_BUFFER_CAST (l->data);
gst_rtp_copy_meta (GST_ELEMENT_CAST (rtptheorapay), rtptheorapay->packet,
buf, g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
gst_buffer_unref (buf);
}
g_list_free (rtptheorapay->packet_buffers);
rtptheorapay->packet_buffers = NULL;
/* push, this gives away our ref to the packet, so clear it. */ /* push, this gives away our ref to the packet, so clear it. */
ret = ret =
gst_rtp_base_payload_push (GST_RTP_BASE_PAYLOAD (rtptheorapay), gst_rtp_base_payload_push (GST_RTP_BASE_PAYLOAD (rtptheorapay),
@ -498,10 +520,7 @@ gst_rtp_theora_pay_finish_headers (GstRTPBasePayload * basepayload)
gst_buffer_extract (buf, 0, data, gst_buffer_get_size (buf)); gst_buffer_extract (buf, 0, data, gst_buffer_get_size (buf));
data += gst_buffer_get_size (buf); data += gst_buffer_get_size (buf);
gst_buffer_unref (buf);
} }
g_list_free (rtptheorapay->headers);
rtptheorapay->headers = NULL;
rtptheorapay->need_headers = FALSE; rtptheorapay->need_headers = FALSE;
/* serialize to base64 */ /* serialize to base64 */
@ -619,8 +638,8 @@ invalid_version:
static GstFlowReturn static GstFlowReturn
gst_rtp_theora_pay_payload_buffer (GstRtpTheoraPay * rtptheorapay, guint8 TDT, gst_rtp_theora_pay_payload_buffer (GstRtpTheoraPay * rtptheorapay, guint8 TDT,
guint8 * data, guint size, GstClockTime timestamp, GstClockTime duration, GstBuffer * buffer, guint8 * data, guint size, GstClockTime timestamp,
guint not_in_length) GstClockTime duration, guint not_in_length)
{ {
GstFlowReturn ret = GST_FLOW_OK; GstFlowReturn ret = GST_FLOW_OK;
guint newsize; guint newsize;
@ -677,6 +696,21 @@ gst_rtp_theora_pay_payload_buffer (GstRtpTheoraPay * rtptheorapay, guint8 TDT,
if (plen) if (plen)
memcpy (&ppos[2], data, plen); memcpy (&ppos[2], data, plen);
if (buffer) {
if (!rtptheorapay->packet_buffers
|| rtptheorapay->packet_buffers->data != (gpointer) buffer)
rtptheorapay->packet_buffers =
g_list_prepend (rtptheorapay->packet_buffers,
gst_buffer_ref (buffer));
} else {
GList *l;
for (l = rtptheorapay->headers; l; l = l->next)
rtptheorapay->packet_buffers =
g_list_prepend (rtptheorapay->packet_buffers,
gst_buffer_ref (buffer));
}
/* only first (only) configuration cuts length field */ /* only first (only) configuration cuts length field */
/* NOTE: spec (if any) is not clear on this ... */ /* NOTE: spec (if any) is not clear on this ... */
not_in_length = 0; not_in_length = 0;
@ -790,15 +824,9 @@ gst_rtp_theora_pay_handle_buffer (GstRTPBasePayload * basepayload,
rtptheorapay->headers = g_list_append (rtptheorapay->headers, buffer); rtptheorapay->headers = g_list_append (rtptheorapay->headers, buffer);
ret = GST_FLOW_OK; ret = GST_FLOW_OK;
goto done; goto done;
} else if (rtptheorapay->headers) { } else if (rtptheorapay->headers && rtptheorapay->need_headers) {
if (rtptheorapay->need_headers) { if (!gst_rtp_theora_pay_finish_headers (basepayload))
if (!gst_rtp_theora_pay_finish_headers (basepayload)) goto header_error;
goto header_error;
} else {
g_list_free_full (rtptheorapay->headers,
(GDestroyNotify) gst_buffer_unref);
rtptheorapay->headers = NULL;
}
} }
/* there is a config request, see if we need to insert it */ /* there is a config request, see if we need to insert it */
@ -839,7 +867,7 @@ gst_rtp_theora_pay_handle_buffer (GstRTPBasePayload * basepayload,
/* we need to send config now first */ /* we need to send config now first */
/* different TDT type forces flush */ /* different TDT type forces flush */
gst_rtp_theora_pay_payload_buffer (rtptheorapay, 1, gst_rtp_theora_pay_payload_buffer (rtptheorapay, 1,
rtptheorapay->config_data, rtptheorapay->config_size, NULL, rtptheorapay->config_data, rtptheorapay->config_size,
timestamp, GST_CLOCK_TIME_NONE, rtptheorapay->config_extra_len); timestamp, GST_CLOCK_TIME_NONE, rtptheorapay->config_extra_len);
if (timestamp != -1) { if (timestamp != -1) {
@ -848,7 +876,8 @@ gst_rtp_theora_pay_handle_buffer (GstRTPBasePayload * basepayload,
} }
} }
ret = gst_rtp_theora_pay_payload_buffer (rtptheorapay, TDT, data, size, ret =
gst_rtp_theora_pay_payload_buffer (rtptheorapay, TDT, buffer, data, size,
timestamp, duration, 0); timestamp, duration, 0);
gst_buffer_unmap (buffer, &map); gst_buffer_unmap (buffer, &map);

View file

@ -50,6 +50,7 @@ struct _GstRtpTheoraPay
/* queues of buffers along with some stats. */ /* queues of buffers along with some stats. */
GstBuffer *packet; GstBuffer *packet;
GList *packet_buffers;
guint payload_pos; guint payload_pos;
guint payload_left; guint payload_left;
guint32 payload_ident; guint32 payload_ident;

97
gst/rtp/gstrtputils.c Normal file
View file

@ -0,0 +1,97 @@
/* GStreamer
* Copyright (C) 2015 Sebastian Dröge <sebastian@centricular.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "gstrtputils.h"
typedef struct
{
GstElement *element;
GstBuffer *outbuf;
GQuark copy_tag;
} CopyMetaData;
static gboolean
foreach_metadata_copy (GstBuffer * inbuf, GstMeta ** meta, gpointer user_data)
{
CopyMetaData *data = user_data;
GstElement *element = data->element;
GstBuffer *outbuf = data->outbuf;
GQuark copy_tag = data->copy_tag;
const GstMetaInfo *info = (*meta)->info;
const gchar *const *tags = gst_meta_api_type_get_tags (info->api);
if (!tags || (copy_tag != 0 && g_strv_length ((gchar **) tags) == 1
&& gst_meta_api_type_has_tag (info->api, copy_tag))) {
GstMetaTransformCopy copy_data = { FALSE, 0, -1 };
GST_DEBUG_OBJECT (element, "copy metadata %s", g_type_name (info->api));
/* simply copy then */
info->transform_func (outbuf, *meta, inbuf,
_gst_meta_transform_copy, &copy_data);
} else {
GST_DEBUG_OBJECT (element, "not copying metadata %s",
g_type_name (info->api));
}
return TRUE;
}
/* TODO: Should probably make copy_tag an array at some point */
void
gst_rtp_copy_meta (GstElement * element, GstBuffer * outbuf, GstBuffer * inbuf,
GQuark copy_tag)
{
CopyMetaData data = { element, outbuf, copy_tag };
gst_buffer_foreach_meta (inbuf, foreach_metadata_copy, &data);
}
typedef struct
{
GstElement *element;
GQuark keep_tag;
} DropMetaData;
static gboolean
foreach_metadata_drop (GstBuffer * inbuf, GstMeta ** meta, gpointer user_data)
{
DropMetaData *data = user_data;
GstElement *element = data->element;
GQuark keep_tag = data->keep_tag;
const GstMetaInfo *info = (*meta)->info;
const gchar *const *tags = gst_meta_api_type_get_tags (info->api);
if (!tags || (keep_tag != 0 && g_strv_length ((gchar **) tags) == 1
&& gst_meta_api_type_has_tag (info->api, keep_tag))) {
GST_DEBUG_OBJECT (element, "keeping metadata %s", g_type_name (info->api));
} else {
GST_DEBUG_OBJECT (element, "dropping metadata %s", g_type_name (info->api));
*meta = NULL;
}
return TRUE;
}
/* TODO: Should probably make keep_tag an array at some point */
void
gst_rtp_drop_meta (GstElement * element, GstBuffer * buf, GQuark keep_tag)
{
DropMetaData data = { element, keep_tag };
gst_buffer_foreach_meta (buf, foreach_metadata_drop, &data);
}

33
gst/rtp/gstrtputils.h Normal file
View file

@ -0,0 +1,33 @@
/* GStreamer
* Copyright (C) 2015 Sebastian Dröge <sebastian@centricular.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_RTP_UTILS_H__
#define __GST_RTP_UTILS_H__
#include <gst/gst.h>
G_BEGIN_DECLS
void gst_rtp_copy_meta (GstElement * element, GstBuffer *outbuf, GstBuffer *inbuf, GQuark copy_tag);
void gst_rtp_drop_meta (GstElement * element, GstBuffer *buf, GQuark keep_tag);
G_END_DECLS
#endif /* __GST_RTP_UTILS_H__ */

View file

@ -23,9 +23,11 @@
#include <gst/tag/tag.h> #include <gst/tag/tag.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include <string.h> #include <string.h>
#include "gstrtpvorbisdepay.h" #include "gstrtpvorbisdepay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpvorbisdepay_debug); GST_DEBUG_CATEGORY_STATIC (rtpvorbisdepay_debug);
#define GST_CAT_DEFAULT (rtpvorbisdepay_debug) #define GST_CAT_DEFAULT (rtpvorbisdepay_debug)
@ -288,7 +290,7 @@ gst_rtp_vorbis_depay_parse_configuration (GstRtpVorbisDepay * rtpvorbisdepay,
GST_DEBUG_OBJECT (rtpvorbisdepay, "reading header %d, size %u", j, GST_DEBUG_OBJECT (rtpvorbisdepay, "reading header %d, size %u", j,
h_size); h_size);
buf = gst_buffer_copy_region (confbuf, GST_BUFFER_COPY_MEMORY, offset, buf = gst_buffer_copy_region (confbuf, GST_BUFFER_COPY_ALL, offset,
h_size); h_size);
conf->headers = g_list_append (conf->headers, buf); conf->headers = g_list_append (conf->headers, buf);
offset += h_size; offset += h_size;
@ -443,13 +445,16 @@ gst_rtp_vorbis_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer *outbuf; GstBuffer *outbuf;
GstFlowReturn ret; GstFlowReturn ret;
gint payload_len; gint payload_len;
guint8 *payload, *to_free = NULL; GstBuffer *payload_buffer = NULL;
guint8 *payload;
GstMapInfo map;
guint32 header, ident; guint32 header, ident;
guint8 F, VDT, packets; guint8 F, VDT, packets;
guint length; guint length;
rtpvorbisdepay = GST_RTP_VORBIS_DEPAY (depayload); rtpvorbisdepay = GST_RTP_VORBIS_DEPAY (depayload);
payload = gst_rtp_buffer_get_payload (rtp);
payload_len = gst_rtp_buffer_get_payload_len (rtp); payload_len = gst_rtp_buffer_get_payload_len (rtp);
GST_DEBUG_OBJECT (depayload, "got RTP packet of size %d", payload_len); GST_DEBUG_OBJECT (depayload, "got RTP packet of size %d", payload_len);
@ -458,8 +463,6 @@ gst_rtp_vorbis_depay_process (GstRTPBaseDepayload * depayload,
if (G_UNLIKELY (payload_len < 4)) if (G_UNLIKELY (payload_len < 4))
goto packet_short; goto packet_short;
payload = gst_rtp_buffer_get_payload (rtp);
header = GST_READ_UINT32_BE (payload); header = GST_READ_UINT32_BE (payload);
/* /*
* 0 1 2 3 * 0 1 2 3
@ -501,10 +504,6 @@ gst_rtp_vorbis_depay_process (GstRTPBaseDepayload * depayload,
} }
} }
/* skip header */
payload += 4;
payload_len -= 4;
GST_DEBUG_OBJECT (depayload, "ident: %u, F: %d, VDT: %d, packets: %d", ident, GST_DEBUG_OBJECT (depayload, "ident: %u, F: %d, VDT: %d, packets: %d", ident,
F, VDT, packets); F, VDT, packets);
@ -536,20 +535,18 @@ gst_rtp_vorbis_depay_process (GstRTPBaseDepayload * depayload,
goto no_output; goto no_output;
/* construct assembled buffer */ /* construct assembled buffer */
payload_len = gst_adapter_available (rtpvorbisdepay->adapter); payload_buffer =
payload = gst_adapter_take (rtpvorbisdepay->adapter, payload_len); gst_adapter_take_buffer (rtpvorbisdepay->adapter, payload_len);
/* use this length */
length = payload_len - 2;
to_free = payload;
} else { } else {
/* read length from data */ payload_buffer = gst_rtp_buffer_get_payload_subbuffer (rtp, 4, -1);
length = 0;
} }
GST_DEBUG_OBJECT (depayload, "assemble done"); GST_DEBUG_OBJECT (depayload, "assemble done");
gst_buffer_map (payload_buffer, &map, GST_MAP_READ);
payload = map.data;
payload_len = map.size;
/* we not assembling anymore now */ /* we not assembling anymore now */
rtpvorbisdepay->assembling = FALSE; rtpvorbisdepay->assembling = FALSE;
gst_adapter_clear (rtpvorbisdepay->adapter); gst_adapter_clear (rtpvorbisdepay->adapter);
@ -570,8 +567,7 @@ gst_rtp_vorbis_depay_process (GstRTPBaseDepayload * depayload,
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+* * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+*
*/ */
while (payload_len > 2) { while (payload_len > 2) {
if (length == 0) length = GST_READ_UINT16_BE (payload);
length = GST_READ_UINT16_BE (payload);
payload += 2; payload += 2;
payload_len -= 2; payload_len -= 2;
@ -593,17 +589,9 @@ gst_rtp_vorbis_depay_process (GstRTPBaseDepayload * depayload,
} }
/* create buffer for packet */ /* create buffer for packet */
if (G_UNLIKELY (to_free)) { outbuf =
outbuf = gst_buffer_new (); gst_buffer_copy_region (payload_buffer, GST_BUFFER_COPY_ALL,
gst_buffer_append_memory (outbuf, payload - map.data, length);
gst_memory_new_wrapped (0, to_free,
(payload - to_free) + length, payload - to_free, length, to_free,
g_free));
to_free = NULL;
} else {
outbuf = gst_buffer_new_and_alloc (length);
gst_buffer_fill (outbuf, 0, payload, length);
}
payload += length; payload += length;
payload_len -= length; payload_len -= length;
@ -615,12 +603,17 @@ gst_rtp_vorbis_depay_process (GstRTPBaseDepayload * depayload,
break; break;
} }
g_free (to_free); gst_buffer_unmap (payload_buffer, &map);
gst_buffer_unref (payload_buffer);
return NULL; return NULL;
no_output: no_output:
{ {
if (payload_buffer) {
gst_buffer_unmap (payload_buffer, &map);
gst_buffer_unref (payload_buffer);
}
return NULL; return NULL;
} }
/* ERORRS */ /* ERORRS */
@ -628,23 +621,39 @@ switch_failed:
{ {
GST_ELEMENT_WARNING (rtpvorbisdepay, STREAM, DECODE, GST_ELEMENT_WARNING (rtpvorbisdepay, STREAM, DECODE,
(NULL), ("Could not switch codebooks")); (NULL), ("Could not switch codebooks"));
if (payload_buffer) {
gst_buffer_unmap (payload_buffer, &map);
gst_buffer_unref (payload_buffer);
}
return NULL; return NULL;
} }
packet_short: packet_short:
{ {
GST_ELEMENT_WARNING (rtpvorbisdepay, STREAM, DECODE, GST_ELEMENT_WARNING (rtpvorbisdepay, STREAM, DECODE,
(NULL), ("Packet was too short (%d < 4)", payload_len)); (NULL), ("Packet was too short (%d < 4)", payload_len));
if (payload_buffer) {
gst_buffer_unmap (payload_buffer, &map);
gst_buffer_unref (payload_buffer);
}
return NULL; return NULL;
} }
ignore_reserved: ignore_reserved:
{ {
GST_WARNING_OBJECT (rtpvorbisdepay, "reserved VDT ignored"); GST_WARNING_OBJECT (rtpvorbisdepay, "reserved VDT ignored");
if (payload_buffer) {
gst_buffer_unmap (payload_buffer, &map);
gst_buffer_unref (payload_buffer);
}
return NULL; return NULL;
} }
length_short: length_short:
{ {
GST_ELEMENT_WARNING (rtpvorbisdepay, STREAM, DECODE, GST_ELEMENT_WARNING (rtpvorbisdepay, STREAM, DECODE,
(NULL), ("Packet contains invalid data")); (NULL), ("Packet contains invalid data"));
if (payload_buffer) {
gst_buffer_unmap (payload_buffer, &map);
gst_buffer_unref (payload_buffer);
}
return NULL; return NULL;
} }
invalid_configuration: invalid_configuration:
@ -652,6 +661,10 @@ invalid_configuration:
/* fatal, as we otherwise risk carrying on without output */ /* fatal, as we otherwise risk carrying on without output */
GST_ELEMENT_ERROR (rtpvorbisdepay, STREAM, DECODE, GST_ELEMENT_ERROR (rtpvorbisdepay, STREAM, DECODE,
(NULL), ("Packet contains invalid configuration")); (NULL), ("Packet contains invalid configuration"));
if (payload_buffer) {
gst_buffer_unmap (payload_buffer, &map);
gst_buffer_unref (payload_buffer);
}
return NULL; return NULL;
} }
} }

View file

@ -24,9 +24,11 @@
#include <string.h> #include <string.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "fnv1hash.h" #include "fnv1hash.h"
#include "gstrtpvorbispay.h" #include "gstrtpvorbispay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpvorbispay_debug); GST_DEBUG_CATEGORY_STATIC (rtpvorbispay_debug);
#define GST_CAT_DEFAULT (rtpvorbispay_debug) #define GST_CAT_DEFAULT (rtpvorbispay_debug)
@ -143,6 +145,10 @@ gst_rtp_vorbis_pay_clear_packet (GstRtpVorbisPay * rtpvorbispay)
if (rtpvorbispay->packet) if (rtpvorbispay->packet)
gst_buffer_unref (rtpvorbispay->packet); gst_buffer_unref (rtpvorbispay->packet);
rtpvorbispay->packet = NULL; rtpvorbispay->packet = NULL;
g_list_foreach (rtpvorbispay->packet_buffers, (GFunc) gst_mini_object_unref,
NULL);
g_list_free (rtpvorbispay->packet_buffers);
rtpvorbispay->packet_buffers = NULL;
} }
static void static void
@ -273,6 +279,10 @@ gst_rtp_vorbis_pay_init_packet (GstRtpVorbisPay * rtpvorbispay, guint8 VDT,
if (rtpvorbispay->packet) if (rtpvorbispay->packet)
gst_buffer_unref (rtpvorbispay->packet); gst_buffer_unref (rtpvorbispay->packet);
g_list_foreach (rtpvorbispay->packet_buffers, (GFunc) gst_mini_object_unref,
NULL);
g_list_free (rtpvorbispay->packet_buffers);
rtpvorbispay->packet_buffers = NULL;
/* new packet allocate max packet size */ /* new packet allocate max packet size */
rtpvorbispay->packet = rtpvorbispay->packet =
@ -290,6 +300,7 @@ gst_rtp_vorbis_pay_flush_packet (GstRtpVorbisPay * rtpvorbispay)
guint8 *payload; guint8 *payload;
guint hlen; guint hlen;
GstRTPBuffer rtp = { NULL }; GstRTPBuffer rtp = { NULL };
GList *l;
/* check for empty packet */ /* check for empty packet */
if (!rtpvorbispay->packet || rtpvorbispay->payload_pos <= 4) if (!rtpvorbispay->packet || rtpvorbispay->payload_pos <= 4)
@ -327,6 +338,15 @@ gst_rtp_vorbis_pay_flush_packet (GstRtpVorbisPay * rtpvorbispay)
GST_BUFFER_DURATION (rtpvorbispay->packet) = rtpvorbispay->payload_duration; GST_BUFFER_DURATION (rtpvorbispay->packet) = rtpvorbispay->payload_duration;
for (l = g_list_last (rtpvorbispay->packet_buffers); l; l = l->prev) {
GstBuffer *buf = GST_BUFFER_CAST (l->data);
gst_rtp_copy_meta (GST_ELEMENT_CAST (rtpvorbispay), rtpvorbispay->packet,
buf, g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
gst_buffer_unref (buf);
}
g_list_free (rtpvorbispay->packet_buffers);
rtpvorbispay->packet_buffers = NULL;
/* push, this gives away our ref to the packet, so clear it. */ /* push, this gives away our ref to the packet, so clear it. */
ret = ret =
gst_rtp_base_payload_push (GST_RTP_BASE_PAYLOAD (rtpvorbispay), gst_rtp_base_payload_push (GST_RTP_BASE_PAYLOAD (rtpvorbispay),
@ -490,10 +510,7 @@ gst_rtp_vorbis_pay_finish_headers (GstRTPBasePayload * basepayload)
gst_buffer_extract (buf, 0, data, gst_buffer_get_size (buf)); gst_buffer_extract (buf, 0, data, gst_buffer_get_size (buf));
data += gst_buffer_get_size (buf); data += gst_buffer_get_size (buf);
gst_buffer_unref (buf);
} }
g_list_free (rtpvorbispay->headers);
rtpvorbispay->headers = NULL;
rtpvorbispay->need_headers = FALSE; rtpvorbispay->need_headers = FALSE;
/* serialize to base64 */ /* serialize to base64 */
@ -597,8 +614,8 @@ invalid_channels:
static GstFlowReturn static GstFlowReturn
gst_rtp_vorbis_pay_payload_buffer (GstRtpVorbisPay * rtpvorbispay, guint8 VDT, gst_rtp_vorbis_pay_payload_buffer (GstRtpVorbisPay * rtpvorbispay, guint8 VDT,
guint8 * data, guint size, GstClockTime timestamp, GstClockTime duration, GstBuffer * buffer, guint8 * data, guint size, GstClockTime timestamp,
guint not_in_length) GstClockTime duration, guint not_in_length)
{ {
GstFlowReturn ret = GST_FLOW_OK; GstFlowReturn ret = GST_FLOW_OK;
guint newsize; guint newsize;
@ -655,6 +672,21 @@ gst_rtp_vorbis_pay_payload_buffer (GstRtpVorbisPay * rtpvorbispay, guint8 VDT,
if (plen) if (plen)
memcpy (&ppos[2], data, plen); memcpy (&ppos[2], data, plen);
if (buffer) {
if (!rtpvorbispay->packet_buffers
|| rtpvorbispay->packet_buffers->data != (gpointer) buffer)
rtpvorbispay->packet_buffers =
g_list_prepend (rtpvorbispay->packet_buffers,
gst_buffer_ref (buffer));
} else {
GList *l;
for (l = rtpvorbispay->headers; l; l = l->next)
rtpvorbispay->packet_buffers =
g_list_prepend (rtpvorbispay->packet_buffers,
gst_buffer_ref (buffer));
}
/* only first (only) configuration cuts length field */ /* only first (only) configuration cuts length field */
/* NOTE: spec (if any) is not clear on this ... */ /* NOTE: spec (if any) is not clear on this ... */
not_in_length = 0; not_in_length = 0;
@ -765,15 +797,9 @@ gst_rtp_vorbis_pay_handle_buffer (GstRTPBasePayload * basepayload,
rtpvorbispay->headers = g_list_append (rtpvorbispay->headers, buffer); rtpvorbispay->headers = g_list_append (rtpvorbispay->headers, buffer);
ret = GST_FLOW_OK; ret = GST_FLOW_OK;
goto done; goto done;
} else if (rtpvorbispay->headers) { } else if (rtpvorbispay->headers && rtpvorbispay->need_headers) {
if (rtpvorbispay->need_headers) { if (!gst_rtp_vorbis_pay_finish_headers (basepayload))
if (!gst_rtp_vorbis_pay_finish_headers (basepayload)) goto header_error;
goto header_error;
} else {
g_list_free_full (rtpvorbispay->headers,
(GDestroyNotify) gst_buffer_unref);
rtpvorbispay->headers = NULL;
}
} }
/* there is a config request, see if we need to insert it */ /* there is a config request, see if we need to insert it */
@ -813,7 +839,7 @@ gst_rtp_vorbis_pay_handle_buffer (GstRTPBasePayload * basepayload,
/* we need to send config now first */ /* we need to send config now first */
/* different TDT type forces flush */ /* different TDT type forces flush */
gst_rtp_vorbis_pay_payload_buffer (rtpvorbispay, 1, gst_rtp_vorbis_pay_payload_buffer (rtpvorbispay, 1,
rtpvorbispay->config_data, rtpvorbispay->config_size, NULL, rtpvorbispay->config_data, rtpvorbispay->config_size,
timestamp, GST_CLOCK_TIME_NONE, rtpvorbispay->config_extra_len); timestamp, GST_CLOCK_TIME_NONE, rtpvorbispay->config_extra_len);
if (timestamp != -1) { if (timestamp != -1) {
@ -822,7 +848,8 @@ gst_rtp_vorbis_pay_handle_buffer (GstRTPBasePayload * basepayload,
} }
} }
ret = gst_rtp_vorbis_pay_payload_buffer (rtpvorbispay, VDT, data, size, ret =
gst_rtp_vorbis_pay_payload_buffer (rtpvorbispay, VDT, buffer, data, size,
timestamp, duration, 0); timestamp, duration, 0);
gst_buffer_unmap (buffer, &map); gst_buffer_unmap (buffer, &map);

View file

@ -50,6 +50,7 @@ struct _GstRtpVorbisPay
/* queues of buffers along with some stats. */ /* queues of buffers along with some stats. */
GstBuffer *packet; GstBuffer *packet;
GList *packet_buffers;
guint payload_pos; guint payload_pos;
guint payload_left; guint payload_left;
guint32 payload_ident; guint32 payload_ident;

View file

@ -23,6 +23,7 @@
#endif #endif
#include "gstrtpvp8depay.h" #include "gstrtpvp8depay.h"
#include "gstrtputils.h"
#include <gst/video/video.h> #include <gst/video/video.h>
@ -184,6 +185,9 @@ gst_rtp_vp8_depay_process (GstRTPBaseDepayload * depay, GstRTPBuffer * rtp)
/* mark keyframes */ /* mark keyframes */
out = gst_buffer_make_writable (out); out = gst_buffer_make_writable (out);
/* Filter away all metas that are not sensible to copy */
gst_rtp_drop_meta (GST_ELEMENT_CAST (self), out,
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
if ((header[0] & 0x01)) { if ((header[0] & 0x01)) {
GST_BUFFER_FLAG_SET (out, GST_BUFFER_FLAG_DELTA_UNIT); GST_BUFFER_FLAG_SET (out, GST_BUFFER_FLAG_DELTA_UNIT);

View file

@ -30,8 +30,10 @@
#include <gst/base/gstbitreader.h> #include <gst/base/gstbitreader.h>
#include <gst/rtp/gstrtppayloads.h> #include <gst/rtp/gstrtppayloads.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/video/video.h>
#include "dboolhuff.h" #include "dboolhuff.h"
#include "gstrtpvp8pay.h" #include "gstrtpvp8pay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (gst_rtp_vp8_pay_debug); GST_DEBUG_CATEGORY_STATIC (gst_rtp_vp8_pay_debug);
#define GST_CAT_DEFAULT gst_rtp_vp8_pay_debug #define GST_CAT_DEFAULT gst_rtp_vp8_pay_debug
@ -411,7 +413,6 @@ gst_rtp_vp8_create_header_buffer (GstRtpVP8Pay * self, guint8 partid,
return out; return out;
} }
static guint static guint
gst_rtp_vp8_payload_next (GstRtpVP8Pay * self, GstBufferList * list, gst_rtp_vp8_payload_next (GstRtpVP8Pay * self, GstBufferList * list,
guint offset, GstBuffer * buffer, gsize buffer_size, gsize max_payload_len) guint offset, GstBuffer * buffer, gsize buffer_size, gsize max_payload_len)
@ -438,6 +439,8 @@ gst_rtp_vp8_payload_next (GstRtpVP8Pay * self, GstBufferList * list,
offset == self->partition_offset[partition], mark, buffer); offset == self->partition_offset[partition], mark, buffer);
sub = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, offset, available); sub = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, offset, available);
gst_rtp_copy_meta (GST_ELEMENT_CAST (self), header, buffer,
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
out = gst_buffer_append (header, sub); out = gst_buffer_append (header, sub);
gst_buffer_list_insert (list, -1, out); gst_buffer_list_insert (list, -1, out);

View file

@ -22,10 +22,12 @@
#endif #endif
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/video/video.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include "gstrtpvrawdepay.h" #include "gstrtpvrawdepay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpvrawdepay_debug); GST_DEBUG_CATEGORY_STATIC (rtpvrawdepay_debug);
#define GST_CAT_DEFAULT (rtpvrawdepay_debug) #define GST_CAT_DEFAULT (rtpvrawdepay_debug)
@ -328,7 +330,7 @@ gst_rtp_vraw_depay_process_packet (GstRTPBaseDepayload * depayload,
gint width, height, xinc, yinc; gint width, height, xinc, yinc;
GstVideoFrame *frame; GstVideoFrame *frame;
gboolean marker; gboolean marker;
GstBuffer *outbuf = NULL; GstBuffer *buf, *outbuf = NULL;
rtpvrawdepay = GST_RTP_VRAW_DEPAY (depayload); rtpvrawdepay = GST_RTP_VRAW_DEPAY (depayload);
@ -396,6 +398,7 @@ gst_rtp_vraw_depay_process_packet (GstRTPBaseDepayload * depayload,
payload = gst_rtp_buffer_get_payload (rtp); payload = gst_rtp_buffer_get_payload (rtp);
payload_len = gst_rtp_buffer_get_payload_len (rtp); payload_len = gst_rtp_buffer_get_payload_len (rtp);
buf = gst_rtp_buffer_get_payload_buffer (rtp);
if (payload_len < 3) if (payload_len < 3)
goto short_packet; goto short_packet;
@ -407,6 +410,9 @@ gst_rtp_vraw_depay_process_packet (GstRTPBaseDepayload * depayload,
/* remember header position */ /* remember header position */
headers = payload; headers = payload;
gst_rtp_copy_meta (GST_ELEMENT_CAST (rtpvrawdepay), frame->buffer, buf,
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
/* find data start */ /* find data start */
do { do {
if (payload_len < 6) if (payload_len < 6)

View file

@ -24,8 +24,10 @@
#include <string.h> #include <string.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include <gst/video/video.h>
#include "gstrtpvrawpay.h" #include "gstrtpvrawpay.h"
#include "gstrtputils.h"
enum enum
{ {
@ -555,6 +557,10 @@ gst_rtp_vraw_pay_handle_buffer (GstRTPBasePayload * payload, GstBuffer * buffer)
gst_buffer_resize (out, 0, gst_buffer_get_size (out) - left); gst_buffer_resize (out, 0, gst_buffer_get_size (out) - left);
} }
gst_rtp_copy_meta (GST_ELEMENT_CAST (rtpvrawpay), out, buffer,
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
/* Now either push out the buffer directly */ /* Now either push out the buffer directly */
if (!use_buffer_lists) { if (!use_buffer_lists) {
ret = gst_rtp_base_payload_push (payload, out); ret = gst_rtp_base_payload_push (payload, out);