summaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/musepack/gstmusepackdec.c7
-rw-r--r--ext/musepack/gstmusepackdec.cpp7
2 files changed, 8 insertions, 6 deletions
diff --git a/ext/musepack/gstmusepackdec.c b/ext/musepack/gstmusepackdec.c
index a86828c2..7917a346 100644
--- a/ext/musepack/gstmusepackdec.c
+++ b/ext/musepack/gstmusepackdec.c
@@ -416,6 +416,7 @@ gst_musepackdec_loop (GstElement * element)
GstMusepackDec *musepackdec = GST_MUSEPACK_DEC (element);
GstBuffer *out;
GstFormat fmt;
+ gint ret;
if (!musepackdec->dec) {
if (!gst_musepack_stream_init (musepackdec))
@@ -444,9 +445,8 @@ gst_musepackdec_loop (GstElement * element)
}
out = gst_buffer_new_and_alloc (MPC_decoder::DecodeBufferLength * 4);
- GST_BUFFER_SIZE (out) =
- musepackdec->dec->Decode ((MPC_SAMPLE_FORMAT *) GST_BUFFER_DATA (out));
- if (GST_BUFFER_SIZE (out) == 0) {
+ ret = musepackdec->dec->Decode ((MPC_SAMPLE_FORMAT *) GST_BUFFER_DATA (out));
+ if (ret <= 0) {
if (musepackdec->reader->eos == true) {
gst_element_set_eos (element);
gst_pad_push (musepackdec->srcpad,
@@ -455,6 +455,7 @@ gst_musepackdec_loop (GstElement * element)
gst_buffer_unref (out);
return;
}
+ GST_BUFFER_SIZE (out) = ret;
/* note that the size is still in samples */
fmt = GST_FORMAT_TIME;
gst_pad_query (musepackdec->srcpad,
diff --git a/ext/musepack/gstmusepackdec.cpp b/ext/musepack/gstmusepackdec.cpp
index a86828c2..7917a346 100644
--- a/ext/musepack/gstmusepackdec.cpp
+++ b/ext/musepack/gstmusepackdec.cpp
@@ -416,6 +416,7 @@ gst_musepackdec_loop (GstElement * element)
GstMusepackDec *musepackdec = GST_MUSEPACK_DEC (element);
GstBuffer *out;
GstFormat fmt;
+ gint ret;
if (!musepackdec->dec) {
if (!gst_musepack_stream_init (musepackdec))
@@ -444,9 +445,8 @@ gst_musepackdec_loop (GstElement * element)
}
out = gst_buffer_new_and_alloc (MPC_decoder::DecodeBufferLength * 4);
- GST_BUFFER_SIZE (out) =
- musepackdec->dec->Decode ((MPC_SAMPLE_FORMAT *) GST_BUFFER_DATA (out));
- if (GST_BUFFER_SIZE (out) == 0) {
+ ret = musepackdec->dec->Decode ((MPC_SAMPLE_FORMAT *) GST_BUFFER_DATA (out));
+ if (ret <= 0) {
if (musepackdec->reader->eos == true) {
gst_element_set_eos (element);
gst_pad_push (musepackdec->srcpad,
@@ -455,6 +455,7 @@ gst_musepackdec_loop (GstElement * element)
gst_buffer_unref (out);
return;
}
+ GST_BUFFER_SIZE (out) = ret;
/* note that the size is still in samples */
fmt = GST_FORMAT_TIME;
gst_pad_query (musepackdec->srcpad,