Mercurial > hg > svcore
comparison data/fileio/MP3FileReader.cpp @ 1401:cc62d7862203
Some bits and bobs to do with handling memory pressure
author | Chris Cannam |
---|---|
date | Mon, 06 Mar 2017 17:23:46 +0000 |
parents | b812df0351d9 |
children | aadfb395e933 |
comparison
equal
deleted
inserted
replaced
1400:d2ecf0acc3e2 | 1401:cc62d7862203 |
---|---|
99 | 99 |
100 try { | 100 try { |
101 // We need a mysterious MAD_BUFFER_GUARD (== 8) zero bytes at | 101 // We need a mysterious MAD_BUFFER_GUARD (== 8) zero bytes at |
102 // end of input, to ensure libmad decodes the last frame | 102 // end of input, to ensure libmad decodes the last frame |
103 // correctly. Otherwise the decoded audio is truncated. | 103 // correctly. Otherwise the decoded audio is truncated. |
104 SVDEBUG << "file size = " << m_fileSize << ", buffer guard = " << MAD_BUFFER_GUARD << endl; | |
104 m_fileBufferSize = m_fileSize + MAD_BUFFER_GUARD; | 105 m_fileBufferSize = m_fileSize + MAD_BUFFER_GUARD; |
105 m_fileBuffer = new unsigned char[m_fileBufferSize]; | 106 m_fileBuffer = new unsigned char[m_fileBufferSize]; |
106 memset(m_fileBuffer + m_fileSize, 0, MAD_BUFFER_GUARD); | 107 memset(m_fileBuffer + m_fileSize, 0, MAD_BUFFER_GUARD); |
107 } catch (...) { | 108 } catch (...) { |
108 m_error = QString("Out of memory"); | 109 m_error = QString("Out of memory"); |