Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

DVDAudioCodecPcm: Do not use AVCODEC_MAX_AUDIO_FRAME_SIZE since it is…

… gone in FFmpeg 2.0 and dynamically allocate buffers as needed.
  • Loading branch information...
commit 95f0fa3779b6d89c30e8a56ae07d50e6de5f5425 1 parent d603014
Alexis Ballier aballier authored
14 xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPcm.cpp
View
@@ -116,13 +116,15 @@ CDVDAudioCodecPcm::CDVDAudioCodecPcm() : CDVDAudioCodec()
m_codecID = AV_CODEC_ID_NONE;
m_iOutputChannels = 0;
- memset(m_decodedData, 0, sizeof(m_decodedData));
+ m_decodedData = NULL;
+ m_decodedDataBufSize = 0;
memset(table, 0, sizeof(table));
}
CDVDAudioCodecPcm::~CDVDAudioCodecPcm()
{
Dispose();
+ delete m_decodedData;
}
bool CDVDAudioCodecPcm::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options)
@@ -172,8 +174,14 @@ int CDVDAudioCodecPcm::Decode(uint8_t* pData, int iSize)
src = pData;
int buf_size = iSize;
- if (iSize > AVCODEC_MAX_AUDIO_FRAME_SIZE / 2)
- iSize = AVCODEC_MAX_AUDIO_FRAME_SIZE / 2;
+ if (iSize > m_decodedDataBufSize)
+ {
+ delete m_decodedData;
+ samples = m_decodedData = new short[iSize];
+ if(!m_decodedData)
+ return -1;
+ m_decodedDataBufSize = iSize;
+ }
switch (m_codecID)
{
3  xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPcm.h
View
@@ -41,7 +41,8 @@ class CDVDAudioCodecPcm : public CDVDAudioCodec
protected:
virtual void SetDefault();
- short m_decodedData[131072]; // could be a bit to big
+ short* m_decodedData;
+ int m_decodedDataBufSize;
int m_decodedDataSize;
AVCodecID m_codecID;
Please sign in to comment.
Something went wrong with that request. Please try again.