aboutsummaryrefslogtreecommitdiffstats
path: root/src/encoder
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-10-02 08:13:48 +0200
committerMax Kellermann <max@duempel.org>2012-10-02 08:13:48 +0200
commit31e1be75709e7ca69184b9277cfe13e71594b029 (patch)
treeacd890826f52e9c02f2b5590f14bb3d30fb8692b /src/encoder
parentd793b7c03ff7444b0aab485e5895573b4a4ff0a1 (diff)
downloadmpd-31e1be75709e7ca69184b9277cfe13e71594b029.tar.gz
mpd-31e1be75709e7ca69184b9277cfe13e71594b029.tar.xz
mpd-31e1be75709e7ca69184b9277cfe13e71594b029.zip
encoder/opus: call ogg_stream_flush() only in the last iteration
If there are multiple pages, the last partial page must be flushed.
Diffstat (limited to 'src/encoder')
-rw-r--r--src/encoder/OpusEncoderPlugin.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/encoder/OpusEncoderPlugin.cxx b/src/encoder/OpusEncoderPlugin.cxx
index c967a24a7..4a51dabb3 100644
--- a/src/encoder/OpusEncoderPlugin.cxx
+++ b/src/encoder/OpusEncoderPlugin.cxx
@@ -371,12 +371,12 @@ opus_encoder_read(struct encoder *_encoder, void *_dest, size_t length)
opus_encoder_generate_tags(encoder);
ogg_page page;
- int result;
- if (encoder->flush) {
+ int result = ogg_stream_pageout(&encoder->os, &page);
+ if (result == 0 && encoder->flush) {
encoder->flush = false;
result = ogg_stream_flush(&encoder->os, &page);
- } else
- result = ogg_stream_pageout(&encoder->os, &page);
+
+ }
if (result == 0)
return 0;