From 5525e409706a3ce4ea85df130d50e8497407ed50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Wed, 25 Jan 2012 13:19:12 +0000 Subject: [PATCH 01/19] rtpmanager: don't pretend our random hostnames are fully-qualified domain names --- gst/rtpmanager/gstrtpbin.c | 2 +- gst/rtpmanager/rtpsession.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gst/rtpmanager/gstrtpbin.c b/gst/rtpmanager/gstrtpbin.c index 0b2167dd17..ca5d66b5ec 100644 --- a/gst/rtpmanager/gstrtpbin.c +++ b/gst/rtpmanager/gstrtpbin.c @@ -1901,7 +1901,7 @@ gst_rtp_bin_init (GstRtpBin * rtpbin, GstRtpBinClass * klass) rtpbin->use_pipeline_clock = DEFAULT_USE_PIPELINE_CLOCK; /* some default SDES entries */ - cname = g_strdup_printf ("user%u@x-%u.net", g_random_int (), g_random_int ()); + cname = g_strdup_printf ("user%u@host-%x", g_random_int (), g_random_int ()); rtpbin->sdes = gst_structure_new ("application/x-rtp-source-sdes", "cname", G_TYPE_STRING, cname, "tool", G_TYPE_STRING, "GStreamer", NULL); g_free (cname); diff --git a/gst/rtpmanager/rtpsession.c b/gst/rtpmanager/rtpsession.c index 72849a7ae8..9f15bd698d 100644 --- a/gst/rtpmanager/rtpsession.c +++ b/gst/rtpmanager/rtpsession.c @@ -558,7 +558,7 @@ rtp_session_init (RTPSession * sess) /* some default SDES entries */ /* we do not want to leak details like the username or hostname here */ - str = g_strdup_printf ("user%u@x-%u.net", g_random_int (), g_random_int ()); + str = g_strdup_printf ("user%u@host-%x", g_random_int (), g_random_int ()); rtp_source_set_sdes_string (sess->source, GST_RTCP_SDES_CNAME, str); g_free (str); From d6821a336d24bec3d39b760abba32f6a8170cc64 Mon Sep 17 00:00:00 2001 From: Jayakrishnan M Date: Wed, 25 Jan 2012 15:21:44 +0000 Subject: [PATCH 02/19] cairo: fix build, make sure libgstvideo can be found https://bugzilla.gnome.org/show_bug.cgi?id=668648 --- ext/cairo/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/cairo/Makefile.am b/ext/cairo/Makefile.am index 5a8d3be8f0..7fa8fdc582 100644 --- a/ext/cairo/Makefile.am +++ b/ext/cairo/Makefile.am @@ -36,8 +36,8 @@ libgstcairo_la_CFLAGS = \ $(GST_BASE_CFLAGS) \ $(GST_CFLAGS) $(CAIRO_CFLAGS) $(CAIRO_GOBJECT_CFLAGS) libgstcairo_la_LIBADD = \ - $(GST_BASE_LIBS) -lgstvideo-$(GST_MAJORMINOR) \ - $(GST_LIBS) $(CAIRO_LIBS) $(CAIRO_GOBJECT_LIBS) $(LIBM) + $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_MAJORMINOR) \ + $(GST_BASE_LIBS) $(GST_LIBS) $(CAIRO_LIBS) $(CAIRO_GOBJECT_LIBS) $(LIBM) libgstcairo_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstcairo_la_LIBTOOLFLAGS = --tag=disable-static From 119f94bab7564603a15b51376e815b122c31d404 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Sat, 28 Jan 2012 12:35:13 +0000 Subject: [PATCH 03/19] matroskamux: do not free memory twice A recent change to fix leaking codec ID string accidentally caused one of the very few places that weren't leaking to now free twice. --- gst/matroska/matroska-mux.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/gst/matroska/matroska-mux.c b/gst/matroska/matroska-mux.c index 2e4f7397c5..df8073536d 100644 --- a/gst/matroska/matroska-mux.c +++ b/gst/matroska/matroska-mux.c @@ -2058,9 +2058,6 @@ gst_matroska_mux_subtitle_pad_setcaps (GstPad * pad, GstCaps * caps) GST_STR_NULL (context->codec_id), context->codec_priv_size); exit: - /* free default if modified */ - if (id) - g_free (id); return ret; } From e967e27c36ade86dd4afe5b4f452b0e46a404184 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Sat, 28 Jan 2012 13:05:09 +0000 Subject: [PATCH 04/19] videobox: avoid wrapping opaque to transparent --- gst/videobox/gstvideobox.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gst/videobox/gstvideobox.c b/gst/videobox/gstvideobox.c index 9d311840b2..213aa9eea5 100644 --- a/gst/videobox/gstvideobox.c +++ b/gst/videobox/gstvideobox.c @@ -3274,8 +3274,8 @@ static void gst_video_box_process (GstVideoBox * video_box, const guint8 * src, guint8 * dest) { - guint b_alpha = CLAMP (video_box->border_alpha * 256, 0, 256); - guint i_alpha = CLAMP (video_box->alpha * 256, 0, 256); + guint b_alpha = CLAMP (video_box->border_alpha * 256, 0, 255); + guint i_alpha = CLAMP (video_box->alpha * 256, 0, 255); GstVideoBoxFill fill_type = video_box->fill_type; gint br, bl, bt, bb, crop_w, crop_h; From 70565f0e75591cc1f748cb5bf5d0ac259abba7ec Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Sat, 28 Jan 2012 23:35:50 +0000 Subject: [PATCH 05/19] matroskamux: remove obsolete variable, set but not used Reported by andredieb on #gstreamer. --- gst/matroska/matroska-mux.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/gst/matroska/matroska-mux.c b/gst/matroska/matroska-mux.c index df8073536d..d79c2224d1 100644 --- a/gst/matroska/matroska-mux.c +++ b/gst/matroska/matroska-mux.c @@ -1973,7 +1973,6 @@ gst_matroska_mux_subtitle_pad_setcaps (GstPad * pad, GstCaps * caps) GstStructure *structure; const GValue *value = NULL; const GstBuffer *buf = NULL; - gchar *id = NULL; gboolean ret = TRUE; mux = GST_MATROSKA_MUX (GST_PAD_PARENT (pad)); @@ -1989,9 +1988,6 @@ gst_matroska_mux_subtitle_pad_setcaps (GstPad * pad, GstCaps * caps) structure = gst_caps_get_structure (caps, 0); mimetype = gst_structure_get_name (structure); - /* keep track of default set in request_pad */ - id = context->codec_id; - /* general setup */ scontext->check_utf8 = 1; scontext->invalid_utf8 = 0; @@ -2025,7 +2021,6 @@ gst_matroska_mux_subtitle_pad_setcaps (GstPad * pad, GstCaps * caps) gst_matroska_mux_set_codec_id (context, GST_MATROSKA_CODEC_ID_SUBTITLE_VOBSUB); } else { - id = NULL; ret = FALSE; goto exit; } From c16fed2ad9da18d3173fbb56cd1dfc8e259d1dbb Mon Sep 17 00:00:00 2001 From: Pascal Buhler Date: Fri, 11 Jun 2010 08:36:33 +0200 Subject: [PATCH 06/19] rtph264depay: Exclude NALu size from payload length on truncated packets. https://bugzilla.gnome.org/show_bug.cgi?id=667846 --- gst/rtp/gstrtph264depay.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gst/rtp/gstrtph264depay.c b/gst/rtp/gstrtph264depay.c index 27b5d4b9f0..efe1725933 100644 --- a/gst/rtp/gstrtph264depay.c +++ b/gst/rtp/gstrtph264depay.c @@ -735,8 +735,9 @@ gst_rtp_h264_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf) */ nalu_size = (payload[0] << 8) | payload[1]; - if (nalu_size > payload_len) - nalu_size = payload_len; + /* dont include nalu_size */ + if (nalu_size > (payload_len - 2)) + nalu_size = payload_len - 2; outsize = nalu_size + sizeof (sync_bytes); outbuf = gst_buffer_new_and_alloc (outsize); From d651baf05ad8997812e529d7f23f7f782b385e00 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Mon, 30 Jan 2012 14:52:37 +0000 Subject: [PATCH 07/19] rtpmp2tpay: do not try to flush a packet when no data is available https://bugzilla.gnome.org/show_bug.cgi?id=668874 --- gst/rtp/gstrtpmp2tpay.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gst/rtp/gstrtpmp2tpay.c b/gst/rtp/gstrtpmp2tpay.c index 060a92fbdb..55ef623e33 100644 --- a/gst/rtp/gstrtpmp2tpay.c +++ b/gst/rtp/gstrtpmp2tpay.c @@ -127,6 +127,8 @@ gst_rtp_mp2t_pay_flush (GstRTPMP2TPay * rtpmp2tpay) GstBuffer *outbuf; avail = gst_adapter_available (rtpmp2tpay->adapter); + if (avail == 0) + return GST_FLOW_OK; outbuf = gst_rtp_buffer_new_allocate (avail, 0, 0); /* get payload */ From 57a0eacc7bbe1c7edfdd21e02c351bfba0c4d9bc Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Thu, 2 Feb 2012 12:25:21 +0000 Subject: [PATCH 08/19] flvdemux: specify we only output raw AAC in template caps https://bugzilla.gnome.org/show_bug.cgi?id=665394 --- gst/flv/gstflvdemux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gst/flv/gstflvdemux.c b/gst/flv/gstflvdemux.c index 640301bcea..fbf7e2579c 100644 --- a/gst/flv/gstflvdemux.c +++ b/gst/flv/gstflvdemux.c @@ -59,7 +59,7 @@ static GstStaticPadTemplate audio_src_template = GST_STATIC_CAPS ("audio/x-adpcm, layout = (string) swf, channels = (int) { 1, 2 }, rate = (int) { 5512, 11025, 22050, 44100 }; " "audio/mpeg, mpegversion = (int) 1, layer = (int) 3, channels = (int) { 1, 2 }, rate = (int) { 5512, 8000, 11025, 22050, 44100 }, parsed = (boolean) TRUE; " - "audio/mpeg, mpegversion = (int) 4, framed = (boolean) TRUE; " + "audio/mpeg, mpegversion = (int) 4, stream-format = (string) raw, framed = (boolean) TRUE; " "audio/x-nellymoser, channels = (int) { 1, 2 }, rate = (int) { 5512, 8000, 11025, 16000, 22050, 44100 }; " "audio/x-raw-int, endianness = (int) LITTLE_ENDIAN, channels = (int) { 1, 2 }, width = (int) 8, depth = (int) 8, rate = (int) { 5512, 11025, 22050, 44100 }, signed = (boolean) FALSE; " "audio/x-raw-int, endianness = (int) LITTLE_ENDIAN, channels = (int) { 1, 2 }, width = (int) 16, depth = (int) 16, rate = (int) { 5512, 11025, 22050, 44100 }, signed = (boolean) TRUE; " From 5e93d1ce4c6d844b63bab935fbbc770f719d31c2 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Thu, 2 Feb 2012 12:27:09 +0000 Subject: [PATCH 09/19] flvmux: specify we only accept raw AAC in template caps No header seems to be added, and the codec ID is the same as used for raw by flvdemux, so raw seems the only supported case. https://bugzilla.gnome.org/show_bug.cgi?id=665394 --- gst/flv/gstflvmux.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gst/flv/gstflvmux.c b/gst/flv/gstflvmux.c index aac216ace8..c427f529cc 100644 --- a/gst/flv/gstflvmux.c +++ b/gst/flv/gstflvmux.c @@ -74,7 +74,8 @@ static GstStaticPadTemplate audiosink_templ = GST_STATIC_PAD_TEMPLATE ("audio", GST_STATIC_CAPS ("audio/x-adpcm, layout = (string) swf, channels = (int) { 1, 2 }, rate = (int) { 5512, 11025, 22050, 44100 }; " "audio/mpeg, mpegversion = (int) 1, layer = (int) 3, channels = (int) { 1, 2 }, rate = (int) { 5512, 8000, 11025, 22050, 44100 }, parsed = (boolean) TRUE; " - "audio/mpeg, mpegversion = (int) { 2, 4 }, framed = (boolean) TRUE; " + "audio/mpeg, mpegversion = (int) 2, framed = (boolean) TRUE; " + "audio/mpeg, mpegversion = (int) 4, stream-format = (string) raw, framed = (boolean) TRUE; " "audio/x-nellymoser, channels = (int) { 1, 2 }, rate = (int) { 5512, 8000, 11025, 16000, 22050, 44100 }; " "audio/x-raw-int, endianness = (int) LITTLE_ENDIAN, channels = (int) { 1, 2 }, width = (int) 8, depth = (int) 8, rate = (int) { 5512, 11025, 22050, 44100 }, signed = (boolean) FALSE; " "audio/x-raw-int, endianness = (int) LITTLE_ENDIAN, channels = (int) { 1, 2 }, width = (int) 16, depth = (int) 16, rate = (int) { 5512, 11025, 22050, 44100 }, signed = (boolean) TRUE; " From 5ff31d446ecf1d4c9f05e98351e390580c03d65c Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Fri, 3 Feb 2012 14:53:31 +0000 Subject: [PATCH 10/19] flacenc: fix event leak when there is no peer on the src pad --- ext/flac/gstflacenc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ext/flac/gstflacenc.c b/ext/flac/gstflacenc.c index 62065299d8..6a7e1c0442 100644 --- a/ext/flac/gstflacenc.c +++ b/ext/flac/gstflacenc.c @@ -883,7 +883,6 @@ gst_flac_enc_seek_callback (const FLAC__StreamEncoder * encoder, FLAC__uint64 absolute_byte_offset, void *client_data) { GstFlacEnc *flacenc; - GstEvent *event; GstPad *peerpad; flacenc = GST_FLAC_ENC (client_data); @@ -891,10 +890,9 @@ gst_flac_enc_seek_callback (const FLAC__StreamEncoder * encoder, if (flacenc->stopped) return FLAC__STREAM_ENCODER_SEEK_STATUS_OK; - event = gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_BYTES, - absolute_byte_offset, GST_BUFFER_OFFSET_NONE, 0); - if ((peerpad = gst_pad_get_peer (GST_AUDIO_ENCODER_SRC_PAD (flacenc)))) { + GstEvent *event = gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_BYTES, + absolute_byte_offset, GST_BUFFER_OFFSET_NONE, 0); gboolean ret = gst_pad_send_event (peerpad, event); gst_object_unref (peerpad); From 4e2cf393c0516dbb2ecaa6b8d9b92eae598a30c4 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Fri, 3 Feb 2012 22:05:59 +0530 Subject: [PATCH 11/19] pulseaudiosink: Lower rank to prevent autoplugging pulseaudiosink breaks visualisations in its current form, so let's prevent it from being autoplugged for the time being. The best we can hope to do in the 0.10 series is query the list of available sinks and their formats, and expose these as the bin's sinkpad caps. While this is not a comprehensive solution, it will make sure that we're only trying to support compressed formats if we're certain that one exists. The long-term fix for this will be in the form of proper upstream renegotiation support in the 0.11/1.0 series. https://bugzilla.gnome.org/show_bug.cgi?id=666361 --- ext/pulse/plugin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/pulse/plugin.c b/ext/pulse/plugin.c index 6b2e6b4bf7..04c014ffc6 100644 --- a/ext/pulse/plugin.c +++ b/ext/pulse/plugin.c @@ -50,7 +50,7 @@ plugin_init (GstPlugin * plugin) return FALSE; #ifdef HAVE_PULSE_1_0 - if (!gst_element_register (plugin, "pulseaudiosink", GST_RANK_PRIMARY + 11, + if (!gst_element_register (plugin, "pulseaudiosink", GST_RANK_MARGINAL - 1, GST_TYPE_PULSE_AUDIO_SINK)) return FALSE; #endif From 32f8a04b5708d92067ffe9e3699cd889b166caf5 Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Sat, 28 Jan 2012 11:13:16 +0100 Subject: [PATCH 12/19] matroskademux: avoid posting invalid duration for each frame https://bugzilla.gnome.org/show_bug.cgi?id=666583 --- gst/matroska/matroska-demux.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c index c30e0d0283..6e49baa429 100644 --- a/gst/matroska/matroska-demux.c +++ b/gst/matroska/matroska-demux.c @@ -3512,10 +3512,12 @@ gst_matroska_demux_parse_blockgroup_or_simpleblock (GstMatroskaDemux * demux, gst_segment_set_duration (&demux->common.segment, GST_FORMAT_TIME, last_stop_end - demux->stream_start_time); GST_OBJECT_UNLOCK (demux); - gst_element_post_message (GST_ELEMENT_CAST (demux), - gst_message_new_duration (GST_OBJECT_CAST (demux), - GST_FORMAT_TIME, GST_CLOCK_TIME_NONE)); - demux->invalid_duration = TRUE; + if (!demux->invalid_duration) { + gst_element_post_message (GST_ELEMENT_CAST (demux), + gst_message_new_duration (GST_OBJECT_CAST (demux), + GST_FORMAT_TIME, GST_CLOCK_TIME_NONE)); + demux->invalid_duration = TRUE; + } } else { GST_OBJECT_UNLOCK (demux); } From 7a9970fc291c4238ec379a3b08917e53a6c1b55c Mon Sep 17 00:00:00 2001 From: Stefan Sauer Date: Tue, 7 Feb 2012 21:57:47 +0100 Subject: [PATCH 13/19] jack: rework transport support Move common code to jackclient. There we can also handle the request state message in a better way, as the element callbacks are only run if the element is active. --- ext/jack/gstjackaudioclient.c | 45 +++++++++++++++++++++++++++++++++-- ext/jack/gstjackaudiosink.c | 12 ---------- ext/jack/gstjackaudiosrc.c | 12 ---------- 3 files changed, 43 insertions(+), 26 deletions(-) diff --git a/ext/jack/gstjackaudioclient.c b/ext/jack/gstjackaudioclient.c index c33949f022..ef544d168e 100644 --- a/ext/jack/gstjackaudioclient.c +++ b/ext/jack/gstjackaudioclient.c @@ -22,6 +22,7 @@ #include #include "gstjackaudioclient.h" +#include "gstjack.h" #include @@ -77,14 +78,29 @@ struct _GstJackAudioClient gpointer user_data; }; -typedef jack_default_audio_sample_t sample_t; - typedef struct { jack_nframes_t nframes; gpointer user_data; } JackCB; +static gboolean +jack_handle_transport_change (GstJackAudioClient * client, GstState state) +{ + GstObject *obj = GST_OBJECT_PARENT (client->user_data); + GstJackTransport mode; + + g_object_get (obj, "transport", &mode, NULL); + if ((mode == GST_JACK_TRANSPORT_SLAVE) && (GST_STATE (obj) != state)) { + GST_INFO_OBJECT (obj, "requesting state change: %s", + gst_element_state_get_name (state)); + gst_element_post_message (GST_ELEMENT (obj), + gst_message_new_request_state (obj, state)); + return TRUE; + } + return FALSE; +} + static int jack_process_cb (jack_nframes_t nframes, void *arg) { @@ -111,6 +127,8 @@ jack_process_cb (jack_nframes_t nframes, void *arg) default: break; } + GST_DEBUG ("num of clients: src=%d, sink=%d", + g_list_length (conn->src_clients), g_list_length (conn->sink_clients)); } g_mutex_lock (conn->lock); @@ -141,6 +159,27 @@ jack_process_cb (jack_nframes_t nframes, void *arg) } } } + + /* handle transport state requisition, do sinks first, stop after the first + * element that handled it */ + if (conn->transport_state != GST_STATE_VOID_PENDING) { + for (walk = conn->sink_clients; walk; walk = g_list_next (walk)) { + if (jack_handle_transport_change ((GstJackAudioClient *) walk->data, + conn->transport_state)) { + conn->transport_state = GST_STATE_VOID_PENDING; + break; + } + } + } + if (conn->transport_state != GST_STATE_VOID_PENDING) { + for (walk = conn->src_clients; walk; walk = g_list_next (walk)) { + if (jack_handle_transport_change ((GstJackAudioClient *) walk->data, + conn->transport_state)) { + conn->transport_state = GST_STATE_VOID_PENDING; + break; + } + } + } g_mutex_unlock (conn->lock); return res; } @@ -259,6 +298,7 @@ gst_jack_audio_make_connection (const gchar * id, const gchar * server, jack_on_shutdown (jclient, jack_shutdown_cb, conn); /* all callbacks are set, activate the client */ + GST_INFO ("activate jack_client %p", jclient); if ((res = jack_activate (jclient))) goto could_not_activate; @@ -353,6 +393,7 @@ gst_jack_audio_unref_connection (GstJackAudioConnection * conn) * waiting for the JACK thread, and can thus cause deadlock in * jack_process_cb() */ + GST_INFO ("deactivate jack_client %p", conn->client); if ((res = jack_deactivate (conn->client))) { /* we only warn, this means the server is probably shut down and the client * is gone anyway. */ diff --git a/ext/jack/gstjackaudiosink.c b/ext/jack/gstjackaudiosink.c index 681671af94..1a7fc28ee8 100644 --- a/ext/jack/gstjackaudiosink.c +++ b/ext/jack/gstjackaudiosink.c @@ -195,18 +195,6 @@ jack_process_cb (jack_nframes_t nframes, void *arg) buf = GST_RING_BUFFER_CAST (arg); sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (buf)); - /* handle transport state requisitions */ - if (sink->transport == GST_JACK_TRANSPORT_SLAVE) { - GstState state = gst_jack_audio_client_get_transport_state (sink->client); - - if ((state != GST_STATE_VOID_PENDING) && (GST_STATE (sink) != state)) { - GST_DEBUG_OBJECT (sink, "requesting state change: %s", - gst_element_state_get_name (state)); - gst_element_post_message (GST_ELEMENT (sink), - gst_message_new_request_state (GST_OBJECT (sink), state)); - } - } - channels = buf->spec.channels; /* get target buffers */ diff --git a/ext/jack/gstjackaudiosrc.c b/ext/jack/gstjackaudiosrc.c index b85fe40d24..e2b2bc00a1 100644 --- a/ext/jack/gstjackaudiosrc.c +++ b/ext/jack/gstjackaudiosrc.c @@ -215,18 +215,6 @@ jack_process_cb (jack_nframes_t nframes, void *arg) buf = GST_RING_BUFFER_CAST (arg); src = GST_JACK_AUDIO_SRC (GST_OBJECT_PARENT (buf)); - /* handle transport state requisitions */ - if (src->transport == GST_JACK_TRANSPORT_SLAVE) { - GstState state = gst_jack_audio_client_get_transport_state (src->client); - - if ((state != GST_STATE_VOID_PENDING) && (GST_STATE (src) != state)) { - GST_DEBUG_OBJECT (src, "requesting state change: %s", - gst_element_state_get_name (state)); - gst_element_post_message (GST_ELEMENT (src), - gst_message_new_request_state (GST_OBJECT (src), state)); - } - } - channels = buf->spec.channels; /* get input buffers */ From 8b2ca70124d9bb520d8762e323c6bab01dcc667a Mon Sep 17 00:00:00 2001 From: Ralph Giles Date: Tue, 7 Feb 2012 14:10:44 -0800 Subject: [PATCH 14/19] shout2send: send video/webm through libshout. This requires SHOUT_FORMAT_WEBM, added in libshout 2.3.0, so video/webm support is contingent on that symbol being defined. Also an indentation change required by the pre-commit hook. https://bugzilla.gnome.org/show_bug.cgi?id=669590 --- ext/shout2/gstshout2.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/ext/shout2/gstshout2.c b/ext/shout2/gstshout2.c index 8b0ddbf794..c1bfcc2a1c 100644 --- a/ext/shout2/gstshout2.c +++ b/ext/shout2/gstshout2.c @@ -1,6 +1,7 @@ /* GStreamer * Copyright (C) <1999> Erik Walthinsen * Copyright (C) <2006> Tim-Philipp Müller + * Copyright (C) <2012> Ralph Giles * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -70,12 +71,17 @@ enum static GstElementClass *parent_class = NULL; +#ifdef SHOUT_FORMAT_WEBM +#define WEBM_CAPS "; video/webm" +#else +#define WEBM_CAPS "" +#endif static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("application/ogg; " - "audio/mpeg, mpegversion = (int) 1, layer = (int) [ 1, 3 ]") - ); + "audio/mpeg, mpegversion = (int) 1, layer = (int) [ 1, 3 ]" WEBM_CAPS)); + static void gst_shout2send_class_init (GstShout2sendClass * klass); static void gst_shout2send_base_init (GstShout2sendClass * klass); static void gst_shout2send_init (GstShout2send * shout2send); @@ -160,8 +166,7 @@ gst_shout2send_base_init (GstShout2sendClass * klass) { GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - gst_element_class_add_static_pad_template (element_class, - &sink_template); + gst_element_class_add_static_pad_template (element_class, &sink_template); gst_element_class_set_details_simple (element_class, "Icecast network sink", "Sink/Network", "Sends data to an icecast server", "Wim Taymans , " @@ -538,9 +543,14 @@ set_failed: static gboolean gst_shout2send_connect (GstShout2send * sink) { - GST_DEBUG_OBJECT (sink, "Connection format is: %s", + const char *format = (sink->audio_format == SHOUT_FORMAT_VORBIS) ? "vorbis" : - ((sink->audio_format == SHOUT_FORMAT_MP3) ? "mp3" : "unknown")); + ((sink->audio_format == SHOUT_FORMAT_MP3) ? "mp3" : "unknown"); +#ifdef SHOUT_FORMAT_WEBM + if (sink->audio_format == SHOUT_FORMAT_WEBM) + format = "webm"; +#endif + GST_DEBUG_OBJECT (sink, "Connection format is: %s", format); if (shout_set_format (sink->conn, sink->audio_format) != SHOUTERR_SUCCESS) goto could_not_set_format; @@ -810,6 +820,10 @@ gst_shout2send_setcaps (GstPad * pad, GstCaps * caps) shout2send->audio_format = SHOUT_FORMAT_MP3; } else if (!strcmp (mimetype, "application/ogg")) { shout2send->audio_format = SHOUT_FORMAT_VORBIS; +#ifdef SHOUT_FORMAT_WEBM + } else if (!strcmp (mimetype, "video/webm")) { + shout2send->audio_format = SHOUT_FORMAT_WEBM; +#endif } else { ret = FALSE; } From dc54c83fd3d7a709260ac9434e60d60259669fde Mon Sep 17 00:00:00 2001 From: Marc Leeman Date: Thu, 9 Feb 2012 10:11:48 +0100 Subject: [PATCH 15/19] multiudpsink: typo fix (bytes send -> bytes sent) --- gst/udp/gstmultiudpsink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gst/udp/gstmultiudpsink.c b/gst/udp/gstmultiudpsink.c index 7a35aaecad..b65ab8c268 100644 --- a/gst/udp/gstmultiudpsink.c +++ b/gst/udp/gstmultiudpsink.c @@ -298,7 +298,7 @@ gst_multiudpsink_class_init (GstMultiUDPSinkClass * klass) G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_BYTES_SERVED, g_param_spec_uint64 ("bytes-served", "Bytes served", - "Total number of bytes send to all clients", 0, G_MAXUINT64, 0, + "Total number of bytes sent to all clients", 0, G_MAXUINT64, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_SOCKFD, g_param_spec_int ("sockfd", "Socket Handle", From 507f9367788ad4ba51af93dc6eb6a0a5bb843bc1 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Thu, 9 Feb 2012 22:12:14 +0100 Subject: [PATCH 16/19] tests: mpegaudioparse: remove stray declaration --- tests/check/elements/mpegaudioparse.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/check/elements/mpegaudioparse.c b/tests/check/elements/mpegaudioparse.c index 69a08640fc..2bb26991eb 100644 --- a/tests/check/elements/mpegaudioparse.c +++ b/tests/check/elements/mpegaudioparse.c @@ -41,8 +41,6 @@ GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", GST_STATIC_CAPS (SRC_CAPS_TMPL) ); -const gchar *factory = "aacparse"; - /* some data */ static guint8 mp3_frame[384] = { 0xff, 0xfb, 0x94, 0xc4, 0xff, 0x83, 0xc0, 0x00, From dca42d4767adff3578e5d5990604766735ec1f9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 10 Feb 2012 13:44:43 +0000 Subject: [PATCH 17/19] tests: clean up rtp-payloading test a little Feed data into the pipeline using appsrc instead of fdsrc and a pipe. Store unsigned byte values in guint8 instead of char. Getting rid of the capsfilter also helps to avoid 'format is not fully specified' warnings when pushing "video/x-h264" data into rtph264pay with fully specified h264 caps in the sink template. --- tests/check/elements/rtp-payloading.c | 140 +++++++++++--------------- 1 file changed, 57 insertions(+), 83 deletions(-) diff --git a/tests/check/elements/rtp-payloading.c b/tests/check/elements/rtp-payloading.c index b2160f4a58..7b4985b8da 100644 --- a/tests/check/elements/rtp-payloading.c +++ b/tests/check/elements/rtp-payloading.c @@ -31,13 +31,11 @@ typedef struct { GstElement *pipeline; - GstElement *fdsrc; - GstElement *capsfilter; + GstElement *appsrc; GstElement *rtppay; GstElement *rtpdepay; GstElement *fakesink; - int fd[2]; - const char *frame_data; + const guint8 *frame_data; int frame_data_size; int frame_count; } rtp_pipeline; @@ -140,13 +138,11 @@ rtp_bus_callback (GstBus * bus, GstMessage * message, gpointer data) * The user must free the RTP pipeline when it's not used anymore. */ static rtp_pipeline * -rtp_pipeline_create (const char *frame_data, int frame_data_size, +rtp_pipeline_create (const guint8 * frame_data, int frame_data_size, int frame_count, const char *filtercaps, const char *pay, const char *depay) { gchar *pipeline_name; - rtp_pipeline *p; - GstCaps *caps; /* Check parameters. */ @@ -165,60 +161,39 @@ rtp_pipeline_create (const char *frame_data, int frame_data_size, pipeline_name = g_strdup_printf ("%s-%s-pipeline", pay, depay); p->pipeline = gst_pipeline_new (pipeline_name); g_free (pipeline_name); - p->fdsrc = gst_element_factory_make ("fdsrc", NULL); - p->capsfilter = gst_element_factory_make ("capsfilter", NULL); + p->appsrc = gst_element_factory_make ("appsrc", NULL); p->rtppay = gst_element_factory_make (pay, NULL); p->rtpdepay = gst_element_factory_make (depay, NULL); p->fakesink = gst_element_factory_make ("fakesink", NULL); /* One or more elements are not created successfully or failed to create p? */ - if (!p->pipeline || !p->fdsrc || !p->capsfilter || !p->rtppay || !p->rtpdepay - || !p->fakesink || pipe (p->fd) == -1) { + if (!p->pipeline || !p->appsrc || !p->rtppay || !p->rtpdepay || !p->fakesink) { /* Release created elements. */ RELEASE_ELEMENT (p->pipeline); - RELEASE_ELEMENT (p->fdsrc); - RELEASE_ELEMENT (p->capsfilter); + RELEASE_ELEMENT (p->appsrc); RELEASE_ELEMENT (p->rtppay); RELEASE_ELEMENT (p->rtpdepay); RELEASE_ELEMENT (p->fakesink); - /* Close pipe. */ - if (p->fd[0]) { - close (p->fd[0]); - } - - if (p->fd[1]) { - close (p->fd[1]); - } - /* Release allocated memory. */ free (p); return NULL; } - /* Set fdsrc properties. */ - g_object_set (p->fdsrc, "fd", p->fd[0], NULL); - g_object_set (p->fdsrc, "do-timestamp", TRUE, NULL); - g_object_set (p->fdsrc, "blocksize", p->frame_data_size, NULL); - g_object_set (p->fdsrc, "num-buffers", p->frame_count * LOOP_COUNT, NULL); - - /* Set caps filters. */ + /* Set src properties. */ caps = gst_caps_from_string (filtercaps); - - g_object_set (p->capsfilter, "caps", caps, NULL); + g_object_set (p->appsrc, "do-timestamp", TRUE, "caps", caps, NULL); gst_caps_unref (caps); /* Add elements to the pipeline. */ - gst_bin_add (GST_BIN (p->pipeline), p->fdsrc); - gst_bin_add (GST_BIN (p->pipeline), p->capsfilter); + gst_bin_add (GST_BIN (p->pipeline), p->appsrc); gst_bin_add (GST_BIN (p->pipeline), p->rtppay); gst_bin_add (GST_BIN (p->pipeline), p->rtpdepay); gst_bin_add (GST_BIN (p->pipeline), p->fakesink); /* Link elements. */ - gst_element_link (p->fdsrc, p->capsfilter); - gst_element_link (p->capsfilter, p->rtppay); + gst_element_link (p->appsrc, p->rtppay); gst_element_link (p->rtppay, p->rtpdepay); gst_element_link (p->rtpdepay, p->fakesink); @@ -240,15 +215,6 @@ rtp_pipeline_destroy (rtp_pipeline * p) /* Release pipeline. */ RELEASE_ELEMENT (p->pipeline); - /* Close pipe. */ - if (p->fd[0]) { - close (p->fd[0]); - } - - if (p->fd[1]) { - close (p->fd[1]); - } - /* Release allocated memory. */ free (p); } @@ -260,11 +226,10 @@ rtp_pipeline_destroy (rtp_pipeline * p) static void rtp_pipeline_run (rtp_pipeline * p) { + GstFlowReturn flow_ret; GMainLoop *mainloop = NULL; - GstBus *bus; - - gint i; + gint i, j; /* Check parameters. */ if (p == NULL) { @@ -286,22 +251,28 @@ rtp_pipeline_run (rtp_pipeline * p) /* Set pipeline to PLAYING. */ gst_element_set_state (p->pipeline, GST_STATE_PLAYING); - /* TODO: Writing may need some changes... */ - + /* Push data into the pipeline */ for (i = 0; i < LOOP_COUNT; i++) { - const char *frame_data_pointer = p->frame_data; - int res; - int frame_count = p->frame_count; + const guint8 *data = p->frame_data; - /* Write in to the pipe. */ - while (frame_count > 0) { - res = write (p->fd[1], frame_data_pointer, p->frame_data_size); - fail_unless_equals_int (res, p->frame_data_size); - frame_data_pointer += p->frame_data_size; - frame_count--; + for (j = 0; j < p->frame_count; j++) { + GstBuffer *buf; + + buf = gst_buffer_new (); + GST_BUFFER_DATA (buf) = (guint8 *) data; + GST_BUFFER_SIZE (buf) = p->frame_data_size; + GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_READONLY); + + g_signal_emit_by_name (p->appsrc, "push-buffer", buf, &flow_ret); + fail_unless_equals_int (flow_ret, GST_FLOW_OK); + data += p->frame_data_size; + + gst_buffer_unref (buf); } } + g_signal_emit_by_name (p->appsrc, "end-of-stream", &flow_ret); + /* Run mainloop. */ g_main_loop_run (mainloop); @@ -350,8 +321,8 @@ rtp_pipeline_enable_lists (rtp_pipeline * p, guint mtu_size) * @use_lists enable buffer lists */ static void -rtp_pipeline_test (const char *frame_data, int frame_data_size, int frame_count, - const char *filtercaps, const char *pay, const char *depay, +rtp_pipeline_test (const guint8 * frame_data, int frame_data_size, + int frame_count, const char *filtercaps, const char *pay, const char *depay, guint bytes_sent, guint mtu_size, gboolean use_lists) { /* Create RTP pipeline. */ @@ -380,7 +351,7 @@ rtp_pipeline_test (const char *frame_data, int frame_data_size, int frame_count, } } -static char rtp_ilbc_frame_data[] = +static const guint8 rtp_ilbc_frame_data[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -397,7 +368,7 @@ GST_START_TEST (rtp_ilbc) } GST_END_TEST; -static char rtp_gsm_frame_data[] = +static const guint8 rtp_gsm_frame_data[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -414,7 +385,7 @@ GST_START_TEST (rtp_gsm) } GST_END_TEST; -static char rtp_amr_frame_data[] = +static const guint8 rtp_amr_frame_data[] = { 0x3c, 0x24, 0x03, 0xb3, 0x48, 0x10, 0x68, 0x46, 0x6c, 0xec, 0x03, 0x7a, 0x37, 0x16, 0x41, 0x41, 0xc0, 0x00, 0x0d, 0xcd, 0x12, 0xed, 0xad, 0x80, 0x00, 0x00, 0x11, 0x31, 0x00, 0x00, 0x0d, 0xa0 @@ -432,7 +403,7 @@ GST_START_TEST (rtp_amr) } GST_END_TEST; -static char rtp_pcma_frame_data[] = +static const guint8 rtp_pcma_frame_data[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -449,7 +420,7 @@ GST_START_TEST (rtp_pcma) } GST_END_TEST; -static char rtp_pcmu_frame_data[] = +static const guint8 rtp_pcmu_frame_data[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -466,7 +437,7 @@ GST_START_TEST (rtp_pcmu) } GST_END_TEST; -static char rtp_mpa_frame_data[] = +static const guint8 rtp_mpa_frame_data[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -483,7 +454,7 @@ GST_START_TEST (rtp_mpa) } GST_END_TEST; -static char rtp_h263_frame_data[] = +static const guint8 rtp_h263_frame_data[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -495,12 +466,12 @@ static int rtp_h263_frame_count = 1; GST_START_TEST (rtp_h263) { rtp_pipeline_test (rtp_h263_frame_data, rtp_h263_frame_data_size, - rtp_h263_frame_count, "video/x-h263,variant=itu,h263version=h263", + rtp_h263_frame_count, "video/x-h263,variant=(string)itu,h263version=h263", "rtph263pay", "rtph263depay", 0, 0, FALSE); } GST_END_TEST; -static char rtp_h263p_frame_data[] = +static const guint8 rtp_h263p_frame_data[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -512,12 +483,12 @@ static int rtp_h263p_frame_count = 1; GST_START_TEST (rtp_h263p) { rtp_pipeline_test (rtp_h263p_frame_data, rtp_h263p_frame_data_size, - rtp_h263p_frame_count, "video/x-h263,variant=itu", "rtph263ppay", + rtp_h263p_frame_count, "video/x-h263,variant=(string)itu", "rtph263ppay", "rtph263pdepay", 0, 0, FALSE); } GST_END_TEST; -static char rtp_h264_frame_data[] = +static const guint8 rtp_h264_frame_data[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -528,13 +499,14 @@ static int rtp_h264_frame_count = 1; GST_START_TEST (rtp_h264) { + /* FIXME 0.11: fully specify h264 caps (and make payloader check) */ rtp_pipeline_test (rtp_h264_frame_data, rtp_h264_frame_data_size, rtp_h264_frame_count, "video/x-h264", "rtph264pay", "rtph264depay", 0, 0, FALSE); } GST_END_TEST; -static char rtp_h264_list_lt_mtu_frame_data[] = +static const guint8 rtp_h264_list_lt_mtu_frame_data[] = /* not packetized, next NAL starts with 0001 */ { 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, @@ -552,6 +524,7 @@ static int rtp_h264_list_lt_mtu_mtu_size = 1024; GST_START_TEST (rtp_h264_list_lt_mtu) { + /* FIXME 0.11: fully specify h264 caps (and make payloader check) */ rtp_pipeline_test (rtp_h264_list_lt_mtu_frame_data, rtp_h264_list_lt_mtu_frame_data_size, rtp_h264_list_lt_mtu_frame_count, "video/x-h264", "rtph264pay", "rtph264depay", @@ -559,7 +532,7 @@ GST_START_TEST (rtp_h264_list_lt_mtu) } GST_END_TEST; -static char rtp_h264_list_gt_mtu_frame_data[] = +static const guint8 rtp_h264_list_gt_mtu_frame_data[] = /* not packetized, next NAL starts with 0001 */ { 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -580,6 +553,7 @@ static int rtp_h264_list_gt_mtu_mty_size = 28; GST_START_TEST (rtp_h264_list_gt_mtu) { + /* FIXME 0.11: fully specify h264 caps (and make payloader check) */ rtp_pipeline_test (rtp_h264_list_gt_mtu_frame_data, rtp_h264_list_gt_mtu_frame_data_size, rtp_h264_list_gt_mtu_frame_count, "video/x-h264", "rtph264pay", "rtph264depay", @@ -587,7 +561,7 @@ GST_START_TEST (rtp_h264_list_gt_mtu) } GST_END_TEST; -static char rtp_L16_frame_data[] = +static const guint8 rtp_L16_frame_data[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -605,7 +579,7 @@ GST_START_TEST (rtp_L16) } GST_END_TEST; -static char rtp_mp2t_frame_data[] = +static const guint8 rtp_mp2t_frame_data[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -622,7 +596,7 @@ GST_START_TEST (rtp_mp2t) } GST_END_TEST; -static char rtp_mp4v_frame_data[] = +static const guint8 rtp_mp4v_frame_data[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -639,7 +613,7 @@ GST_START_TEST (rtp_mp4v) } GST_END_TEST; -static char rtp_mp4v_list_frame_data[] = +static const guint8 rtp_mp4v_list_frame_data[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -659,7 +633,7 @@ GST_START_TEST (rtp_mp4v_list) } GST_END_TEST; -static char rtp_mp4g_frame_data[] = +static const guint8 rtp_mp4g_frame_data[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -677,7 +651,7 @@ GST_START_TEST (rtp_mp4g) } GST_END_TEST; -static char rtp_theora_frame_data[] = +static const guint8 rtp_theora_frame_data[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -694,7 +668,7 @@ GST_START_TEST (rtp_theora) } GST_END_TEST; -static char rtp_vorbis_frame_data[] = +static const guint8 rtp_vorbis_frame_data[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -711,7 +685,7 @@ GST_START_TEST (rtp_vorbis) } GST_END_TEST; -static char rtp_jpeg_frame_data[] = +static const guint8 rtp_jpeg_frame_data[] = { /* SOF */ 0xFF, 0xC0, 0x00, 0x11, 0x08, 0x00, 0x08, 0x00, 0x08, 0x03, 0x00, 0x21, 0x08, 0x01, 0x11, 0x08, 0x02, 0x11, 0x08, /* DQT */ 0xFF, 0xDB, 0x00, 0x43, 0x08, @@ -738,7 +712,7 @@ GST_START_TEST (rtp_jpeg) } GST_END_TEST; -static char rtp_jpeg_list_frame_data[] = +static const guint8 rtp_jpeg_list_frame_data[] = { /* SOF */ 0xFF, 0xC0, 0x00, 0x11, 0x08, 0x00, 0x08, 0x00, 0x08, 0x03, 0x00, 0x21, 0x08, 0x01, 0x11, 0x08, 0x02, 0x11, 0x08, /* DQT */ 0xFF, 0xDB, 0x00, 0x43, 0x08, @@ -767,7 +741,7 @@ GST_START_TEST (rtp_jpeg_list) } GST_END_TEST; -static char rtp_g729_frame_data[] = +static const guint8 rtp_g729_frame_data[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; From 6872b408730fd4eaacbb26fca79ebfb3f204e761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Wed, 8 Feb 2012 20:58:04 +0000 Subject: [PATCH 18/19] rtph264depay: add stream-format and alignment fields to src template caps Because we can. And so we get a warning if we try to output avc with nal alignment or somesuch. https://bugzilla.gnome.org/show_bug.cgi?id=606662 --- gst/rtp/gstrtph264depay.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gst/rtp/gstrtph264depay.c b/gst/rtp/gstrtph264depay.c index efe1725933..295ea31bd7 100644 --- a/gst/rtp/gstrtph264depay.c +++ b/gst/rtp/gstrtph264depay.c @@ -46,10 +46,13 @@ enum static const guint8 sync_bytes[] = { 0, 0, 0, 1 }; static GstStaticPadTemplate gst_rtp_h264_depay_src_template = -GST_STATIC_PAD_TEMPLATE ("src", + GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("video/x-h264") + GST_STATIC_CAPS ("video/x-h264, " + "stream-format = (string) avc, alignment = (string) au; " + "video/x-h264, " + "stream-format = (string) byte-stream, alignment = (string) { nal, au }") ); static GstStaticPadTemplate gst_rtp_h264_depay_sink_template = From 5b25f3737b488c3ddd7f5c2d4f9bd68a46e44da7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Wed, 8 Feb 2012 23:03:28 +0000 Subject: [PATCH 19/19] rtph264pay: add stream-format and alignment to h264 sink caps We're happy to accept both byte-stream and avc, advertise that on the sink caps and fix up _get_caps() function to not just return "video/x-h264". https://bugzilla.gnome.org/show_bug.cgi?id=606662 --- gst/rtp/gstrtph264pay.c | 185 ++++++++++++++++++++++------------------ 1 file changed, 100 insertions(+), 85 deletions(-) diff --git a/gst/rtp/gstrtph264pay.c b/gst/rtp/gstrtph264pay.c index b648f0847d..9f5006edc8 100644 --- a/gst/rtp/gstrtph264pay.c +++ b/gst/rtp/gstrtph264pay.c @@ -45,10 +45,13 @@ GST_DEBUG_CATEGORY_STATIC (rtph264pay_debug); */ static GstStaticPadTemplate gst_rtp_h264_pay_sink_template = -GST_STATIC_PAD_TEMPLATE ("sink", + GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("video/x-h264") + GST_STATIC_CAPS ("video/x-h264, " + "stream-format = (string) byte-stream, alignment = (string) { nal, au };" + "video/x-h264, " + "stream-format = (string) avc, alignment = (string) au") ); static GstStaticPadTemplate gst_rtp_h264_pay_src_template = @@ -271,98 +274,110 @@ static const gchar *all_levels[] = { static GstCaps * gst_rtp_h264_pay_getcaps (GstBaseRTPPayload * payload, GstPad * pad) { + GstCaps *template_caps; GstCaps *allowed_caps; + GstCaps *caps, *icaps; + guint i; allowed_caps = gst_pad_peer_get_caps_reffed (GST_BASE_RTP_PAYLOAD_SRCPAD (payload)); - if (allowed_caps) { - GstCaps *caps = NULL; - guint i; + if (allowed_caps == NULL) + return NULL; - if (gst_caps_is_any (allowed_caps)) { - gst_caps_unref (allowed_caps); - goto any; - } + template_caps = + gst_static_pad_template_get_caps (&gst_rtp_h264_pay_sink_template); - if (gst_caps_is_empty (allowed_caps)) - return allowed_caps; - - caps = gst_caps_new_empty (); - - for (i = 0; i < gst_caps_get_size (allowed_caps); i++) { - GstStructure *s = gst_caps_get_structure (allowed_caps, i); - GstStructure *new_s = gst_structure_new ("video/x-h264", NULL); - const gchar *profile_level_id; - - profile_level_id = gst_structure_get_string (s, "profile-level-id"); - - if (profile_level_id && strlen (profile_level_id) == 6) { - const gchar *profile; - const gchar *level; - long int spsint; - guint8 sps[3]; - - spsint = strtol (profile_level_id, NULL, 16); - sps[0] = spsint >> 16; - sps[1] = spsint >> 8; - sps[2] = spsint; - - profile = gst_codec_utils_h264_get_profile (sps, 3); - level = gst_codec_utils_h264_get_level (sps, 3); - - if (profile && level) { - GST_LOG_OBJECT (payload, "In caps, have profile %s and level %s", - profile, level); - - if (!strcmp (profile, "constrained-baseline")) - gst_structure_set (new_s, "profile", G_TYPE_STRING, profile, NULL); - else { - GValue val = { 0, }; - GValue profiles = { 0, }; - - g_value_init (&profiles, GST_TYPE_LIST); - g_value_init (&val, G_TYPE_STRING); - - g_value_set_static_string (&val, profile); - gst_value_list_append_value (&profiles, &val); - - g_value_set_static_string (&val, "constrained-baseline"); - gst_value_list_append_value (&profiles, &val); - - gst_structure_take_value (new_s, "profile", &profiles); - } - - if (!strcmp (level, "1")) - gst_structure_set (new_s, "level", G_TYPE_STRING, level, NULL); - else { - GValue levels = { 0, }; - GValue val = { 0, }; - int j; - - g_value_init (&levels, GST_TYPE_LIST); - g_value_init (&val, G_TYPE_STRING); - - for (j = 0; all_levels[j]; j++) { - g_value_set_static_string (&val, all_levels[j]); - gst_value_list_prepend_value (&levels, &val); - if (!strcmp (level, all_levels[j])) - break; - } - gst_structure_take_value (new_s, "level", &levels); - } - } - } - - gst_caps_merge_structure (caps, new_s); - } - - gst_caps_unref (allowed_caps); - return caps; + if (gst_caps_is_any (allowed_caps)) { + caps = gst_caps_ref (template_caps); + goto done; } -any: - return gst_caps_new_simple ("video/x-h264", NULL); + if (gst_caps_is_empty (allowed_caps)) { + caps = gst_caps_ref (allowed_caps); + goto done; + } + + caps = gst_caps_new_empty (); + + for (i = 0; i < gst_caps_get_size (allowed_caps); i++) { + GstStructure *s = gst_caps_get_structure (allowed_caps, i); + GstStructure *new_s = gst_structure_new ("video/x-h264", NULL); + const gchar *profile_level_id; + + profile_level_id = gst_structure_get_string (s, "profile-level-id"); + + if (profile_level_id && strlen (profile_level_id) == 6) { + const gchar *profile; + const gchar *level; + long int spsint; + guint8 sps[3]; + + spsint = strtol (profile_level_id, NULL, 16); + sps[0] = spsint >> 16; + sps[1] = spsint >> 8; + sps[2] = spsint; + + profile = gst_codec_utils_h264_get_profile (sps, 3); + level = gst_codec_utils_h264_get_level (sps, 3); + + if (profile && level) { + GST_LOG_OBJECT (payload, "In caps, have profile %s and level %s", + profile, level); + + if (!strcmp (profile, "constrained-baseline")) + gst_structure_set (new_s, "profile", G_TYPE_STRING, profile, NULL); + else { + GValue val = { 0, }; + GValue profiles = { 0, }; + + g_value_init (&profiles, GST_TYPE_LIST); + g_value_init (&val, G_TYPE_STRING); + + g_value_set_static_string (&val, profile); + gst_value_list_append_value (&profiles, &val); + + g_value_set_static_string (&val, "constrained-baseline"); + gst_value_list_append_value (&profiles, &val); + + gst_structure_take_value (new_s, "profile", &profiles); + } + + if (!strcmp (level, "1")) + gst_structure_set (new_s, "level", G_TYPE_STRING, level, NULL); + else { + GValue levels = { 0, }; + GValue val = { 0, }; + int j; + + g_value_init (&levels, GST_TYPE_LIST); + g_value_init (&val, G_TYPE_STRING); + + for (j = 0; all_levels[j]; j++) { + g_value_set_static_string (&val, all_levels[j]); + gst_value_list_prepend_value (&levels, &val); + if (!strcmp (level, all_levels[j])) + break; + } + gst_structure_take_value (new_s, "level", &levels); + } + } + } + + gst_caps_merge_structure (caps, new_s); + } + + icaps = gst_caps_intersect (caps, template_caps); + gst_caps_unref (caps); + caps = icaps; + +done: + + gst_caps_unref (template_caps); + gst_caps_unref (allowed_caps); + + GST_LOG_OBJECT (payload, "returning caps %" GST_PTR_FORMAT, caps); + return caps; } /* take the currently configured SPS and PPS lists and set them on the caps as