Fix bug: audible glitch toggling AC-3 pass-through

This commit is contained in:
Johns 2012-02-12 17:50:10 +01:00
parent 6df970ca9e
commit 24a065e5de
3 changed files with 9 additions and 8 deletions

View File

@ -1,6 +1,7 @@
User johns
Date:
Fix bug: audible glitch when switching AC-3 pass-through <-> none.
Fix bug: mpeg stills not displayed.
Detect audio stream type only after stream switch.
Detect more h264 streams with leading zeros.

3
Todo
View File

@ -34,8 +34,6 @@ video:
subtitle could be asyncron
reduce warnings after channel switch
grab image with hardware and better scaling support
suspendoutput didn't show logo or black pictures
(must detect video format to show image)
hard channel switch
OSD can only be shown after some stream could be shown
yaepghd changed position is lost on channel switch
@ -86,7 +84,6 @@ audio:
add pause support for replay pause
Mute should do a real mute and not only set volume to zero.
Starting suspended and muted, didn't register the mute.
switching stero/dolby produces klick sound
audio/alsa:
better downmix of >2 channels on 2 channel hardware

13
codec.c
View File

@ -605,6 +605,7 @@ struct _audio_decoder_
/// audio parser to support insane dvb streaks
AVCodecParserContext *AudioParser;
int PassthroughAC3; ///< current ac-3 pass-through
int SampleRate; ///< current stream sample rate
int Channels; ///< current stream channels
@ -621,6 +622,9 @@ static char CodecPassthroughAC3; ///< pass ac3 through
//static char CodecPassthroughDTS; ///< pass dts through (unsupported)
//static char CodecPassthroughMPA; ///< pass mpa through (unsupported)
#else
static const int CodecPassthroughAC3 = 0;
#endif
/**
@ -872,11 +876,13 @@ void CodecAudioDecode(AudioDecoder * audio_decoder, const AVPacket * avpkt)
AudioSetClock(dpkt->pts);
}
// FIXME: must first play remainings bytes, than change and play new.
if (audio_decoder->SampleRate != audio_ctx->sample_rate
if (audio_decoder->PassthroughAC3 != CodecPassthroughAC3
|| audio_decoder->SampleRate != audio_ctx->sample_rate
|| audio_decoder->Channels != audio_ctx->channels) {
int err;
int isAC3;
audio_decoder->PassthroughAC3 = CodecPassthroughAC3;
// FIXME: use swr_convert from swresample (only in ffmpeg!)
// FIXME: tell ac3 decoder to use downmix
if (audio_decoder->ReSample) {
@ -887,14 +893,11 @@ void CodecAudioDecode(AudioDecoder * audio_decoder, const AVPacket * avpkt)
audio_decoder->SampleRate = audio_ctx->sample_rate;
audio_decoder->HwSampleRate = audio_ctx->sample_rate;
audio_decoder->Channels = audio_ctx->channels;
#ifdef USE_PASSTHROUGH
// SPDIF/HDMI passthrough
if (CodecPassthroughAC3 && audio_ctx->codec_id == CODEC_ID_AC3) {
audio_decoder->HwChannels = 2;
isAC3 = 1;
} else
#endif
{
} else {
audio_decoder->HwChannels = audio_ctx->channels;
isAC3 = 0;
}