diff options
author | Olivier CrĂȘte <olivier.crete@collabora.co.uk> | 2008-11-19 18:17:48 -0500 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@collabora.co.uk> | 2008-11-19 18:17:48 -0500 |
commit | cb7d3ba01d59d0db342f04ab7cf5640c2c1d1e82 (patch) | |
tree | 2f5c449f12fc1c5382762ef7ec1812f9d3e23509 /gst/gstnicesrc.c | |
parent | 0671c485e087c5d656053f348037a3235e414701 (diff) |
Revert "Create a netbuffer directly instead of using gst_pad_buffer_alloc"
This reverts commit c8cd93a9a92d579f2a7090acea65e72180b358a4.
Diffstat (limited to 'gst/gstnicesrc.c')
-rw-r--r-- | gst/gstnicesrc.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/gst/gstnicesrc.c b/gst/gstnicesrc.c index 895c8bd..e83eade 100644 --- a/gst/gstnicesrc.c +++ b/gst/gstnicesrc.c @@ -195,18 +195,15 @@ gst_nice_src_read_callback (NiceAgent *agent, { GstBaseSrc *basesrc = GST_BASE_SRC (data); GstNiceSrc *nicesrc = GST_NICE_SRC (basesrc); - GstNetBuffer *mybuf; GST_LOG_OBJECT (agent, "Got buffer, getting out of the main loop"); - mybuf = gst_netbuffer_new (); - GST_BUFFER_MALLOCDATA (mybuf) = g_memdup (buf, len); - GST_BUFFER_SIZE (mybuf) = len; - GST_BUFFER_DATA (mybuf) = GST_BUFFER_MALLOCDATA (mybuf); - if (GST_PAD_CAPS (basesrc->srcpad)) - GST_BUFFER_CAPS (mybuf) = gst_caps_ref (GST_PAD_CAPS (basesrc->srcpad)); - - nicesrc->outbuf = GST_BUFFER_CAST (mybuf); + nicesrc->flow_ret = gst_pad_alloc_buffer (basesrc->srcpad, nicesrc->offset, + len, GST_PAD_CAPS (basesrc->srcpad), &nicesrc->outbuf); + if (nicesrc->flow_ret == GST_FLOW_OK) { + memcpy (nicesrc->outbuf->data, buf, len); + nicesrc->outbuf->size = len; + } g_main_loop_quit (nicesrc->mainloop); } @@ -270,6 +267,7 @@ gst_nice_src_create ( GST_LOG_OBJECT (nicesrc, "create called"); nicesrc->outbuf = NULL; + nicesrc->offset = offset; GST_OBJECT_LOCK (basesrc); if (nicesrc->unlocked) { @@ -284,13 +282,12 @@ gst_nice_src_create ( GST_LOG_OBJECT (nicesrc, "Got buffer, pushing"); *buffer = nicesrc->outbuf; - GST_BUFFER_OFFSET (*buffer) = offset; - - return GST_FLOW_OK; + return nicesrc->flow_ret; } else { GST_LOG_OBJECT (nicesrc, "Got interrupting, returning wrong-state"); return GST_FLOW_WRONG_STATE; } + } static void |