]> git.sesse.net Git - ffmpeg/blob - libavcodec/opusdec.c
Merge commit '34e2ce5dde073244ccb2b62f930e96fe612690f7'
[ffmpeg] / libavcodec / opusdec.c
1 /*
2  * Opus decoder
3  * Copyright (c) 2012 Andrew D'Addesio
4  * Copyright (c) 2013-2014 Mozilla Corporation
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22
23 /**
24  * @file
25  * Opus decoder
26  * @author Andrew D'Addesio, Anton Khirnov
27  *
28  * Codec homepage: http://opus-codec.org/
29  * Specification: http://tools.ietf.org/html/rfc6716
30  * Ogg Opus specification: https://tools.ietf.org/html/draft-ietf-codec-oggopus-03
31  *
32  * Ogg-contained .opus files can be produced with opus-tools:
33  * http://git.xiph.org/?p=opus-tools.git
34  */
35
36 #include <stdint.h>
37
38 #include "libavutil/attributes.h"
39 #include "libavutil/audio_fifo.h"
40 #include "libavutil/channel_layout.h"
41 #include "libavutil/opt.h"
42
43 #include "libswresample/swresample.h"
44
45 #include "avcodec.h"
46 #include "celp_filters.h"
47 #include "fft.h"
48 #include "get_bits.h"
49 #include "internal.h"
50 #include "mathops.h"
51 #include "opus.h"
52
53 static const uint16_t silk_frame_duration_ms[16] = {
54     10, 20, 40, 60,
55     10, 20, 40, 60,
56     10, 20, 40, 60,
57     10, 20,
58     10, 20,
59 };
60
61 /* number of samples of silence to feed to the resampler
62  * at the beginning */
63 static const int silk_resample_delay[] = {
64     4, 8, 11, 11, 11
65 };
66
67 static const uint8_t celt_band_end[] = { 13, 17, 17, 19, 21 };
68
69 static int get_silk_samplerate(int config)
70 {
71     if (config < 4)
72         return 8000;
73     else if (config < 8)
74         return 12000;
75     return 16000;
76 }
77
78 /**
79  * Range decoder
80  */
81 static int opus_rc_init(OpusRangeCoder *rc, const uint8_t *data, int size)
82 {
83     int ret = init_get_bits8(&rc->gb, data, size);
84     if (ret < 0)
85         return ret;
86
87     rc->range = 128;
88     rc->value = 127 - get_bits(&rc->gb, 7);
89     rc->total_read_bits = 9;
90     opus_rc_normalize(rc);
91
92     return 0;
93 }
94
95 static void opus_raw_init(OpusRangeCoder *rc, const uint8_t *rightend,
96                           unsigned int bytes)
97 {
98     rc->rb.position = rightend;
99     rc->rb.bytes    = bytes;
100     rc->rb.cachelen = 0;
101     rc->rb.cacheval = 0;
102 }
103
104 static void opus_fade(float *out,
105                       const float *in1, const float *in2,
106                       const float *window, int len)
107 {
108     int i;
109     for (i = 0; i < len; i++)
110         out[i] = in2[i] * window[i] + in1[i] * (1.0 - window[i]);
111 }
112
113 static int opus_flush_resample(OpusStreamContext *s, int nb_samples)
114 {
115     int celt_size = av_audio_fifo_size(s->celt_delay);
116     int ret, i;
117     ret = swr_convert(s->swr,
118                       (uint8_t**)s->out, nb_samples,
119                       NULL, 0);
120     if (ret < 0)
121         return ret;
122     else if (ret != nb_samples) {
123         av_log(s->avctx, AV_LOG_ERROR, "Wrong number of flushed samples: %d\n",
124                ret);
125         return AVERROR_BUG;
126     }
127
128     if (celt_size) {
129         if (celt_size != nb_samples) {
130             av_log(s->avctx, AV_LOG_ERROR, "Wrong number of CELT delay samples.\n");
131             return AVERROR_BUG;
132         }
133         av_audio_fifo_read(s->celt_delay, (void**)s->celt_output, nb_samples);
134         for (i = 0; i < s->output_channels; i++) {
135             s->fdsp->vector_fmac_scalar(s->out[i],
136                                         s->celt_output[i], 1.0,
137                                         nb_samples);
138         }
139     }
140
141     if (s->redundancy_idx) {
142         for (i = 0; i < s->output_channels; i++)
143             opus_fade(s->out[i], s->out[i],
144                       s->redundancy_output[i] + 120 + s->redundancy_idx,
145                       ff_celt_window2 + s->redundancy_idx, 120 - s->redundancy_idx);
146         s->redundancy_idx = 0;
147     }
148
149     s->out[0]   += nb_samples;
150     s->out[1]   += nb_samples;
151     s->out_size -= nb_samples * sizeof(float);
152
153     return 0;
154 }
155
156 static int opus_init_resample(OpusStreamContext *s)
157 {
158     static const float delay[16] = { 0.0 };
159     const uint8_t *delayptr[2] = { (uint8_t*)delay, (uint8_t*)delay };
160     int ret;
161
162     av_opt_set_int(s->swr, "in_sample_rate", s->silk_samplerate, 0);
163     ret = swr_init(s->swr);
164     if (ret < 0) {
165         av_log(s->avctx, AV_LOG_ERROR, "Error opening the resampler.\n");
166         return ret;
167     }
168
169     ret = swr_convert(s->swr,
170                       NULL, 0,
171                       delayptr, silk_resample_delay[s->packet.bandwidth]);
172     if (ret < 0) {
173         av_log(s->avctx, AV_LOG_ERROR,
174                "Error feeding initial silence to the resampler.\n");
175         return ret;
176     }
177
178     return 0;
179 }
180
181 static int opus_decode_redundancy(OpusStreamContext *s, const uint8_t *data, int size)
182 {
183     int ret;
184     enum OpusBandwidth bw = s->packet.bandwidth;
185
186     if (s->packet.mode == OPUS_MODE_SILK &&
187         bw == OPUS_BANDWIDTH_MEDIUMBAND)
188         bw = OPUS_BANDWIDTH_WIDEBAND;
189
190     ret = opus_rc_init(&s->redundancy_rc, data, size);
191     if (ret < 0)
192         goto fail;
193     opus_raw_init(&s->redundancy_rc, data + size, size);
194
195     ret = ff_celt_decode_frame(s->celt, &s->redundancy_rc,
196                                s->redundancy_output,
197                                s->packet.stereo + 1, 240,
198                                0, celt_band_end[s->packet.bandwidth]);
199     if (ret < 0)
200         goto fail;
201
202     return 0;
203 fail:
204     av_log(s->avctx, AV_LOG_ERROR, "Error decoding the redundancy frame.\n");
205     return ret;
206 }
207
208 static int opus_decode_frame(OpusStreamContext *s, const uint8_t *data, int size)
209 {
210     int samples    = s->packet.frame_duration;
211     int redundancy = 0;
212     int redundancy_size, redundancy_pos;
213     int ret, i, consumed;
214     int delayed_samples = s->delayed_samples;
215
216     ret = opus_rc_init(&s->rc, data, size);
217     if (ret < 0)
218         return ret;
219
220     /* decode the silk frame */
221     if (s->packet.mode == OPUS_MODE_SILK || s->packet.mode == OPUS_MODE_HYBRID) {
222         if (!swr_is_initialized(s->swr)) {
223             ret = opus_init_resample(s);
224             if (ret < 0)
225                 return ret;
226         }
227
228         samples = ff_silk_decode_superframe(s->silk, &s->rc, s->silk_output,
229                                             FFMIN(s->packet.bandwidth, OPUS_BANDWIDTH_WIDEBAND),
230                                             s->packet.stereo + 1,
231                                             silk_frame_duration_ms[s->packet.config]);
232         if (samples < 0) {
233             av_log(s->avctx, AV_LOG_ERROR, "Error decoding a SILK frame.\n");
234             return samples;
235         }
236         samples = swr_convert(s->swr,
237                               (uint8_t**)s->out, s->packet.frame_duration,
238                               (const uint8_t**)s->silk_output, samples);
239         if (samples < 0) {
240             av_log(s->avctx, AV_LOG_ERROR, "Error resampling SILK data.\n");
241             return samples;
242         }
243         s->delayed_samples += s->packet.frame_duration - samples;
244     } else
245         ff_silk_flush(s->silk);
246
247     // decode redundancy information
248     consumed = opus_rc_tell(&s->rc);
249     if (s->packet.mode == OPUS_MODE_HYBRID && consumed + 37 <= size * 8)
250         redundancy = opus_rc_p2model(&s->rc, 12);
251     else if (s->packet.mode == OPUS_MODE_SILK && consumed + 17 <= size * 8)
252         redundancy = 1;
253
254     if (redundancy) {
255         redundancy_pos = opus_rc_p2model(&s->rc, 1);
256
257         if (s->packet.mode == OPUS_MODE_HYBRID)
258             redundancy_size = opus_rc_unimodel(&s->rc, 256) + 2;
259         else
260             redundancy_size = size - (consumed + 7) / 8;
261         size -= redundancy_size;
262         if (size < 0) {
263             av_log(s->avctx, AV_LOG_ERROR, "Invalid redundancy frame size.\n");
264             return AVERROR_INVALIDDATA;
265         }
266
267         if (redundancy_pos) {
268             ret = opus_decode_redundancy(s, data + size, redundancy_size);
269             if (ret < 0)
270                 return ret;
271             ff_celt_flush(s->celt);
272         }
273     }
274
275     /* decode the CELT frame */
276     if (s->packet.mode == OPUS_MODE_CELT || s->packet.mode == OPUS_MODE_HYBRID) {
277         float *out_tmp[2] = { s->out[0], s->out[1] };
278         float **dst = (s->packet.mode == OPUS_MODE_CELT) ?
279                       out_tmp : s->celt_output;
280         int celt_output_samples = samples;
281         int delay_samples = av_audio_fifo_size(s->celt_delay);
282
283         if (delay_samples) {
284             if (s->packet.mode == OPUS_MODE_HYBRID) {
285                 av_audio_fifo_read(s->celt_delay, (void**)s->celt_output, delay_samples);
286
287                 for (i = 0; i < s->output_channels; i++) {
288                     s->fdsp->vector_fmac_scalar(out_tmp[i], s->celt_output[i], 1.0,
289                                                 delay_samples);
290                     out_tmp[i] += delay_samples;
291                 }
292                 celt_output_samples -= delay_samples;
293             } else {
294                 av_log(s->avctx, AV_LOG_WARNING,
295                        "Spurious CELT delay samples present.\n");
296                 av_audio_fifo_drain(s->celt_delay, delay_samples);
297                 if (s->avctx->err_recognition & AV_EF_EXPLODE)
298                     return AVERROR_BUG;
299             }
300         }
301
302         opus_raw_init(&s->rc, data + size, size);
303
304         ret = ff_celt_decode_frame(s->celt, &s->rc, dst,
305                                    s->packet.stereo + 1,
306                                    s->packet.frame_duration,
307                                    (s->packet.mode == OPUS_MODE_HYBRID) ? 17 : 0,
308                                    celt_band_end[s->packet.bandwidth]);
309         if (ret < 0)
310             return ret;
311
312         if (s->packet.mode == OPUS_MODE_HYBRID) {
313             int celt_delay = s->packet.frame_duration - celt_output_samples;
314             void *delaybuf[2] = { s->celt_output[0] + celt_output_samples,
315                                   s->celt_output[1] + celt_output_samples };
316
317             for (i = 0; i < s->output_channels; i++) {
318                 s->fdsp->vector_fmac_scalar(out_tmp[i],
319                                             s->celt_output[i], 1.0,
320                                             celt_output_samples);
321             }
322
323             ret = av_audio_fifo_write(s->celt_delay, delaybuf, celt_delay);
324             if (ret < 0)
325                 return ret;
326         }
327     } else
328         ff_celt_flush(s->celt);
329
330     if (s->redundancy_idx) {
331         for (i = 0; i < s->output_channels; i++)
332             opus_fade(s->out[i], s->out[i],
333                       s->redundancy_output[i] + 120 + s->redundancy_idx,
334                       ff_celt_window2 + s->redundancy_idx, 120 - s->redundancy_idx);
335         s->redundancy_idx = 0;
336     }
337     if (redundancy) {
338         if (!redundancy_pos) {
339             ff_celt_flush(s->celt);
340             ret = opus_decode_redundancy(s, data + size, redundancy_size);
341             if (ret < 0)
342                 return ret;
343
344             for (i = 0; i < s->output_channels; i++) {
345                 opus_fade(s->out[i] + samples - 120 + delayed_samples,
346                           s->out[i] + samples - 120 + delayed_samples,
347                           s->redundancy_output[i] + 120,
348                           ff_celt_window2, 120 - delayed_samples);
349                 if (delayed_samples)
350                     s->redundancy_idx = 120 - delayed_samples;
351             }
352         } else {
353             for (i = 0; i < s->output_channels; i++) {
354                 memcpy(s->out[i] + delayed_samples, s->redundancy_output[i], 120 * sizeof(float));
355                 opus_fade(s->out[i] + 120 + delayed_samples,
356                           s->redundancy_output[i] + 120,
357                           s->out[i] + 120 + delayed_samples,
358                           ff_celt_window2, 120);
359             }
360         }
361     }
362
363     return samples;
364 }
365
366 static int opus_decode_subpacket(OpusStreamContext *s,
367                                  const uint8_t *buf, int buf_size,
368                                  int nb_samples)
369 {
370     int output_samples = 0;
371     int flush_needed   = 0;
372     int i, j, ret;
373
374     /* check if we need to flush the resampler */
375     if (swr_is_initialized(s->swr)) {
376         if (buf) {
377             int64_t cur_samplerate;
378             av_opt_get_int(s->swr, "in_sample_rate", 0, &cur_samplerate);
379             flush_needed = (s->packet.mode == OPUS_MODE_CELT) || (cur_samplerate != s->silk_samplerate);
380         } else {
381             flush_needed = !!s->delayed_samples;
382         }
383     }
384
385     if (!buf && !flush_needed)
386         return 0;
387
388     /* use dummy output buffers if the channel is not mapped to anything */
389     if (!s->out[0] ||
390         (s->output_channels == 2 && !s->out[1])) {
391         av_fast_malloc(&s->out_dummy, &s->out_dummy_allocated_size, s->out_size);
392         if (!s->out_dummy)
393             return AVERROR(ENOMEM);
394         if (!s->out[0])
395             s->out[0] = s->out_dummy;
396         if (!s->out[1])
397             s->out[1] = s->out_dummy;
398     }
399
400     /* flush the resampler if necessary */
401     if (flush_needed) {
402         ret = opus_flush_resample(s, s->delayed_samples);
403         if (ret < 0) {
404             av_log(s->avctx, AV_LOG_ERROR, "Error flushing the resampler.\n");
405             return ret;
406         }
407         swr_close(s->swr);
408         output_samples += s->delayed_samples;
409         s->delayed_samples = 0;
410
411         if (!buf)
412             goto finish;
413     }
414
415     /* decode all the frames in the packet */
416     for (i = 0; i < s->packet.frame_count; i++) {
417         int size = s->packet.frame_size[i];
418         int samples = opus_decode_frame(s, buf + s->packet.frame_offset[i], size);
419
420         if (samples < 0) {
421             av_log(s->avctx, AV_LOG_ERROR, "Error decoding an Opus frame.\n");
422             if (s->avctx->err_recognition & AV_EF_EXPLODE)
423                 return samples;
424
425             for (j = 0; j < s->output_channels; j++)
426                 memset(s->out[j], 0, s->packet.frame_duration * sizeof(float));
427             samples = s->packet.frame_duration;
428         }
429         output_samples += samples;
430
431         for (j = 0; j < s->output_channels; j++)
432             s->out[j] += samples;
433         s->out_size -= samples * sizeof(float);
434     }
435
436 finish:
437     s->out[0] = s->out[1] = NULL;
438     s->out_size = 0;
439
440     return output_samples;
441 }
442
443 static int opus_decode_packet(AVCodecContext *avctx, void *data,
444                               int *got_frame_ptr, AVPacket *avpkt)
445 {
446     OpusContext *c      = avctx->priv_data;
447     AVFrame *frame      = data;
448     const uint8_t *buf  = avpkt->data;
449     int buf_size        = avpkt->size;
450     int coded_samples   = 0;
451     int decoded_samples = 0;
452     int i, ret;
453
454     /* decode the header of the first sub-packet to find out the sample count */
455     if (buf) {
456         OpusPacket *pkt = &c->streams[0].packet;
457         ret = ff_opus_parse_packet(pkt, buf, buf_size, c->nb_streams > 1);
458         if (ret < 0) {
459             av_log(avctx, AV_LOG_ERROR, "Error parsing the packet header.\n");
460             return ret;
461         }
462         coded_samples += pkt->frame_count * pkt->frame_duration;
463         c->streams[0].silk_samplerate = get_silk_samplerate(pkt->config);
464     }
465
466     frame->nb_samples = coded_samples + c->streams[0].delayed_samples;
467
468     /* no input or buffered data => nothing to do */
469     if (!frame->nb_samples) {
470         *got_frame_ptr = 0;
471         return 0;
472     }
473
474     /* setup the data buffers */
475     ret = ff_get_buffer(avctx, frame, 0);
476     if (ret < 0) {
477         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
478         return ret;
479     }
480     frame->nb_samples = 0;
481
482     for (i = 0; i < avctx->channels; i++) {
483         ChannelMap *map = &c->channel_maps[i];
484         if (!map->copy)
485             c->streams[map->stream_idx].out[map->channel_idx] = (float*)frame->extended_data[i];
486     }
487
488     for (i = 0; i < c->nb_streams; i++)
489         c->streams[i].out_size = frame->linesize[0];
490
491     /* decode each sub-packet */
492     for (i = 0; i < c->nb_streams; i++) {
493         OpusStreamContext *s = &c->streams[i];
494
495         if (i && buf) {
496             ret = ff_opus_parse_packet(&s->packet, buf, buf_size, i != c->nb_streams - 1);
497             if (ret < 0) {
498                 av_log(avctx, AV_LOG_ERROR, "Error parsing the packet header.\n");
499                 return ret;
500             }
501             s->silk_samplerate = get_silk_samplerate(s->packet.config);
502         }
503
504         ret = opus_decode_subpacket(&c->streams[i], buf,
505                                     s->packet.data_size, coded_samples);
506         if (ret < 0)
507             return ret;
508         if (decoded_samples && ret != decoded_samples) {
509             av_log(avctx, AV_LOG_ERROR, "Different numbers of decoded samples "
510                    "in a multi-channel stream\n");
511             return AVERROR_INVALIDDATA;
512         }
513         decoded_samples = ret;
514         buf      += s->packet.packet_size;
515         buf_size -= s->packet.packet_size;
516     }
517
518     for (i = 0; i < avctx->channels; i++) {
519         ChannelMap *map = &c->channel_maps[i];
520
521         /* handle copied channels */
522         if (map->copy) {
523             memcpy(frame->extended_data[i],
524                    frame->extended_data[map->copy_idx],
525                    frame->linesize[0]);
526         } else if (map->silence) {
527             memset(frame->extended_data[i], 0, frame->linesize[0]);
528         }
529
530         if (c->gain_i) {
531             c->fdsp.vector_fmul_scalar((float*)frame->extended_data[i],
532                                        (float*)frame->extended_data[i],
533                                        c->gain, FFALIGN(decoded_samples, 8));
534         }
535     }
536
537     frame->nb_samples = decoded_samples;
538     *got_frame_ptr    = !!decoded_samples;
539
540     return avpkt->size;
541 }
542
543 static av_cold void opus_decode_flush(AVCodecContext *ctx)
544 {
545     OpusContext *c = ctx->priv_data;
546     int i;
547
548     for (i = 0; i < c->nb_streams; i++) {
549         OpusStreamContext *s = &c->streams[i];
550
551         memset(&s->packet, 0, sizeof(s->packet));
552         s->delayed_samples = 0;
553
554         if (s->celt_delay)
555             av_audio_fifo_drain(s->celt_delay, av_audio_fifo_size(s->celt_delay));
556         swr_close(s->swr);
557
558         ff_silk_flush(s->silk);
559         ff_celt_flush(s->celt);
560     }
561 }
562
563 static av_cold int opus_decode_close(AVCodecContext *avctx)
564 {
565     OpusContext *c = avctx->priv_data;
566     int i;
567
568     for (i = 0; i < c->nb_streams; i++) {
569         OpusStreamContext *s = &c->streams[i];
570
571         ff_silk_free(&s->silk);
572         ff_celt_free(&s->celt);
573
574         av_freep(&s->out_dummy);
575         s->out_dummy_allocated_size = 0;
576
577         av_audio_fifo_free(s->celt_delay);
578         swr_free(&s->swr);
579     }
580
581     av_freep(&c->streams);
582     c->nb_streams = 0;
583
584     av_freep(&c->channel_maps);
585
586     return 0;
587 }
588
589 static av_cold int opus_decode_init(AVCodecContext *avctx)
590 {
591     OpusContext *c = avctx->priv_data;
592     int ret, i, j;
593
594     avctx->sample_fmt  = AV_SAMPLE_FMT_FLTP;
595     avctx->sample_rate = 48000;
596
597     avpriv_float_dsp_init(&c->fdsp, 0);
598
599     /* find out the channel configuration */
600     ret = ff_opus_parse_extradata(avctx, c);
601     if (ret < 0)
602         return ret;
603
604     /* allocate and init each independent decoder */
605     c->streams = av_mallocz_array(c->nb_streams, sizeof(*c->streams));
606     if (!c->streams) {
607         c->nb_streams = 0;
608         ret = AVERROR(ENOMEM);
609         goto fail;
610     }
611
612     for (i = 0; i < c->nb_streams; i++) {
613         OpusStreamContext *s = &c->streams[i];
614         uint64_t layout;
615
616         s->output_channels = (i < c->nb_stereo_streams) ? 2 : 1;
617
618         s->avctx = avctx;
619
620         for (j = 0; j < s->output_channels; j++) {
621             s->silk_output[j]       = s->silk_buf[j];
622             s->celt_output[j]       = s->celt_buf[j];
623             s->redundancy_output[j] = s->redundancy_buf[j];
624         }
625
626         s->fdsp = &c->fdsp;
627
628         s->swr =swr_alloc();
629         if (!s->swr)
630             goto fail;
631
632         layout = (s->output_channels == 1) ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO;
633         av_opt_set_int(s->swr, "in_sample_fmt",      avctx->sample_fmt,  0);
634         av_opt_set_int(s->swr, "out_sample_fmt",     avctx->sample_fmt,  0);
635         av_opt_set_int(s->swr, "in_channel_layout",  layout,             0);
636         av_opt_set_int(s->swr, "out_channel_layout", layout,             0);
637         av_opt_set_int(s->swr, "out_sample_rate",    avctx->sample_rate, 0);
638         av_opt_set_int(s->swr, "filter_size",        16,                 0);
639
640         ret = ff_silk_init(avctx, &s->silk, s->output_channels);
641         if (ret < 0)
642             goto fail;
643
644         ret = ff_celt_init(avctx, &s->celt, s->output_channels);
645         if (ret < 0)
646             goto fail;
647
648         s->celt_delay = av_audio_fifo_alloc(avctx->sample_fmt,
649                                             s->output_channels, 1024);
650         if (!s->celt_delay) {
651             ret = AVERROR(ENOMEM);
652             goto fail;
653         }
654     }
655
656     return 0;
657 fail:
658     opus_decode_close(avctx);
659     return ret;
660 }
661
662 AVCodec ff_opus_decoder = {
663     .name            = "opus",
664     .long_name       = NULL_IF_CONFIG_SMALL("Opus"),
665     .type            = AVMEDIA_TYPE_AUDIO,
666     .id              = AV_CODEC_ID_OPUS,
667     .priv_data_size  = sizeof(OpusContext),
668     .init            = opus_decode_init,
669     .close           = opus_decode_close,
670     .decode          = opus_decode_packet,
671     .flush           = opus_decode_flush,
672     .capabilities    = CODEC_CAP_DR1 | CODEC_CAP_DELAY,
673 };