]> git.sesse.net Git - ffmpeg/commitdiff
lavc/amrwbdec: Do not ignore NO_DATA frames.
authorCarl Eugen Hoyos <ceffmpeg@gmail.com>
Tue, 29 Jan 2019 21:46:37 +0000 (22:46 +0100)
committerCarl Eugen Hoyos <ceffmpeg@gmail.com>
Sat, 4 Apr 2020 23:55:34 +0000 (01:55 +0200)
Fixes the actual output duration of the sample in ticket #7113.

libavcodec/amrwbdata.h
libavcodec/amrwbdec.c

index 8a8cbfdddf24b0127454ffaff8ea0c3e1eef945e..95c0aaa37b13328d1b12f53da3e85095f6f31c3a 100644 (file)
@@ -1884,7 +1884,7 @@ static const float lpf_7_coef[31] = { // low pass, 7kHz cutoff
 /** Core frame sizes in each mode */
 static const uint16_t cf_sizes_wb[] = {
     132, 177, 253, 285, 317, 365, 397, 461, 477,
-    40 /// SID/comfort noise frame
+    40, 0, 0, 0, 0, 0, 0
 };
 
 #endif /* AVCODEC_AMRWBDATA_H */
index 47fe7eb55e1882e1f381caf007dd80de69fc8fd7..b488a5d3c7e22293ee2cfe20cf15dc00e90039a2 100644 (file)
@@ -1119,12 +1119,19 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data,
     buf_out = (float *)frame->data[0];
 
     header_size      = decode_mime_header(ctx, buf);
+    expected_fr_size = ((cf_sizes_wb[ctx->fr_cur_mode] + 7) >> 3) + 1;
+
+    if (ctx->fr_cur_mode == NO_DATA) {
+        for (i = 0; i < frame->nb_samples; i++)
+            buf_out[i] = 0.f;
+        *got_frame_ptr = 1;
+        return expected_fr_size;
+    }
     if (ctx->fr_cur_mode > MODE_SID) {
         av_log(avctx, AV_LOG_ERROR,
                "Invalid mode %d\n", ctx->fr_cur_mode);
         return AVERROR_INVALIDDATA;
     }
-    expected_fr_size = ((cf_sizes_wb[ctx->fr_cur_mode] + 7) >> 3) + 1;
 
     if (buf_size < expected_fr_size) {
         av_log(avctx, AV_LOG_ERROR,