summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-09-21 14:25:29 +0200
committerwm4 <wm4@nowhere>2017-09-21 14:34:50 +0200
commit20f958c9775652c3213588c2a0824f5353276adc (patch)
tree52e552fb09995d874609a739a62c13ac0de807cd /audio
parentbfa9b628589068acdbb04d97f86051063e82fd94 (diff)
downloadmpv-20f958c9775652c3213588c2a0824f5353276adc.tar.bz2
mpv-20f958c9775652c3213588c2a0824f5353276adc.tar.xz
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).
Diffstat (limited to 'audio')
-rw-r--r--audio/aframe.c5
1 files changed, 5 insertions, 0 deletions
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