diff options
author | Max Kellermann <max@duempel.org> | 2012-10-02 09:16:44 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2012-10-02 09:16:44 +0200 |
commit | 1badb3b5d5d095815a07116c491240db44abb344 (patch) | |
tree | 5801eb09b09f446ce02f0c36842eed08e45877ca | |
parent | 038d216f18b5f492809a7441ea7b6d272f84c068 (diff) | |
download | mpd-1badb3b5d5d095815a07116c491240db44abb344.tar.gz mpd-1badb3b5d5d095815a07116c491240db44abb344.tar.xz mpd-1badb3b5d5d095815a07116c491240db44abb344.zip |
encoder/opus: initialize the "granulepos" packet attribute
-rw-r--r-- | src/encoder/OpusEncoderPlugin.cxx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/encoder/OpusEncoderPlugin.cxx b/src/encoder/OpusEncoderPlugin.cxx index c28e7ff00..043a9e767 100644 --- a/src/encoder/OpusEncoderPlugin.cxx +++ b/src/encoder/OpusEncoderPlugin.cxx @@ -63,6 +63,8 @@ struct opus_encoder { OggStream stream; ogg_int64_t packetno; + + ogg_int64_t granulepos; }; gcc_const @@ -235,12 +237,14 @@ opus_encoder_do_encode(struct opus_encoder *encoder, bool eos, return false; } + encoder->granulepos += encoder->buffer_frames; + ogg_packet packet; packet.packet = encoder->buffer2; packet.bytes = result; packet.b_o_s = false; packet.e_o_s = eos; - packet.granulepos = 0; // TODO + packet.granulepos = encoder->granulepos; packet.packetno = encoder->packetno++; encoder->stream.PacketIn(packet); |