mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-25 07:26:29 +00:00
-good: port some more plugins
This commit is contained in:
parent
e221908169
commit
409f29700d
3 changed files with 120 additions and 125 deletions
|
@ -127,7 +127,7 @@ static void gst_audio_panorama_get_property (GObject * object, guint prop_id,
|
||||||
static gboolean gst_audio_panorama_get_unit_size (GstBaseTransform * base,
|
static gboolean gst_audio_panorama_get_unit_size (GstBaseTransform * base,
|
||||||
GstCaps * caps, gsize * size);
|
GstCaps * caps, gsize * size);
|
||||||
static GstCaps *gst_audio_panorama_transform_caps (GstBaseTransform * base,
|
static GstCaps *gst_audio_panorama_transform_caps (GstBaseTransform * base,
|
||||||
GstPadDirection direction, GstCaps * caps);
|
GstPadDirection direction, GstCaps * caps, GstCaps * filter);
|
||||||
static gboolean gst_audio_panorama_set_caps (GstBaseTransform * base,
|
static gboolean gst_audio_panorama_set_caps (GstBaseTransform * base,
|
||||||
GstCaps * incaps, GstCaps * outcaps);
|
GstCaps * incaps, GstCaps * outcaps);
|
||||||
|
|
||||||
|
@ -331,7 +331,7 @@ gst_audio_panorama_get_unit_size (GstBaseTransform * base, GstCaps * caps,
|
||||||
|
|
||||||
static GstCaps *
|
static GstCaps *
|
||||||
gst_audio_panorama_transform_caps (GstBaseTransform * base,
|
gst_audio_panorama_transform_caps (GstBaseTransform * base,
|
||||||
GstPadDirection direction, GstCaps * caps)
|
GstPadDirection direction, GstCaps * caps, GstCaps * filter)
|
||||||
{
|
{
|
||||||
GstCaps *res;
|
GstCaps *res;
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
|
|
|
@ -1151,6 +1151,7 @@ gst_rtp_bin_handle_sync (GstElement * jitterbuffer, GstStructure * s,
|
||||||
guint clock_rate;
|
guint clock_rate;
|
||||||
guint64 extrtptime;
|
guint64 extrtptime;
|
||||||
GstBuffer *buffer;
|
GstBuffer *buffer;
|
||||||
|
GstRTCPBuffer rtcp = { NULL };
|
||||||
|
|
||||||
bin = stream->bin;
|
bin = stream->bin;
|
||||||
|
|
||||||
|
@ -1170,7 +1171,10 @@ gst_rtp_bin_handle_sync (GstElement * jitterbuffer, GstStructure * s,
|
||||||
|
|
||||||
have_sr = FALSE;
|
have_sr = FALSE;
|
||||||
have_sdes = FALSE;
|
have_sdes = FALSE;
|
||||||
GST_RTCP_BUFFER_FOR_PACKETS (more, buffer, &packet) {
|
|
||||||
|
gst_rtcp_buffer_map (buffer, GST_MAP_READ, &rtcp);
|
||||||
|
|
||||||
|
GST_RTCP_BUFFER_FOR_PACKETS (more, &rtcp, &packet) {
|
||||||
/* first packet must be SR or RR or else the validate would have failed */
|
/* first packet must be SR or RR or else the validate would have failed */
|
||||||
switch (gst_rtcp_packet_get_type (&packet)) {
|
switch (gst_rtcp_packet_get_type (&packet)) {
|
||||||
case GST_RTCP_TYPE_SR:
|
case GST_RTCP_TYPE_SR:
|
||||||
|
@ -1229,6 +1233,7 @@ gst_rtp_bin_handle_sync (GstElement * jitterbuffer, GstStructure * s,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
gst_rtcp_buffer_unmap (&rtcp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create a new stream with @ssrc in @session. Must be called with
|
/* create a new stream with @ssrc in @session. Must be called with
|
||||||
|
@ -1368,38 +1373,12 @@ static void gst_rtp_bin_get_property (GObject * object, guint prop_id,
|
||||||
static GstStateChangeReturn gst_rtp_bin_change_state (GstElement * element,
|
static GstStateChangeReturn gst_rtp_bin_change_state (GstElement * element,
|
||||||
GstStateChange transition);
|
GstStateChange transition);
|
||||||
static GstPad *gst_rtp_bin_request_new_pad (GstElement * element,
|
static GstPad *gst_rtp_bin_request_new_pad (GstElement * element,
|
||||||
GstPadTemplate * templ, const gchar * name);
|
GstPadTemplate * templ, const gchar * name, const GstCaps * caps);
|
||||||
static void gst_rtp_bin_release_pad (GstElement * element, GstPad * pad);
|
static void gst_rtp_bin_release_pad (GstElement * element, GstPad * pad);
|
||||||
static void gst_rtp_bin_handle_message (GstBin * bin, GstMessage * message);
|
static void gst_rtp_bin_handle_message (GstBin * bin, GstMessage * message);
|
||||||
|
|
||||||
GST_BOILERPLATE (GstRtpBin, gst_rtp_bin, GstBin, GST_TYPE_BIN);
|
#define gst_rtp_bin_parent_class parent_class
|
||||||
|
G_DEFINE_TYPE (GstRtpBin, gst_rtp_bin, GST_TYPE_BIN);
|
||||||
static void
|
|
||||||
gst_rtp_bin_base_init (gpointer klass)
|
|
||||||
{
|
|
||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
|
||||||
|
|
||||||
/* sink pads */
|
|
||||||
gst_element_class_add_pad_template (element_class,
|
|
||||||
gst_static_pad_template_get (&rtpbin_recv_rtp_sink_template));
|
|
||||||
gst_element_class_add_pad_template (element_class,
|
|
||||||
gst_static_pad_template_get (&rtpbin_recv_rtcp_sink_template));
|
|
||||||
gst_element_class_add_pad_template (element_class,
|
|
||||||
gst_static_pad_template_get (&rtpbin_send_rtp_sink_template));
|
|
||||||
|
|
||||||
/* src pads */
|
|
||||||
gst_element_class_add_pad_template (element_class,
|
|
||||||
gst_static_pad_template_get (&rtpbin_recv_rtp_src_template));
|
|
||||||
gst_element_class_add_pad_template (element_class,
|
|
||||||
gst_static_pad_template_get (&rtpbin_send_rtcp_src_template));
|
|
||||||
gst_element_class_add_pad_template (element_class,
|
|
||||||
gst_static_pad_template_get (&rtpbin_send_rtp_src_template));
|
|
||||||
|
|
||||||
gst_element_class_set_details_simple (element_class, "RTP Bin",
|
|
||||||
"Filter/Network/RTP",
|
|
||||||
"Real-Time Transport Protocol bin",
|
|
||||||
"Wim Taymans <wim.taymans@gmail.com>");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_rtp_bin_class_init (GstRtpBinClass * klass)
|
gst_rtp_bin_class_init (GstRtpBinClass * klass)
|
||||||
|
@ -1682,6 +1661,27 @@ gst_rtp_bin_class_init (GstRtpBinClass * klass)
|
||||||
GST_DEBUG_FUNCPTR (gst_rtp_bin_request_new_pad);
|
GST_DEBUG_FUNCPTR (gst_rtp_bin_request_new_pad);
|
||||||
gstelement_class->release_pad = GST_DEBUG_FUNCPTR (gst_rtp_bin_release_pad);
|
gstelement_class->release_pad = GST_DEBUG_FUNCPTR (gst_rtp_bin_release_pad);
|
||||||
|
|
||||||
|
/* sink pads */
|
||||||
|
gst_element_class_add_pad_template (gstelement_class,
|
||||||
|
gst_static_pad_template_get (&rtpbin_recv_rtp_sink_template));
|
||||||
|
gst_element_class_add_pad_template (gstelement_class,
|
||||||
|
gst_static_pad_template_get (&rtpbin_recv_rtcp_sink_template));
|
||||||
|
gst_element_class_add_pad_template (gstelement_class,
|
||||||
|
gst_static_pad_template_get (&rtpbin_send_rtp_sink_template));
|
||||||
|
|
||||||
|
/* src pads */
|
||||||
|
gst_element_class_add_pad_template (gstelement_class,
|
||||||
|
gst_static_pad_template_get (&rtpbin_recv_rtp_src_template));
|
||||||
|
gst_element_class_add_pad_template (gstelement_class,
|
||||||
|
gst_static_pad_template_get (&rtpbin_send_rtcp_src_template));
|
||||||
|
gst_element_class_add_pad_template (gstelement_class,
|
||||||
|
gst_static_pad_template_get (&rtpbin_send_rtp_src_template));
|
||||||
|
|
||||||
|
gst_element_class_set_details_simple (gstelement_class, "RTP Bin",
|
||||||
|
"Filter/Network/RTP",
|
||||||
|
"Real-Time Transport Protocol bin",
|
||||||
|
"Wim Taymans <wim.taymans@gmail.com>");
|
||||||
|
|
||||||
gstbin_class->handle_message = GST_DEBUG_FUNCPTR (gst_rtp_bin_handle_message);
|
gstbin_class->handle_message = GST_DEBUG_FUNCPTR (gst_rtp_bin_handle_message);
|
||||||
|
|
||||||
klass->clear_pt_map = GST_DEBUG_FUNCPTR (gst_rtp_bin_clear_pt_map);
|
klass->clear_pt_map = GST_DEBUG_FUNCPTR (gst_rtp_bin_clear_pt_map);
|
||||||
|
@ -1693,7 +1693,7 @@ gst_rtp_bin_class_init (GstRtpBinClass * klass)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_rtp_bin_init (GstRtpBin * rtpbin, GstRtpBinClass * klass)
|
gst_rtp_bin_init (GstRtpBin * rtpbin)
|
||||||
{
|
{
|
||||||
gchar *str;
|
gchar *str;
|
||||||
|
|
||||||
|
@ -2166,7 +2166,6 @@ new_payload_found (GstElement * element, guint pt, GstPad * pad,
|
||||||
g_free (padname);
|
g_free (padname);
|
||||||
g_object_set_data (G_OBJECT (pad), "GstRTPBin.ghostpad", gpad);
|
g_object_set_data (G_OBJECT (pad), "GstRTPBin.ghostpad", gpad);
|
||||||
|
|
||||||
gst_pad_set_caps (gpad, GST_PAD_CAPS (pad));
|
|
||||||
gst_pad_set_active (gpad, TRUE);
|
gst_pad_set_active (gpad, TRUE);
|
||||||
GST_RTP_BIN_SHUTDOWN_UNLOCK (rtpbin);
|
GST_RTP_BIN_SHUTDOWN_UNLOCK (rtpbin);
|
||||||
|
|
||||||
|
@ -2349,7 +2348,6 @@ new_ssrc_pad_found (GstElement * element, guint ssrc, GstPad * pad,
|
||||||
gpad = gst_ghost_pad_new_from_template (padname, pad, templ);
|
gpad = gst_ghost_pad_new_from_template (padname, pad, templ);
|
||||||
g_free (padname);
|
g_free (padname);
|
||||||
|
|
||||||
gst_pad_set_caps (gpad, GST_PAD_CAPS (pad));
|
|
||||||
gst_pad_set_active (gpad, TRUE);
|
gst_pad_set_active (gpad, TRUE);
|
||||||
gst_element_add_pad (GST_ELEMENT_CAST (rtpbin), gpad);
|
gst_element_add_pad (GST_ELEMENT_CAST (rtpbin), gpad);
|
||||||
|
|
||||||
|
@ -2788,24 +2786,24 @@ gst_rtp_bin_get_free_pad_name (GstElement * element, GstPadTemplate * templ)
|
||||||
gint session = 0;
|
gint session = 0;
|
||||||
GstIterator *pad_it = NULL;
|
GstIterator *pad_it = NULL;
|
||||||
gchar *pad_name = NULL;
|
gchar *pad_name = NULL;
|
||||||
|
GValue data = { 0, };
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (element, "find a free pad name for template");
|
GST_DEBUG_OBJECT (element, "find a free pad name for template");
|
||||||
while (!name_found) {
|
while (!name_found) {
|
||||||
gboolean done = FALSE;
|
gboolean done = FALSE;
|
||||||
|
|
||||||
g_free (pad_name);
|
g_free (pad_name);
|
||||||
pad_name = g_strdup_printf (templ->name_template, session++);
|
pad_name = g_strdup_printf (templ->name_template, session++);
|
||||||
pad_it = gst_element_iterate_pads (GST_ELEMENT (element));
|
pad_it = gst_element_iterate_pads (GST_ELEMENT (element));
|
||||||
name_found = TRUE;
|
name_found = TRUE;
|
||||||
while (!done) {
|
while (!done) {
|
||||||
gpointer data;
|
|
||||||
|
|
||||||
switch (gst_iterator_next (pad_it, &data)) {
|
switch (gst_iterator_next (pad_it, &data)) {
|
||||||
case GST_ITERATOR_OK:
|
case GST_ITERATOR_OK:
|
||||||
{
|
{
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
gchar *name;
|
gchar *name;
|
||||||
|
|
||||||
pad = GST_PAD_CAST (data);
|
pad = g_value_get_object (&data);
|
||||||
name = gst_pad_get_name (pad);
|
name = gst_pad_get_name (pad);
|
||||||
|
|
||||||
if (strcmp (name, pad_name) == 0) {
|
if (strcmp (name, pad_name) == 0) {
|
||||||
|
@ -2813,7 +2811,7 @@ gst_rtp_bin_get_free_pad_name (GstElement * element, GstPadTemplate * templ)
|
||||||
name_found = FALSE;
|
name_found = FALSE;
|
||||||
}
|
}
|
||||||
g_free (name);
|
g_free (name);
|
||||||
gst_object_unref (pad);
|
g_value_reset (&data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GST_ITERATOR_ERROR:
|
case GST_ITERATOR_ERROR:
|
||||||
|
@ -2828,6 +2826,7 @@ gst_rtp_bin_get_free_pad_name (GstElement * element, GstPadTemplate * templ)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
g_value_unset (&data);
|
||||||
gst_iterator_free (pad_it);
|
gst_iterator_free (pad_it);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2839,7 +2838,7 @@ gst_rtp_bin_get_free_pad_name (GstElement * element, GstPadTemplate * templ)
|
||||||
*/
|
*/
|
||||||
static GstPad *
|
static GstPad *
|
||||||
gst_rtp_bin_request_new_pad (GstElement * element,
|
gst_rtp_bin_request_new_pad (GstElement * element,
|
||||||
GstPadTemplate * templ, const gchar * name)
|
GstPadTemplate * templ, const gchar * name, const GstCaps * caps)
|
||||||
{
|
{
|
||||||
GstRtpBin *rtpbin;
|
GstRtpBin *rtpbin;
|
||||||
GstElementClass *klass;
|
GstElementClass *klass;
|
||||||
|
|
|
@ -218,8 +218,8 @@ GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
|
|
||||||
static guint gst_rtp_jitter_buffer_signals[LAST_SIGNAL] = { 0 };
|
static guint gst_rtp_jitter_buffer_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
GST_BOILERPLATE (GstRtpJitterBuffer, gst_rtp_jitter_buffer, GstElement,
|
#define gst_rtp_jitter_buffer_parent_class parent_class
|
||||||
GST_TYPE_ELEMENT);
|
G_DEFINE_TYPE (GstRtpJitterBuffer, gst_rtp_jitter_buffer, GST_TYPE_ELEMENT);
|
||||||
|
|
||||||
/* object overrides */
|
/* object overrides */
|
||||||
static void gst_rtp_jitter_buffer_set_property (GObject * object,
|
static void gst_rtp_jitter_buffer_set_property (GObject * object,
|
||||||
|
@ -232,17 +232,16 @@ static void gst_rtp_jitter_buffer_finalize (GObject * object);
|
||||||
static GstStateChangeReturn gst_rtp_jitter_buffer_change_state (GstElement
|
static GstStateChangeReturn gst_rtp_jitter_buffer_change_state (GstElement
|
||||||
* element, GstStateChange transition);
|
* element, GstStateChange transition);
|
||||||
static GstPad *gst_rtp_jitter_buffer_request_new_pad (GstElement * element,
|
static GstPad *gst_rtp_jitter_buffer_request_new_pad (GstElement * element,
|
||||||
GstPadTemplate * templ, const gchar * name);
|
GstPadTemplate * templ, const gchar * name, const GstCaps * filter);
|
||||||
static void gst_rtp_jitter_buffer_release_pad (GstElement * element,
|
static void gst_rtp_jitter_buffer_release_pad (GstElement * element,
|
||||||
GstPad * pad);
|
GstPad * pad);
|
||||||
static GstClock *gst_rtp_jitter_buffer_provide_clock (GstElement * element);
|
static GstClock *gst_rtp_jitter_buffer_provide_clock (GstElement * element);
|
||||||
|
|
||||||
/* pad overrides */
|
/* pad overrides */
|
||||||
static GstCaps *gst_rtp_jitter_buffer_getcaps (GstPad * pad);
|
static GstCaps *gst_rtp_jitter_buffer_getcaps (GstPad * pad, GstCaps * filter);
|
||||||
static GstIterator *gst_rtp_jitter_buffer_iterate_internal_links (GstPad * pad);
|
static GstIterator *gst_rtp_jitter_buffer_iterate_internal_links (GstPad * pad);
|
||||||
|
|
||||||
/* sinkpad overrides */
|
/* sinkpad overrides */
|
||||||
static gboolean gst_jitter_buffer_sink_setcaps (GstPad * pad, GstCaps * caps);
|
|
||||||
static gboolean gst_rtp_jitter_buffer_sink_event (GstPad * pad,
|
static gboolean gst_rtp_jitter_buffer_sink_event (GstPad * pad,
|
||||||
GstEvent * event);
|
GstEvent * event);
|
||||||
static GstFlowReturn gst_rtp_jitter_buffer_chain (GstPad * pad,
|
static GstFlowReturn gst_rtp_jitter_buffer_chain (GstPad * pad,
|
||||||
|
@ -267,25 +266,6 @@ static GstClockTime
|
||||||
gst_rtp_jitter_buffer_set_active (GstRtpJitterBuffer * jitterbuffer,
|
gst_rtp_jitter_buffer_set_active (GstRtpJitterBuffer * jitterbuffer,
|
||||||
gboolean active, guint64 base_time);
|
gboolean active, guint64 base_time);
|
||||||
|
|
||||||
static void
|
|
||||||
gst_rtp_jitter_buffer_base_init (gpointer klass)
|
|
||||||
{
|
|
||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
|
||||||
|
|
||||||
gst_element_class_add_pad_template (element_class,
|
|
||||||
gst_static_pad_template_get (&gst_rtp_jitter_buffer_src_template));
|
|
||||||
gst_element_class_add_pad_template (element_class,
|
|
||||||
gst_static_pad_template_get (&gst_rtp_jitter_buffer_sink_template));
|
|
||||||
gst_element_class_add_pad_template (element_class,
|
|
||||||
gst_static_pad_template_get (&gst_rtp_jitter_buffer_sink_rtcp_template));
|
|
||||||
|
|
||||||
gst_element_class_set_details_simple (element_class,
|
|
||||||
"RTP packet jitter-buffer", "Filter/Network/RTP",
|
|
||||||
"A buffer that deals with network jitter and other transmission faults",
|
|
||||||
"Philippe Kalaf <philippe.kalaf@collabora.co.uk>, "
|
|
||||||
"Wim Taymans <wim.taymans@gmail.com>");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_rtp_jitter_buffer_class_init (GstRtpJitterBufferClass * klass)
|
gst_rtp_jitter_buffer_class_init (GstRtpJitterBufferClass * klass)
|
||||||
{
|
{
|
||||||
|
@ -443,6 +423,19 @@ gst_rtp_jitter_buffer_class_init (GstRtpJitterBufferClass * klass)
|
||||||
gstelement_class->provide_clock =
|
gstelement_class->provide_clock =
|
||||||
GST_DEBUG_FUNCPTR (gst_rtp_jitter_buffer_provide_clock);
|
GST_DEBUG_FUNCPTR (gst_rtp_jitter_buffer_provide_clock);
|
||||||
|
|
||||||
|
gst_element_class_add_pad_template (gstelement_class,
|
||||||
|
gst_static_pad_template_get (&gst_rtp_jitter_buffer_src_template));
|
||||||
|
gst_element_class_add_pad_template (gstelement_class,
|
||||||
|
gst_static_pad_template_get (&gst_rtp_jitter_buffer_sink_template));
|
||||||
|
gst_element_class_add_pad_template (gstelement_class,
|
||||||
|
gst_static_pad_template_get (&gst_rtp_jitter_buffer_sink_rtcp_template));
|
||||||
|
|
||||||
|
gst_element_class_set_details_simple (gstelement_class,
|
||||||
|
"RTP packet jitter-buffer", "Filter/Network/RTP",
|
||||||
|
"A buffer that deals with network jitter and other transmission faults",
|
||||||
|
"Philippe Kalaf <philippe.kalaf@collabora.co.uk>, "
|
||||||
|
"Wim Taymans <wim.taymans@gmail.com>");
|
||||||
|
|
||||||
klass->clear_pt_map = GST_DEBUG_FUNCPTR (gst_rtp_jitter_buffer_clear_pt_map);
|
klass->clear_pt_map = GST_DEBUG_FUNCPTR (gst_rtp_jitter_buffer_clear_pt_map);
|
||||||
klass->set_active = GST_DEBUG_FUNCPTR (gst_rtp_jitter_buffer_set_active);
|
klass->set_active = GST_DEBUG_FUNCPTR (gst_rtp_jitter_buffer_set_active);
|
||||||
|
|
||||||
|
@ -451,8 +444,7 @@ gst_rtp_jitter_buffer_class_init (GstRtpJitterBufferClass * klass)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_rtp_jitter_buffer_init (GstRtpJitterBuffer * jitterbuffer,
|
gst_rtp_jitter_buffer_init (GstRtpJitterBuffer * jitterbuffer)
|
||||||
GstRtpJitterBufferClass * klass)
|
|
||||||
{
|
{
|
||||||
GstRtpJitterBufferPrivate *priv;
|
GstRtpJitterBufferPrivate *priv;
|
||||||
|
|
||||||
|
@ -495,8 +487,6 @@ gst_rtp_jitter_buffer_init (GstRtpJitterBuffer * jitterbuffer,
|
||||||
GST_DEBUG_FUNCPTR (gst_rtp_jitter_buffer_chain));
|
GST_DEBUG_FUNCPTR (gst_rtp_jitter_buffer_chain));
|
||||||
gst_pad_set_event_function (priv->sinkpad,
|
gst_pad_set_event_function (priv->sinkpad,
|
||||||
GST_DEBUG_FUNCPTR (gst_rtp_jitter_buffer_sink_event));
|
GST_DEBUG_FUNCPTR (gst_rtp_jitter_buffer_sink_event));
|
||||||
gst_pad_set_setcaps_function (priv->sinkpad,
|
|
||||||
GST_DEBUG_FUNCPTR (gst_jitter_buffer_sink_setcaps));
|
|
||||||
gst_pad_set_getcaps_function (priv->sinkpad,
|
gst_pad_set_getcaps_function (priv->sinkpad,
|
||||||
GST_DEBUG_FUNCPTR (gst_rtp_jitter_buffer_getcaps));
|
GST_DEBUG_FUNCPTR (gst_rtp_jitter_buffer_getcaps));
|
||||||
|
|
||||||
|
@ -525,6 +515,7 @@ gst_rtp_jitter_buffer_iterate_internal_links (GstPad * pad)
|
||||||
GstRtpJitterBuffer *jitterbuffer;
|
GstRtpJitterBuffer *jitterbuffer;
|
||||||
GstPad *otherpad = NULL;
|
GstPad *otherpad = NULL;
|
||||||
GstIterator *it;
|
GstIterator *it;
|
||||||
|
GValue val = { 0, };
|
||||||
|
|
||||||
jitterbuffer = GST_RTP_JITTER_BUFFER (gst_pad_get_parent (pad));
|
jitterbuffer = GST_RTP_JITTER_BUFFER (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
|
@ -536,8 +527,10 @@ gst_rtp_jitter_buffer_iterate_internal_links (GstPad * pad)
|
||||||
otherpad = NULL;
|
otherpad = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
it = gst_iterator_new_single (GST_TYPE_PAD, otherpad,
|
g_value_init (&val, GST_TYPE_PAD);
|
||||||
(GstCopyFunction) gst_object_ref, (GFreeFunc) gst_object_unref);
|
g_value_set_object (&val, otherpad);
|
||||||
|
it = gst_iterator_new_single (GST_TYPE_PAD, &val);
|
||||||
|
g_value_unset (&val);
|
||||||
|
|
||||||
gst_object_unref (jitterbuffer);
|
gst_object_unref (jitterbuffer);
|
||||||
|
|
||||||
|
@ -585,7 +578,7 @@ remove_rtcp_sink (GstRtpJitterBuffer * jitterbuffer)
|
||||||
|
|
||||||
static GstPad *
|
static GstPad *
|
||||||
gst_rtp_jitter_buffer_request_new_pad (GstElement * element,
|
gst_rtp_jitter_buffer_request_new_pad (GstElement * element,
|
||||||
GstPadTemplate * templ, const gchar * name)
|
GstPadTemplate * templ, const gchar * name, const GstCaps * filter)
|
||||||
{
|
{
|
||||||
GstRtpJitterBuffer *jitterbuffer;
|
GstRtpJitterBuffer *jitterbuffer;
|
||||||
GstElementClass *klass;
|
GstElementClass *klass;
|
||||||
|
@ -714,7 +707,7 @@ gst_rtp_jitter_buffer_set_active (GstRtpJitterBuffer * jbuf, gboolean active,
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstCaps *
|
static GstCaps *
|
||||||
gst_rtp_jitter_buffer_getcaps (GstPad * pad)
|
gst_rtp_jitter_buffer_getcaps (GstPad * pad, GstCaps * filter)
|
||||||
{
|
{
|
||||||
GstRtpJitterBuffer *jitterbuffer;
|
GstRtpJitterBuffer *jitterbuffer;
|
||||||
GstRtpJitterBufferPrivate *priv;
|
GstRtpJitterBufferPrivate *priv;
|
||||||
|
@ -727,7 +720,7 @@ gst_rtp_jitter_buffer_getcaps (GstPad * pad)
|
||||||
|
|
||||||
other = (pad == priv->srcpad ? priv->sinkpad : priv->srcpad);
|
other = (pad == priv->srcpad ? priv->sinkpad : priv->srcpad);
|
||||||
|
|
||||||
caps = gst_pad_peer_get_caps (other);
|
caps = gst_pad_peer_get_caps (other, filter);
|
||||||
|
|
||||||
templ = gst_pad_get_pad_template_caps (pad);
|
templ = gst_pad_get_pad_template_caps (pad);
|
||||||
if (caps == NULL) {
|
if (caps == NULL) {
|
||||||
|
@ -832,29 +825,6 @@ wrong_rate:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gst_jitter_buffer_sink_setcaps (GstPad * pad, GstCaps * caps)
|
|
||||||
{
|
|
||||||
GstRtpJitterBuffer *jitterbuffer;
|
|
||||||
GstRtpJitterBufferPrivate *priv;
|
|
||||||
gboolean res;
|
|
||||||
|
|
||||||
jitterbuffer = GST_RTP_JITTER_BUFFER (gst_pad_get_parent (pad));
|
|
||||||
priv = jitterbuffer->priv;
|
|
||||||
|
|
||||||
JBUF_LOCK (priv);
|
|
||||||
res = gst_jitter_buffer_sink_parse_caps (jitterbuffer, caps);
|
|
||||||
JBUF_UNLOCK (priv);
|
|
||||||
|
|
||||||
/* set same caps on srcpad on success */
|
|
||||||
if (res)
|
|
||||||
gst_pad_set_caps (priv->srcpad, caps);
|
|
||||||
|
|
||||||
gst_object_unref (jitterbuffer);
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_rtp_jitter_buffer_flush_start (GstRtpJitterBuffer * jitterbuffer)
|
gst_rtp_jitter_buffer_flush_start (GstRtpJitterBuffer * jitterbuffer)
|
||||||
{
|
{
|
||||||
|
@ -1062,30 +1032,33 @@ gst_rtp_jitter_buffer_sink_event (GstPad * pad, GstEvent * event)
|
||||||
GST_DEBUG_OBJECT (jitterbuffer, "received %s", GST_EVENT_TYPE_NAME (event));
|
GST_DEBUG_OBJECT (jitterbuffer, "received %s", GST_EVENT_TYPE_NAME (event));
|
||||||
|
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
case GST_EVENT_NEWSEGMENT:
|
case GST_EVENT_CAPS:
|
||||||
{
|
{
|
||||||
GstFormat format;
|
GstCaps *caps;
|
||||||
gdouble rate, arate;
|
|
||||||
gint64 start, stop, time;
|
|
||||||
gboolean update;
|
|
||||||
|
|
||||||
gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
|
gst_event_parse_caps (event, &caps);
|
||||||
&start, &stop, &time);
|
|
||||||
|
JBUF_LOCK (priv);
|
||||||
|
ret = gst_jitter_buffer_sink_parse_caps (jitterbuffer, caps);
|
||||||
|
JBUF_UNLOCK (priv);
|
||||||
|
|
||||||
|
/* set same caps on srcpad on success */
|
||||||
|
if (ret)
|
||||||
|
gst_pad_set_caps (priv->srcpad, caps);
|
||||||
|
|
||||||
|
gst_event_unref (event);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GST_EVENT_SEGMENT:
|
||||||
|
{
|
||||||
|
gst_event_copy_segment (event, &priv->segment);
|
||||||
|
|
||||||
/* we need time for now */
|
/* we need time for now */
|
||||||
if (format != GST_FORMAT_TIME)
|
if (priv->segment.format != GST_FORMAT_TIME)
|
||||||
goto newseg_wrong_format;
|
goto newseg_wrong_format;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (jitterbuffer,
|
GST_DEBUG_OBJECT (jitterbuffer,
|
||||||
"newsegment: update %d, rate %g, arate %g, start %" GST_TIME_FORMAT
|
"newsegment: %" GST_SEGMENT_FORMAT, &priv->segment);
|
||||||
", stop %" GST_TIME_FORMAT ", time %" GST_TIME_FORMAT,
|
|
||||||
update, rate, arate, GST_TIME_ARGS (start), GST_TIME_ARGS (stop),
|
|
||||||
GST_TIME_ARGS (time));
|
|
||||||
|
|
||||||
/* now configure the values, we need these to time the release of the
|
|
||||||
* buffers on the srcpad. */
|
|
||||||
gst_segment_set_newsegment_full (&priv->segment, update,
|
|
||||||
rate, arate, format, start, stop, time);
|
|
||||||
|
|
||||||
/* FIXME, push SEGMENT in the queue. Sorting order might be difficult. */
|
/* FIXME, push SEGMENT in the queue. Sorting order might be difficult. */
|
||||||
ret = gst_pad_push_event (priv->srcpad, event);
|
ret = gst_pad_push_event (priv->srcpad, event);
|
||||||
|
@ -1264,6 +1237,7 @@ gst_rtp_jitter_buffer_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
gboolean tail;
|
gboolean tail;
|
||||||
gint percent = -1;
|
gint percent = -1;
|
||||||
guint8 pt;
|
guint8 pt;
|
||||||
|
GstRTPBuffer rtp = { NULL };
|
||||||
|
|
||||||
jitterbuffer = GST_RTP_JITTER_BUFFER (gst_pad_get_parent (pad));
|
jitterbuffer = GST_RTP_JITTER_BUFFER (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
|
@ -1272,7 +1246,10 @@ gst_rtp_jitter_buffer_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
|
|
||||||
priv = jitterbuffer->priv;
|
priv = jitterbuffer->priv;
|
||||||
|
|
||||||
pt = gst_rtp_buffer_get_payload_type (buffer);
|
gst_rtp_buffer_map (buffer, GST_MAP_READ, &rtp);
|
||||||
|
pt = gst_rtp_buffer_get_payload_type (&rtp);
|
||||||
|
seqnum = gst_rtp_buffer_get_seq (&rtp);
|
||||||
|
gst_rtp_buffer_unmap (&rtp);
|
||||||
|
|
||||||
/* take the timestamp of the buffer. This is the time when the packet was
|
/* take the timestamp of the buffer. This is the time when the packet was
|
||||||
* received and is used to calculate jitter and clock skew. We will adjust
|
* received and is used to calculate jitter and clock skew. We will adjust
|
||||||
|
@ -1283,8 +1260,6 @@ gst_rtp_jitter_buffer_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
timestamp = gst_segment_to_running_time (&priv->segment, GST_FORMAT_TIME,
|
timestamp = gst_segment_to_running_time (&priv->segment, GST_FORMAT_TIME,
|
||||||
timestamp);
|
timestamp);
|
||||||
|
|
||||||
seqnum = gst_rtp_buffer_get_seq (buffer);
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (jitterbuffer,
|
GST_DEBUG_OBJECT (jitterbuffer,
|
||||||
"Received packet #%d at time %" GST_TIME_FORMAT, seqnum,
|
"Received packet #%d at time %" GST_TIME_FORMAT, seqnum,
|
||||||
GST_TIME_ARGS (timestamp));
|
GST_TIME_ARGS (timestamp));
|
||||||
|
@ -1292,19 +1267,20 @@ gst_rtp_jitter_buffer_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
JBUF_LOCK_CHECK (priv, out_flushing);
|
JBUF_LOCK_CHECK (priv, out_flushing);
|
||||||
|
|
||||||
if (G_UNLIKELY (priv->last_pt != pt)) {
|
if (G_UNLIKELY (priv->last_pt != pt)) {
|
||||||
GstCaps *caps;
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (jitterbuffer, "pt changed from %u to %u", priv->last_pt,
|
GST_DEBUG_OBJECT (jitterbuffer, "pt changed from %u to %u", priv->last_pt,
|
||||||
pt);
|
pt);
|
||||||
|
|
||||||
priv->last_pt = pt;
|
priv->last_pt = pt;
|
||||||
/* reset clock-rate so that we get a new one */
|
/* reset clock-rate so that we get a new one */
|
||||||
priv->clock_rate = -1;
|
priv->clock_rate = -1;
|
||||||
|
#if 0
|
||||||
|
GstCaps *caps;
|
||||||
/* Try to get the clock-rate from the caps first if we can. If there are no
|
/* Try to get the clock-rate from the caps first if we can. If there are no
|
||||||
* caps we must fire the signal to get the clock-rate. */
|
* caps we must fire the signal to get the clock-rate. */
|
||||||
if ((caps = GST_BUFFER_CAPS (buffer))) {
|
if ((caps = GST_BUFFER_CAPS (buffer))) {
|
||||||
gst_jitter_buffer_sink_parse_caps (jitterbuffer, caps);
|
gst_jitter_buffer_sink_parse_caps (jitterbuffer, caps);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (G_UNLIKELY (priv->clock_rate == -1)) {
|
if (G_UNLIKELY (priv->clock_rate == -1)) {
|
||||||
|
@ -1380,8 +1356,8 @@ gst_rtp_jitter_buffer_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
|
|
||||||
old_buf = rtp_jitter_buffer_pop (priv->jbuf, &percent);
|
old_buf = rtp_jitter_buffer_pop (priv->jbuf, &percent);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (jitterbuffer, "Queue full, dropping old packet #%d",
|
GST_DEBUG_OBJECT (jitterbuffer, "Queue full, dropping old packet %p",
|
||||||
gst_rtp_buffer_get_seq (old_buf));
|
old_buf);
|
||||||
|
|
||||||
gst_buffer_unref (old_buf);
|
gst_buffer_unref (old_buf);
|
||||||
}
|
}
|
||||||
|
@ -1389,7 +1365,7 @@ gst_rtp_jitter_buffer_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
|
|
||||||
/* we need to make the metadata writable before pushing it in the jitterbuffer
|
/* we need to make the metadata writable before pushing it in the jitterbuffer
|
||||||
* because the jitterbuffer will update the timestamp */
|
* because the jitterbuffer will update the timestamp */
|
||||||
buffer = gst_buffer_make_metadata_writable (buffer);
|
buffer = gst_buffer_make_writable (buffer);
|
||||||
|
|
||||||
/* now insert the packet into the queue in sorted order. This function returns
|
/* now insert the packet into the queue in sorted order. This function returns
|
||||||
* FALSE if a packet with the same seqnum was already in the queue, meaning we
|
* FALSE if a packet with the same seqnum was already in the queue, meaning we
|
||||||
|
@ -1541,9 +1517,12 @@ compute_elapsed (GstRtpJitterBuffer * jitterbuffer, GstBuffer * outbuf)
|
||||||
guint64 ext_time, elapsed;
|
guint64 ext_time, elapsed;
|
||||||
guint32 rtp_time;
|
guint32 rtp_time;
|
||||||
GstRtpJitterBufferPrivate *priv;
|
GstRtpJitterBufferPrivate *priv;
|
||||||
|
GstRTPBuffer rtp = { NULL };
|
||||||
|
|
||||||
priv = jitterbuffer->priv;
|
priv = jitterbuffer->priv;
|
||||||
rtp_time = gst_rtp_buffer_get_timestamp (outbuf);
|
gst_rtp_buffer_map (outbuf, GST_MAP_READ, &rtp);
|
||||||
|
rtp_time = gst_rtp_buffer_get_timestamp (&rtp);
|
||||||
|
gst_rtp_buffer_unmap (&rtp);
|
||||||
|
|
||||||
GST_LOG_OBJECT (jitterbuffer, "rtp %" G_GUINT32_FORMAT ", ext %"
|
GST_LOG_OBJECT (jitterbuffer, "rtp %" G_GUINT32_FORMAT ", ext %"
|
||||||
G_GUINT64_FORMAT, rtp_time, priv->ext_timestamp);
|
G_GUINT64_FORMAT, rtp_time, priv->ext_timestamp);
|
||||||
|
@ -1585,6 +1564,7 @@ gst_rtp_jitter_buffer_loop (GstRtpJitterBuffer * jitterbuffer)
|
||||||
GstClockID id;
|
GstClockID id;
|
||||||
GstClockTime sync_time;
|
GstClockTime sync_time;
|
||||||
gint percent = -1;
|
gint percent = -1;
|
||||||
|
GstRTPBuffer rtp = { NULL };
|
||||||
|
|
||||||
priv = jitterbuffer->priv;
|
priv = jitterbuffer->priv;
|
||||||
|
|
||||||
|
@ -1679,7 +1659,9 @@ again:
|
||||||
outbuf = rtp_jitter_buffer_peek (priv->jbuf);
|
outbuf = rtp_jitter_buffer_peek (priv->jbuf);
|
||||||
|
|
||||||
/* get the seqnum and the next expected seqnum */
|
/* get the seqnum and the next expected seqnum */
|
||||||
seqnum = gst_rtp_buffer_get_seq (outbuf);
|
gst_rtp_buffer_map (outbuf, GST_MAP_READ, &rtp);
|
||||||
|
seqnum = gst_rtp_buffer_get_seq (&rtp);
|
||||||
|
gst_rtp_buffer_unmap (&rtp);
|
||||||
next_seqnum = priv->next_seqnum;
|
next_seqnum = priv->next_seqnum;
|
||||||
|
|
||||||
/* get the timestamp, this is already corrected for clock skew by the
|
/* get the timestamp, this is already corrected for clock skew by the
|
||||||
|
@ -1970,6 +1952,7 @@ gst_rtp_jitter_buffer_chain_rtcp (GstPad * pad, GstBuffer * buffer)
|
||||||
guint64 ext_rtptime, diff;
|
guint64 ext_rtptime, diff;
|
||||||
guint32 rtptime;
|
guint32 rtptime;
|
||||||
gboolean drop = FALSE;
|
gboolean drop = FALSE;
|
||||||
|
GstRTCPBuffer rtcp = { NULL };
|
||||||
|
|
||||||
jitterbuffer = GST_RTP_JITTER_BUFFER (gst_pad_get_parent (pad));
|
jitterbuffer = GST_RTP_JITTER_BUFFER (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
|
@ -1978,8 +1961,10 @@ gst_rtp_jitter_buffer_chain_rtcp (GstPad * pad, GstBuffer * buffer)
|
||||||
|
|
||||||
priv = jitterbuffer->priv;
|
priv = jitterbuffer->priv;
|
||||||
|
|
||||||
if (!gst_rtcp_buffer_get_first_packet (buffer, &packet))
|
gst_rtcp_buffer_map (buffer, GST_MAP_READ, &rtcp);
|
||||||
goto invalid_buffer;
|
|
||||||
|
if (!gst_rtcp_buffer_get_first_packet (&rtcp, &packet))
|
||||||
|
goto empty_buffer;
|
||||||
|
|
||||||
/* first packet must be SR or RR or else the validate would have failed */
|
/* first packet must be SR or RR or else the validate would have failed */
|
||||||
switch (gst_rtcp_packet_get_type (&packet)) {
|
switch (gst_rtcp_packet_get_type (&packet)) {
|
||||||
|
@ -1990,6 +1975,7 @@ gst_rtp_jitter_buffer_chain_rtcp (GstPad * pad, GstBuffer * buffer)
|
||||||
default:
|
default:
|
||||||
goto ignore_buffer;
|
goto ignore_buffer;
|
||||||
}
|
}
|
||||||
|
gst_rtcp_buffer_unmap (&rtcp);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (jitterbuffer, "received RTCP of SSRC %08x", ssrc);
|
GST_DEBUG_OBJECT (jitterbuffer, "received RTCP of SSRC %08x", ssrc);
|
||||||
|
|
||||||
|
@ -2066,9 +2052,19 @@ invalid_buffer:
|
||||||
ret = GST_FLOW_OK;
|
ret = GST_FLOW_OK;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
empty_buffer:
|
||||||
|
{
|
||||||
|
/* this is not fatal but should be filtered earlier */
|
||||||
|
GST_ELEMENT_WARNING (jitterbuffer, STREAM, DECODE, (NULL),
|
||||||
|
("Received empty RTCP payload, dropping"));
|
||||||
|
gst_rtcp_buffer_unmap (&rtcp);
|
||||||
|
ret = GST_FLOW_OK;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
ignore_buffer:
|
ignore_buffer:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (jitterbuffer, "ignoring RTCP packet");
|
GST_DEBUG_OBJECT (jitterbuffer, "ignoring RTCP packet");
|
||||||
|
gst_rtcp_buffer_unmap (&rtcp);
|
||||||
ret = GST_FLOW_OK;
|
ret = GST_FLOW_OK;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue