MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / opus_init_resample

Function opus_init_resample

libavcodec/opus/dec.c:192–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190}
191
192static int opus_init_resample(OpusStreamContext *s)
193{
194 static const float delay[16] = { 0.0 };
195 const uint8_t *delayptr[2] = { (uint8_t*)delay, (uint8_t*)delay };
196 int ret;
197
198 av_opt_set_int(s->swr, "in_sample_rate", s->silk_samplerate, 0);
199 ret = swr_init(s->swr);
200 if (ret < 0) {
201 av_log(s->avctx, AV_LOG_ERROR, "Error opening the resampler.\n");
202 return ret;
203 }
204
205 ret = swr_convert(s->swr,
206 NULL, 0,
207 delayptr, silk_resample_delay[s->packet.bandwidth]);
208 if (ret < 0) {
209 av_log(s->avctx, AV_LOG_ERROR,
210 "Error feeding initial silence to the resampler.\n");
211 return ret;
212 }
213
214 return 0;
215}
216
217static int opus_decode_redundancy(OpusStreamContext *s, const uint8_t *data, int size)
218{

Callers 1

opus_decode_frameFunction · 0.85

Calls 4

av_opt_set_intFunction · 0.85
swr_initFunction · 0.85
av_logFunction · 0.85
swr_convertFunction · 0.85

Tested by

no test coverage detected