Commit b1089fb5 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

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
parent 288b0bbb
......@@ -84,7 +84,8 @@ libgstrtp_la_SOURCES = \
gstrtpvrawdepay.c \
gstrtpvrawpay.c \
gstrtpstreampay.c \
gstrtpstreamdepay.c
gstrtpstreamdepay.c \
gstrtputils.c
libgstrtp_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) \
$(GST_CFLAGS) -Dvp8_norm=gst_rtpvp8_vp8_norm \
......@@ -185,6 +186,7 @@ noinst_HEADERS = \
gstrtpvrawdepay.h \
gstrtpvrawpay.h \
gstrtpstreampay.h \
gstrtpstreamdepay.h
gstrtpstreamdepay.h \
gstrtputils.h
EXTRA_DIST = dboolhuff.LICENSE
......@@ -44,6 +44,7 @@
#include "gstrtpL16depay.h"
#include "gstrtpchannels.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpL16depay_debug);
#define GST_CAT_DEFAULT (rtpL16depay_debug)
......@@ -257,6 +258,9 @@ gst_rtp_L16_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
goto reorder_failed;
}
gst_rtp_drop_meta (GST_ELEMENT_CAST (rtpL16depay), outbuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
return outbuf;
/* ERRORS */
......
......@@ -44,6 +44,7 @@
#include "gstrtpL24depay.h"
#include "gstrtpchannels.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (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);
if (outbuf) {
gst_rtp_drop_meta (GST_ELEMENT_CAST (rtpL24depay), outbuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
}
if (rtpL24depay->order &&
!gst_audio_buffer_reorder_channels (outbuf,
rtpL24depay->info.finfo->format, rtpL24depay->info.channels,
......
......@@ -38,9 +38,11 @@
#endif
#include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include <string.h>
#include "gstrtpac3depay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (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 */
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_buffer_get_size (outbuf));
}
return outbuf;
......
......@@ -40,8 +40,10 @@
#include <string.h>
#include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtpac3pay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpac3pay_debug);
#define GST_CAT_DEFAULT (rtpac3pay_debug)
......@@ -321,6 +323,9 @@ gst_rtp_ac3_pay_flush (GstRtpAC3Pay * rtpac3pay)
payload_buffer =
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);
avail -= payload_len;
......
......@@ -44,10 +44,12 @@
#endif
#include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include <stdlib.h>
#include <string.h>
#include "gstrtpamrdepay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (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 amr_len;
gint ILL, ILP;
GstBuffer *buf;
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_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;
......
......@@ -53,8 +53,10 @@
#include <string.h>
#include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtpamrpay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (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_unref (buffer);
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);
return ret;
......
......@@ -33,7 +33,9 @@
#include <stdlib.h>
#include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtpbvdepay.h"
#include "gstrtputils.h"
static GstStaticPadTemplate gst_rtp_bv_depay_sink_template =
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);
}
if (outbuf) {
gst_rtp_drop_meta (GST_ELEMENT_CAST (depayload), outbuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
}
return outbuf;
}
......
......@@ -24,8 +24,10 @@
#include <string.h>
#include <stdlib.h>
#include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtpceltdepay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (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_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);
}
......
......@@ -24,8 +24,10 @@
#include <stdlib.h>
#include <string.h>
#include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtpceltpay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (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);
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_rtp_buffer_unmap (&rtp);
......
......@@ -33,6 +33,7 @@
#include <gst/gst.h>
#include "gstrtpdvdepay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY (rtpdvdepay_debug);
#define GST_CAT_DEFAULT (rtpdvdepay_debug)
......@@ -280,6 +281,13 @@ calculate_difblock_location (guint8 * block)
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
* 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
......@@ -289,6 +297,7 @@ static GstBuffer *
gst_rtp_dv_depay_process (GstRTPBaseDepayload * base, GstRTPBuffer * rtp)
{
GstBuffer *out = NULL;
GstBuffer *payload_buf;
guint8 *payload;
guint32 rtp_ts;
guint payload_len, location;
......@@ -311,11 +320,13 @@ gst_rtp_dv_depay_process (GstRTPBaseDepayload * base, GstRTPBuffer * rtp)
/* return copy of accumulator. */
out = gst_buffer_copy (dvdepay->acc);
gst_buffer_foreach_meta (dvdepay->acc, foreach_metadata_drop, NULL);
}
/* Extract the payload */
payload_len = gst_rtp_buffer_get_payload_len (rtp);
payload = gst_rtp_buffer_get_payload (rtp);
payload_buf = gst_rtp_buffer_get_payload_buffer (rtp);
/* copy all DIF chunks in their place. */
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. */
if (offset <= dvdepay->frame_size - 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;
}
gst_buffer_unmap (dvdepay->acc, &map);
gst_buffer_unref (payload_buf);
if (marker) {
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
* we set the prev_ts to -1. */
out = gst_buffer_copy (dvdepay->acc);
gst_buffer_foreach_meta (dvdepay->acc, foreach_metadata_drop, NULL);
} else {
GST_WARNING_OBJECT (dvdepay, "waiting for frame headers %02x",
dvdepay->header_mask);
......
......@@ -27,6 +27,7 @@
#include <gst/rtp/gstrtpbuffer.h>
#include "gstrtpdvpay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY (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. */
gst_rtp_buffer_unmap (&rtp);
gst_rtp_copy_meta (GST_ELEMENT_CAST (basepayload), outbuf, buffer, 0);
ret = gst_rtp_base_payload_push (basepayload, outbuf);
if (ret != GST_FLOW_OK)
break;
......
......@@ -28,6 +28,7 @@
#include "gstrtpg722depay.h"
#include "gstrtpchannels.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (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);
}
if (outbuf) {
gst_rtp_drop_meta (GST_ELEMENT_CAST (rtpg722depay), outbuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
}
return outbuf;
/* ERRORS */
......
......@@ -26,8 +26,10 @@
#include <string.h>
#include <gst/rtp/gstrtpbuffer.h>
#include <gst/base/gstadapter.h>
#include <gst/audio/audio.h>
#include "gstrtpg723pay.h"
#include "gstrtputils.h"
#define G723_FRAME_DURATION (30 * GST_MSECOND)
......@@ -162,7 +164,8 @@ gst_rtp_g723_pay_flush (GstRTPG723Pay * pay)
pay->discont = FALSE;
}
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);
ret = gst_rtp_base_payload_push (GST_RTP_BASE_PAYLOAD (pay), outbuf);
......
......@@ -28,8 +28,10 @@
#include <stdlib.h>
#include <string.h>
#include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtpg726depay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (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);
if (!outbuf)
goto bad_len;
gst_rtp_drop_meta (GST_ELEMENT_CAST (depay), outbuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
} else {
guint8 *in, *out, tmp;
guint len;
......@@ -239,6 +243,9 @@ gst_rtp_g726_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
goto bad_len;
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);
out = map.data;
......
......@@ -21,10 +21,12 @@
#endif
#include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include <stdlib.h>
#include <string.h>
#include "gstrtpg729depay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (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_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_buffer_get_size (outbuf));
......
......@@ -32,8 +32,10 @@
#include <string.h>
#include <gst/rtp/gstrtpbuffer.h>
#include <gst/base/gstadapter.h>
#include <gst/audio/audio.h>
#include "gstrtpg729pay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (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);
/* 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);
ret = gst_rtp_base_payload_push (basepayload, outbuf);
......
......@@ -24,7 +24,9 @@
#include <string.h>
#include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtpgsmdepay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (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);
}
if (outbuf) {
gst_rtp_drop_meta (GST_ELEMENT_CAST (depayload), outbuf,
g_quark_from_static_string (GST_META_TAG_AUDIO_STR));
}
return outbuf;
}
......
......@@ -25,8 +25,10 @@
#include <stdlib.h>
#include <string.h>
#include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtpgsmpay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpgsmpay_debug);
#define GST_CAT_DEFAULT (rtpgsmpay_debug)
......
......@@ -25,6 +25,7 @@
#include <stdlib.h>
#include "gstrtpgstdepay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (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;
/* ERRORS */
......
......@@ -26,6 +26,7 @@
#include <gst/rtp/gstrtpbuffer.h>
#include "gstrtpgstpay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (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);
/* 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);
GST_BUFFER_PTS (outbuf) = timestamp;
......
......@@ -45,8 +45,10 @@
#include <string.h>
#include <gst/rtp/gstrtpbuffer.h>
#include <gst/video/video.h>
#include "gstrtph261depay.h"
#include "gstrtph261pay.h" /* GstRtpH261PayHeader */
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtph261depay_debug);
#define GST_CAT_DEFAULT (rtph261depay_debug)
......@@ -168,6 +170,8 @@ skip:
avail = gst_adapter_available (depay->adapter);
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
* stream is intra coded. */
......
......@@ -49,7 +49,9 @@
#endif
#include "gstrtph261pay.h"
#include "gstrtputils.h"
#include <gst/rtp/gstrtpbuffer.h>
#include <gst/video/video.h>
#include <gst/base/gstbitreader.h>
#include <string.h>
......@@ -798,9 +800,9 @@ gst_rtp_h261_pay_init_gobs (GstRtpH261Pay * pay, Gob * gobs, gint num_gobs,
}
static GstFlowReturn
gst_rtp_h261_pay_fragment_push (GstRtpH261Pay * pay, const guint8 * bits,
guint start, guint end, const Macroblock * last_mb_in_previous_packet,
gboolean marker)
gst_rtp_h261_pay_fragment_push (GstRtpH261Pay * pay, GstBuffer * buffer,
const guint8 * bits, guint start, guint end,
const Macroblock * last_mb_in_previous_packet, gboolean marker)
{
GstBuffer *outbuf;
guint8 *payload;
......@@ -848,12 +850,15 @@ gst_rtp_h261_pay_fragment_push (GstRtpH261Pay * pay, const guint8 * bits,
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);
}
static GstFlowReturn
gst_rtp_h261_packetize_and_push (GstRtpH261Pay * pay, const guint8 * bits,
gsize len)
gst_rtp_h261_packetize_and_push (GstRtpH261Pay * pay, GstBuffer * buffer,
const guint8 * bits, gsize len)
{
GstFlowReturn ret = GST_FLOW_OK;
GstBitReader br_;
......@@ -923,7 +928,7 @@ gst_rtp_h261_packetize_and_push (GstRtpH261Pay * pay, const guint8 * bits,
goto beach;
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 = gob->last;
......@@ -1003,7 +1008,7 @@ gst_rtp_h261_pay_handle_buffer (GstRTPBasePayload * payload, GstBuffer * buffer)
shift = pay->offset - psc_offset;
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);
beach:
......
......@@ -30,7 +30,9 @@
#include <string.h>
#include <gst/rtp/gstrtpbuffer.h>
#include <gst/video/video.h>
#include "gstrtph263depay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtph263depay_debug);
#define GST_CAT_DEFAULT (rtph263depay_debug)
......@@ -384,6 +386,9 @@ skip:
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);
rtph263depay->offset = 0;
rtph263depay->leftover = 0;
......
......@@ -27,8 +27,10 @@
#include <string.h>
#include <math.h>
#include <gst/rtp/gstrtpbuffer.h>
#include <gst/video/video.h>
#include "gstrtph263pay.h"
#include "gstrtputils.h"
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_MEMORY, package->payload_start - rtph263pay->map.data,
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 =
gst_rtp_base_payload_push (GST_RTP_BASE_PAYLOAD (rtph263pay),
......
......@@ -24,7 +24,9 @@
#include <string.h>
#include <gst/rtp/gstrtpbuffer.h>
#include <gst/video/video.h>
#include "gstrtph263pdepay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (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);
}
gst_rtp_drop_meta (GST_ELEMENT_CAST (rtph263pdepay), outbuf,
g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
return outbuf;
} else {
/* frame not completed: store in adapter */
......
......@@ -26,8 +26,10 @@
#include <stdio.h>
#include <gst/rtp/gstrtpbuffer.h>
#include <gst/video/video.h>
#include "gstrtph263ppay.h"
#include "gstrtputils.h"
#define DEFAULT_FRAGMENTATION_MODE GST_FRAGMENTATION_MODE_NORMAL
......@@ -735,6 +737,8 @@ gst_rtp_h263p_pay_flush (GstRtpH263PPay * rtph263ppay)
gst_rtp_buffer_unmap (&rtp);
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);
avail -= towrite;
......
......@@ -27,7 +27,9 @@
#include <gst/base/gstbitreader.h>
#include <gst/rtp/gstrtpbuffer.h>
#include <gst/pbutils/pbutils.h>
#include <gst/video/video.h>
#include "gstrtph264depay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (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 */
if (rtph264depay->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);
rtph264depay->codec_data = NULL;
out_keyframe = TRUE;
}
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;
if (out_keyframe)
......@@ -947,6 +955,7 @@ static GstBuffer *
gst_rtp_h264_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstRtpH264Depay *rtph264depay;
GstBuffer *buf;
GstBuffer *outbuf = NULL;
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 = gst_rtp_buffer_get_payload (rtp);
buf = gst_rtp_buffer_get_payload_buffer (rtp);
marker = gst_rtp_buffer_get_marker (rtp);
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);
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,
marker);
......@@ -1140,6 +1153,9 @@ gst_rtp_h264_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
map.data[sizeof (sync_bytes)] = nal_header;
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);
/* 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);
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);
/* 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);
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,
marker);
break;
......@@ -1195,29 +1217,35 @@ gst_rtp_h264_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
}
}