【修改说明】:fix swresample

Signed-off-by: Atrotro <wanganzhouhh@163.com>
This commit is contained in:
Atrotro
2025-01-09 23:24:37 +08:00
parent 08c9925c59
commit 001c945827
2 changed files with 32 additions and 0 deletions
+8
View File
@@ -230,6 +230,14 @@ int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len
ctx->simd_f(out->ch+ch, (const uint8_t **)in->ch+ch, off * (out->planar ? 1 :out->ch_count));
}
}else{
#ifdef OHOS_OPT_COMPAT
for (int ch_i = 0; ch_i < ctx->channels; ch_i++) {
if (!in->ch[ch_i]) {
av_log(NULL, AV_LOG_ERROR, "in->ch[%d] is NULL\n", ch_i);
return AVERROR(EINVAL);
}
}
#endif
ctx->simd_f(out->ch, (const uint8_t **)in->ch, off);
}
}
+24
View File
@@ -687,7 +687,15 @@ static int swr_convert_internal(struct SwrContext *s, AudioData *out, int out_co
if(s->full_convert){
av_assert0(!s->resample);
#ifdef OHOS_OPT_COMPAT
ret = swri_audio_convert(s->full_convert, out, in, in_count);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "full_convert swri_audio_convert failed\n");
return ret;
}
#else
swri_audio_convert(s->full_convert, out, in, in_count);
#endif
return out_count;
}
@@ -738,7 +746,15 @@ static int swr_convert_internal(struct SwrContext *s, AudioData *out, int out_co
}
if(in != postin){
#ifdef OHOS_OPT_COMPAT
ret = swri_audio_convert(s->in_convert, postin, in, in_count);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "swri_audio_convert failed\n");
return ret;
}
#else
swri_audio_convert(s->in_convert, postin, in, in_count);
#endif
}
if(s->resample_first){
@@ -804,7 +820,15 @@ static int swr_convert_internal(struct SwrContext *s, AudioData *out, int out_co
s->dither.noise_pos += out_count;
}
//FIXME packed doesn't need more than 1 chan here!
#ifdef OHOS_OPT_COMPAT
ret = swri_audio_convert(s->out_convert, out, conv_src, out_count);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "swri_audio_convert failed\n");
return ret;
}
#else
swri_audio_convert(s->out_convert, out, conv_src, out_count);
#endif
}
return out_count;
}