From 23e303859aa93572f00b17e3b2bc0a552ad7c348 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 11 Jul 2013 19:15:09 +0200 Subject: mplayer: fix incorrect audio sync after format changes This is not directly related to the handling of format changes itself, but playing audio normally after the change. This was broken: the output byte rate was not recalculated, so audio-video sync was simply broken. Fix this by calculating the byte rate on the fly, instead of storing it in sh_audio. Format changes are relatively common (switches between stereo and 5.1 in TV recordings), so this fixes a somewhat critical bug. --- audio/decode/dec_audio.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'audio/decode') diff --git a/audio/decode/dec_audio.c b/audio/decode/dec_audio.c index 8c80a0b119..d6b57dd2b5 100644 --- a/audio/decode/dec_audio.c +++ b/audio/decode/dec_audio.c @@ -84,9 +84,6 @@ static int init_audio_codec(sh_audio_t *sh_audio, const char *decoder) return 0; } - if (!sh_audio->o_bps) - sh_audio->o_bps = sh_audio->channels.num * sh_audio->samplerate - * sh_audio->samplesize; return 1; } @@ -150,12 +147,9 @@ int init_best_audio_codec(sh_audio_t *sh_audio, char *audio_decoders) mp_msg(MSGT_DECAUDIO, MSGL_INFO, "Selected audio codec: %s\n", sh_audio->gsh->decoder_desc); mp_msg(MSGT_DECAUDIO, MSGL_V, - "AUDIO: %d Hz, %d ch, %s, %3.1f kbit/%3.2f%% (ratio: %d->%d)\n", + "AUDIO: %d Hz, %d ch, %s\n", sh_audio->samplerate, sh_audio->channels.num, - af_fmt2str_short(sh_audio->sample_format), - sh_audio->i_bps * 8 * 0.001, - ((float) sh_audio->i_bps / sh_audio->o_bps) * 100.0, - sh_audio->i_bps, sh_audio->o_bps); + af_fmt2str_short(sh_audio->sample_format)); mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_BITRATE=%d\nID_AUDIO_RATE=%d\n" "ID_AUDIO_NCH=%d\n", sh_audio->i_bps * 8, sh_audio->samplerate, sh_audio->channels.num); -- cgit v1.2.3