summaryrefslogtreecommitdiff
path: root/ext/sndfile
diff options
context:
space:
mode:
authorStefan Sauer <ensonic@users.sf.net>2014-01-05 23:43:25 +0100
committerStefan Sauer <ensonic@users.sf.net>2014-01-05 23:45:34 +0100
commit18ec1c9bd76d352945c0bc5689791aa16d666b2c (patch)
tree093f08ce143748e968d6315ae9550400b5427253 /ext/sndfile
parentef2eef0365e836521edec6b0f9c74f946bd23644 (diff)
downloadgstreamer-plugins-bad-18ec1c9bd76d352945c0bc5689791aa16d666b2c.tar.gz
sfdec: the read functions already return frames_read
Fixes choppy output.
Diffstat (limited to 'ext/sndfile')
-rw-r--r--ext/sndfile/gstsfdec.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/ext/sndfile/gstsfdec.c b/ext/sndfile/gstsfdec.c
index 0b2a709ca..d304f6b51 100644
--- a/ext/sndfile/gstsfdec.c
+++ b/ext/sndfile/gstsfdec.c
@@ -702,7 +702,7 @@ gst_sf_dec_loop (GstPad * pad)
GstBuffer *buf;
GstMapInfo map;
GstFlowReturn flow;
- sf_count_t bytes_read;
+ sf_count_t frames_read;
guint num_frames = 1024; /* arbitrary */
if (G_UNLIKELY (!self->file)) {
@@ -713,23 +713,21 @@ gst_sf_dec_loop (GstPad * pad)
buf = gst_buffer_new_and_alloc (self->bytes_per_frame * num_frames);
gst_buffer_map (buf, &map, GST_MAP_WRITE);
- bytes_read = self->reader (self->file, map.data, num_frames);
+ frames_read = self->reader (self->file, map.data, num_frames);
GST_DEBUG_OBJECT (self, "read %d / %d bytes = %d frames of audio",
- (gint) bytes_read, (gint) map.size, num_frames);
+ (gint) frames_read, (gint) map.size, num_frames);
gst_buffer_unmap (buf, &map);
- if (G_UNLIKELY (bytes_read < 0))
+ if (G_UNLIKELY (frames_read < 0))
goto could_not_read;
- if (G_UNLIKELY (bytes_read == 0))
+ if (G_UNLIKELY (frames_read == 0))
goto eos;
- num_frames = bytes_read / self->bytes_per_frame;
-
GST_BUFFER_OFFSET (buf) = self->offset;
GST_BUFFER_TIMESTAMP (buf) = gst_util_uint64_scale_int (self->offset,
GST_SECOND, self->rate);
- self->offset += num_frames;
+ self->offset += frames_read;
GST_BUFFER_DURATION (buf) = gst_util_uint64_scale_int (self->offset,
GST_SECOND, self->rate) - GST_BUFFER_TIMESTAMP (buf);