Removed gcc 4.6 warnings.

avcodec_flush_buffers crash fix.
This commit is contained in:
Johns 2012-06-22 19:28:48 +02:00
parent 2c5a14ae4a
commit a2311748ca

14
codec.c
View File

@ -585,8 +585,10 @@ void CodecVideoDecode(VideoDecoder * decoder, const AVPacket * avpkt)
*/ */
void CodecVideoFlushBuffers(VideoDecoder * decoder) void CodecVideoFlushBuffers(VideoDecoder * decoder)
{ {
if (decoder->VideoCtx) {
avcodec_flush_buffers(decoder->VideoCtx); avcodec_flush_buffers(decoder->VideoCtx);
} }
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Audio // Audio
@ -908,7 +910,7 @@ static void CodecAudioSetClock(AudioDecoder * audio_decoder, int64_t pts)
audio_decoder->LastDelay = delay; audio_decoder->LastDelay = delay;
audio_decoder->Drift = 0; audio_decoder->Drift = 0;
audio_decoder->DriftFrac = 0; audio_decoder->DriftFrac = 0;
Debug(3, "codec/audio: inital delay %zd ms\n", delay / 90); Debug(3, "codec/audio: inital delay %" PRId64 "ms\n", delay / 90);
return; return;
} }
// collect over some time // collect over some time
@ -932,9 +934,10 @@ static void CodecAudioSetClock(AudioDecoder * audio_decoder, int64_t pts)
audio_decoder->LastDelay = delay; audio_decoder->LastDelay = delay;
if (0) { if (0) {
Debug(3, "codec/audio: interval P:%5zdms T:%5zdms D:%4zdms %f %d\n", Debug(3,
pts_diff / 90, tim_diff / (1000 * 1000), delay / 90, drift / 90.0, "codec/audio: interval P:%5zdms T:%5" PRId64 "ms D:%4" PRId64
audio_decoder->DriftCorr); "ms %f %d\n", pts_diff / 90, tim_diff / (1000 * 1000), delay / 90,
drift / 90.0, audio_decoder->DriftCorr);
} }
// underruns and av_resample have the same time :((( // underruns and av_resample have the same time :(((
if (abs(drift) > 10 * 90) { if (abs(drift) > 10 * 90) {
@ -942,6 +945,9 @@ static void CodecAudioSetClock(AudioDecoder * audio_decoder, int64_t pts)
Debug(3, "codec/audio: drift(%6d) %3dms reset\n", Debug(3, "codec/audio: drift(%6d) %3dms reset\n",
audio_decoder->DriftCorr, drift / 90); audio_decoder->DriftCorr, drift / 90);
audio_decoder->LastDelay = 0; audio_decoder->LastDelay = 0;
#ifdef DEBUG
corr = 0; // keep gcc happy
#endif
} else { } else {
drift += audio_decoder->Drift; drift += audio_decoder->Drift;