mirror of https://github.com/mpv-player/mpv
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).
This commit is contained in:
parent
bfa9b62858
commit
20f958c977
|
@ -169,6 +169,7 @@ void mp_aframe_config_copy(struct mp_aframe *dst, struct mp_aframe *src)
|
||||||
|
|
||||||
mp_aframe_copy_attributes(dst, 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->format = src->av_frame->format;
|
||||||
dst->av_frame->channel_layout = src->av_frame->channel_layout;
|
dst->av_frame->channel_layout = src->av_frame->channel_layout;
|
||||||
#if LIBAVUTIL_VERSION_MICRO >= 100
|
#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;
|
dst->pts = src->pts;
|
||||||
|
|
||||||
|
int rate = dst->av_frame->sample_rate;
|
||||||
|
|
||||||
if (av_frame_copy_props(dst->av_frame, src->av_frame) < 0)
|
if (av_frame_copy_props(dst->av_frame, src->av_frame) < 0)
|
||||||
abort();
|
abort();
|
||||||
|
|
||||||
|
dst->av_frame->sample_rate = rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return whether a and b use the same physical audio format. Extra metadata
|
// Return whether a and b use the same physical audio format. Extra metadata
|
||||||
|
|
Loading…
Reference in New Issue