diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2012-12-04 23:13:46 +0400 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2012-12-05 00:17:43 +0400 |
commit | 512d849c24b3ae708fb15c86a047c56d2591ab46 (patch) | |
tree | 1b728c2b1502dbb0521bf9a6af1e7eeba15fe8f1 /src/opus_demo.c | |
parent | a5bd4409319614f166a83934baddceed7e6c58b4 (diff) |
Implements OPUS_GET_LAST_FRAME_DURATION decoder ctl()
Diffstat (limited to 'src/opus_demo.c')
-rw-r--r-- | src/opus_demo.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/opus_demo.c b/src/opus_demo.c index 1cb153a8..09b12a33 100644 --- a/src/opus_demo.c +++ b/src/opus_demo.c @@ -684,18 +684,22 @@ int main(int argc, char *argv[]) } else { int output_samples; lost = len[toggle]==0 || (packet_loss_perc>0 && rand()%100 < packet_loss_perc); + if (lost) + opus_decoder_ctl(dec, OPUS_GET_LAST_PACKET_DURATION(&output_samples)); + else + output_samples = max_frame_size; if( count >= use_inbandfec ) { /* delay by one packet when using in-band FEC */ if( use_inbandfec ) { if( lost_prev ) { /* attempt to decode with in-band FEC from next packet */ - output_samples = opus_decode(dec, lost ? NULL : data[toggle], len[toggle], out, max_frame_size, 1); + output_samples = opus_decode(dec, lost ? NULL : data[toggle], len[toggle], out, output_samples, 1); } else { /* regular decode */ - output_samples = opus_decode(dec, data[1-toggle], len[1-toggle], out, max_frame_size, 0); + output_samples = opus_decode(dec, data[1-toggle], len[1-toggle], out, output_samples, 0); } } else { - output_samples = opus_decode(dec, lost ? NULL : data[toggle], len[toggle], out, max_frame_size, 0); + output_samples = opus_decode(dec, lost ? NULL : data[toggle], len[toggle], out, output_samples, 0); } if (output_samples>0) { |