From 0d7ee2b014db4f5072ac17839d0c7f3535c60675 Mon Sep 17 00:00:00 2001 From: Michal Nazarewicz Date: Mon, 23 Mar 2015 19:14:54 +0100 Subject: [PATCH] OpusEncoderPlugin: initialise granulepos so we end up with sane values Not initialising granulepos leads to it having arbitrary values in the encoded stream including possibly negative values which are not valid and confuse opusdec. Explicitly initialise opus_encoder::granulepos to avoid that problem. --- NEWS | 2 ++ src/encoder/plugins/OpusEncoderPlugin.cxx | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 713550034..73f1b403a 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.19.10 (not yet released) +* encoder + - opus: fix bogus granulepos ver 0.19.9 (2015/02/06) * decoder diff --git a/src/encoder/plugins/OpusEncoderPlugin.cxx b/src/encoder/plugins/OpusEncoderPlugin.cxx index 27b614b86..2b52228cb 100644 --- a/src/encoder/plugins/OpusEncoderPlugin.cxx +++ b/src/encoder/plugins/OpusEncoderPlugin.cxx @@ -66,7 +66,7 @@ struct opus_encoder { ogg_int64_t granulepos; - opus_encoder():encoder(opus_encoder_plugin) {} + opus_encoder():encoder(opus_encoder_plugin), granulepos(0) {} }; static constexpr Domain opus_encoder_domain("opus_encoder");