diff options
author | Jean-Marc Valin <jmvalin@amazon.com> | 2023-05-09 00:59:40 +0300 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@amazon.com> | 2023-06-16 20:01:30 +0300 |
commit | b446e96ad1ff1aad301940cb6cdb7455c83e6cfb (patch) | |
tree | dc22c81b04ea17f5eed6b9cf834351c7151034ec /src/opus_demo.c | |
parent | 41bf2a0ac60eb03d8d762f33da1b94339fa4ba39 (diff) |
Fix extensions padding for CBR
Diffstat (limited to 'src/opus_demo.c')
-rw-r--r-- | src/opus_demo.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/opus_demo.c b/src/opus_demo.c index 54249b5f..294dd858 100644 --- a/src/opus_demo.c +++ b/src/opus_demo.c @@ -712,6 +712,11 @@ int main(int argc, char *argv[]) stop = 1; } len = opus_encode(enc, in, frame_size, data, max_payload_bytes); + if (len < 0) + { + fprintf (stderr, "opus_encode() returned %d\n", len); + goto failure; + } nb_encoded = opus_packet_get_samples_per_frame(data, sampling_rate)*opus_packet_get_nb_frames(data, len); remaining = frame_size-nb_encoded; for(i=0;i<remaining*channels;i++) @@ -732,11 +737,6 @@ int main(int argc, char *argv[]) opus_encoder_ctl(enc, OPUS_SET_BITRATE(bitrate_bps)); } opus_encoder_ctl(enc, OPUS_GET_FINAL_RANGE(&enc_final_range)); - if (len < 0) - { - fprintf (stderr, "opus_encode() returned %d\n", len); - goto failure; - } curr_mode_count += frame_size; if (curr_mode_count > mode_switch_time && curr_mode < nb_modes_in_list-1) { |