From 201bdb4a7b8de9fb03fbe3304b2b572d8db2790f Mon Sep 17 00:00:00 2001 From: scop Date: Sat, 27 Aug 2005 08:59:00 +0000 Subject: Fix crash on audio sync buffer push timeouts (Jon Burgess). --- HISTORY | 1 + dxr3audiodecoder.c | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/HISTORY b/HISTORY index 5226eb7..9be1223 100644 --- a/HISTORY +++ b/HISTORY @@ -301,3 +301,4 @@ NOTE: I havent found time to include all of the languages, will be done in pre2 - use dxr3 hardware dvd playback functions in spudecoder (Christian Gmeiner) - don't abort with lpcm frames containing an odd number of bytes, drop the frame instead (Ville Skyttä) +- fix crash on audio sync buffer push timeouts (Jon Burgess) diff --git a/dxr3audiodecoder.c b/dxr3audiodecoder.c index f742375..20345bd 100644 --- a/dxr3audiodecoder.c +++ b/dxr3audiodecoder.c @@ -166,8 +166,12 @@ void cDxr3AudioDecoder::Decode(const uint8_t* buf, int length, uint32_t pts, { cFixedLengthFrame* pTempFrame = aBuf.Push(pcmbuf, out_size, pts); - pTempFrame->SetChannelCount(channels); - pTempFrame->SetDataRate(rate); + if (pTempFrame) + { + // TODO: should we break out of the loop on push timeout? + pTempFrame->SetChannelCount(channels); + pTempFrame->SetDataRate(rate); + } } length -= len; buf += len; @@ -241,9 +245,11 @@ void cDxr3AudioDecoder::DecodeLpcm(const uint8_t* buf, int length, cFixedLengthFrame* pTempFrame = aBuf.Push(pFrame, length - LPCM_HEADER_LENGTH, pts); - pTempFrame->SetChannelCount(1); - pTempFrame->SetDataRate(speed); - + if (pTempFrame) + { + pTempFrame->SetChannelCount(1); + pTempFrame->SetDataRate(speed); + } delete[] pFrame; } } -- cgit v1.2.3