Commit 31e1be75 authored by Max Kellermann's avatar Max Kellermann

encoder/opus: call ogg_stream_flush() only in the last iteration

If there are multiple pages, the last partial page must be flushed.
parent d793b7c0
...@@ -371,12 +371,12 @@ opus_encoder_read(struct encoder *_encoder, void *_dest, size_t length) ...@@ -371,12 +371,12 @@ opus_encoder_read(struct encoder *_encoder, void *_dest, size_t length)
opus_encoder_generate_tags(encoder); opus_encoder_generate_tags(encoder);
ogg_page page; ogg_page page;
int result; int result = ogg_stream_pageout(&encoder->os, &page);
if (encoder->flush) { if (result == 0 && encoder->flush) {
encoder->flush = false; encoder->flush = false;
result = ogg_stream_flush(&encoder->os, &page); result = ogg_stream_flush(&encoder->os, &page);
} else
result = ogg_stream_pageout(&encoder->os, &page); }
if (result == 0) if (result == 0)
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment