From 20f958c9775652c3213588c2a0824f5353276adc Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 21 Sep 2017 14:25:29 +0200 Subject: audio: fix resampling Let's blame FFmpeg for just overwriting the samplerate in av_frame_copy_props(). Can't fully hide my own brain damage though, since mp_aframe_config_copy() expected that the rate is copied (that function also copies format and channel layout). --- audio/aframe.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'audio') diff --git a/audio/aframe.c b/audio/aframe.c index 4168f92124..0a8ec38c93 100644 --- a/audio/aframe.c +++ b/audio/aframe.c @@ -169,6 +169,7 @@ void mp_aframe_config_copy(struct mp_aframe *dst, struct mp_aframe *src) mp_aframe_copy_attributes(dst, src); + dst->av_frame->sample_rate = src->av_frame->sample_rate; dst->av_frame->format = src->av_frame->format; dst->av_frame->channel_layout = src->av_frame->channel_layout; #if LIBAVUTIL_VERSION_MICRO >= 100 @@ -183,8 +184,12 @@ void mp_aframe_copy_attributes(struct mp_aframe *dst, struct mp_aframe *src) { dst->pts = src->pts; + int rate = dst->av_frame->sample_rate; + if (av_frame_copy_props(dst->av_frame, src->av_frame) < 0) abort(); + + dst->av_frame->sample_rate = rate; } // Return whether a and b use the same physical audio format. Extra metadata -- cgit v1.2.3