diff options
author | Thomas Vander Stichele <thomas (at) apestaart (dot) org> | 2009-02-21 12:47:00 +0100 |
---|---|---|
committer | Thomas Vander Stichele <thomas (at) apestaart (dot) org> | 2009-02-21 12:47:00 +0100 |
commit | a7902054bdbe4229a50a5d73843526fc21dc0c2f (patch) | |
tree | e087abcd3120b8245162d917eea4d5e6687b8c24 | |
parent | 02f242a740dc617581e4ccf1557b84a328c8dd2f (diff) |
respect DEFAULT segment by clipping the last buffer to be sent
-rw-r--r-- | ext/flac/gstflacdec.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ext/flac/gstflacdec.c b/ext/flac/gstflacdec.c index 405a6b73..2e04b749 100644 --- a/ext/flac/gstflacdec.c +++ b/ext/flac/gstflacdec.c @@ -997,6 +997,17 @@ gst_flac_dec_write (GstFlacDec * flacdec, const FLAC__Frame * frame, guint j, i; GstClockTime next; + /* if a DEFAULT segment is configured, don't send samples past the end + * of the segment */ + if (flacdec->segment.format == GST_FORMAT_DEFAULT && + flacdec->segment.stop != -1 && + flacdec->segment.last_stop > 0 && + flacdec->segment.last_stop + samples > flacdec->segment.stop) { + samples = flacdec->segment.stop - flacdec->segment.last_stop; + GST_DEBUG_OBJECT (flacdec, + "clipping last buffer to %d samples because of segment", samples); + } + switch (depth) { case 8: width = 8; |