encoder/opus: initialize the "granulepos" packet attribute

This commit is contained in:
Max Kellermann 2012-10-02 09:16:44 +02:00
parent 038d216f18
commit 1badb3b5d5

View File

@ -63,6 +63,8 @@ struct opus_encoder {
OggStream stream; OggStream stream;
ogg_int64_t packetno; ogg_int64_t packetno;
ogg_int64_t granulepos;
}; };
gcc_const gcc_const
@ -235,12 +237,14 @@ opus_encoder_do_encode(struct opus_encoder *encoder, bool eos,
return false; return false;
} }
encoder->granulepos += encoder->buffer_frames;
ogg_packet packet; ogg_packet packet;
packet.packet = encoder->buffer2; packet.packet = encoder->buffer2;
packet.bytes = result; packet.bytes = result;
packet.b_o_s = false; packet.b_o_s = false;
packet.e_o_s = eos; packet.e_o_s = eos;
packet.granulepos = 0; // TODO packet.granulepos = encoder->granulepos;
packet.packetno = encoder->packetno++; packet.packetno = encoder->packetno++;
encoder->stream.PacketIn(packet); encoder->stream.PacketIn(packet);