HI,
I'm trying to simulate an audio conference where each leg can be with a
different bit rate. This needs to encode the source PCM to to different bit
rates back to back and store and send respective encoded frames/packet to
the respective channel. For this I changed the opus_demo as below. But the
output of the second encoded frames is completely garbled.
Appreciate if anyone can suggest how to handle this case.
if(1)
{
opus_encoder_ctl(enc, OPUS_SET_BITRATE(bitrate_bps));
len[toggle] = opus_encode(enc, in, frame_size,
data[toggle], max_payload_bytes);
}
if(1)
{
opus_encoder_ctl(enc, OPUS_SET_BITRATE(32000));
enc_size = opus_encode(enc, in, frame_size, tmpBuffer,
max_payload_bytes);
if (enc_size < 0)
{
fprintf (stderr, "opus_encode() returned
%d\n",
enc_size);
return EXIT_FAILURE;
}
Thanks
Suresh
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.xiph.org/pipermail/opus/attachments/20170406/6866721a/attachment.html>
Opus is stateful. Do not use the same state for unrelated streams On 06/04/17 07:00 AM, Suresh t wrote:> HI, > > I'm trying to simulate an audio conference where each leg can be with a > different bit rate. This needs to encode the source PCM to to different > bit rates back to back and store and send respective encoded > frames/packet to the respective channel. For this I changed the > opus_demo as below. But the output of the second encoded frames is > completely garbled. > > Appreciate if anyone can suggest how to handle this case. > > if(1) > { > opus_encoder_ctl(enc, OPUS_SET_BITRATE(bitrate_bps)); > len[toggle] = opus_encode(enc, in, frame_size, > data[toggle], max_payload_bytes); > } > if(1) > { > opus_encoder_ctl(enc, OPUS_SET_BITRATE(32000)); > enc_size = opus_encode(enc, in, frame_size, > tmpBuffer, max_payload_bytes); > if (enc_size < 0) > { > fprintf (stderr, "opus_encode() returned > %d\n", enc_size); > return EXIT_FAILURE; > } > > Thanks > Suresh > > > _______________________________________________ > opus mailing list > opus at xiph.org > http://lists.xiph.org/mailman/listinfo/opus >