summaryrefslogtreecommitdiff
path: root/gst/wavenc
diff options
context:
space:
mode:
authorJulien Moutte <julien@moutte.net>2005-11-20 16:43:32 +0000
committerJulien Moutte <julien@moutte.net>2005-11-20 16:43:32 +0000
commit985daa9d64adeace2b3dea9e319427e2154f125e (patch)
tree2dbd2090efe92e188f229a19a8139bb15f6354e7 /gst/wavenc
parent978a8d1529e53fe3926bccccb05310a25e5204d5 (diff)
downloadgstreamer-plugins-good-985daa9d64adeace2b3dea9e319427e2154f125e.tar.gz
gst/matroska/matroska-mux.c: Fix for
Original commit message from CVS: 2005-11-20 Julien MOUTTE <julien@moutte.net> * gst/matroska/matroska-mux.c: (gst_matroska_mux_start): Fix for API changes. * gst/wavenc/gstwavenc.c: (gst_wavenc_chain): Fix for API changes, but also fix the code that was not checking return values from pad_push neither using pad_alloc_buffer.
Diffstat (limited to 'gst/wavenc')
-rw-r--r--gst/wavenc/gstwavenc.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/gst/wavenc/gstwavenc.c b/gst/wavenc/gstwavenc.c
index 435db53c6..a964896ec 100644
--- a/gst/wavenc/gstwavenc.c
+++ b/gst/wavenc/gstwavenc.c
@@ -662,22 +662,30 @@ gst_wavenc_chain (GstPad * pad, GstBuffer * buf)
goto beach;
}
- if (GST_PAD_IS_USABLE (wavenc->srcpad)) {
- if (wavenc->flush_header) {
- GstBuffer *outbuf;
-
- outbuf = gst_buffer_new_and_alloc (WAV_HEADER_LEN);
- memcpy (GST_BUFFER_DATA (outbuf), wavenc->header, WAV_HEADER_LEN);
- GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
-
- gst_pad_push (wavenc->srcpad, outbuf);
- wavenc->flush_header = FALSE;
+ if (wavenc->flush_header) {
+ GstBuffer *outbuf;
+
+ result = gst_pad_alloc_buffer (wavenc->srcpad, GST_BUFFER_OFFSET_NONE,
+ WAV_HEADER_LEN, GST_PAD_CAPS (wavenc->srcpad), &outbuf);
+ if (result != GST_FLOW_OK) {
+ GST_WARNING_OBJECT (wavenc, "failed when allocating a %d bytes buffer "
+ "for headers", WAV_HEADER_LEN);
+ goto beach;
}
+ memcpy (GST_BUFFER_DATA (outbuf), wavenc->header, WAV_HEADER_LEN);
+ GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
- wavenc->length += GST_BUFFER_SIZE (buf);
- gst_pad_push (wavenc->srcpad, buf);
+ result = gst_pad_push (wavenc->srcpad, outbuf);
+ if (result != GST_FLOW_OK) {
+ GST_WARNING_OBJECT (wavenc, "failed when pushing header buffer");
+ goto beach;
+ }
+ wavenc->flush_header = FALSE;
}
+ wavenc->length += GST_BUFFER_SIZE (buf);
+ result = gst_pad_push (wavenc->srcpad, buf);
+
beach:
gst_object_unref (wavenc);
return result;