[Datatype-cvs] mdf/audio/dsp mdfauddecoder.h,1.3,1.4
anugrahk at helixcommunity.org anugrahk at helixcommunity.orgUpdate of /cvsroot/datatype/mdf/audio/dsp In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv11767 Modified Files: mdfauddecoder.h Log Message: Nokia submits this code under the terms of a commercial contribution agreement with RealNetworks, and I am authorized to contribute this code under said agreement." Modified by: ext-anugrah.2.kashari at nokia.com Reviewed by: Rathinasamy Rajesh ext Sheldon Fu [sfu at real.com] TSW Id: EZLU-83T9YY Date: 04/28/2010 Project: SymbianMmf_wm Synopsis: AppCert-WIN7-Device can not play WMV video with H264 conent Overview: WMA audio stream is decoded as a block. Number of samples produced from each audio block need not be constant. When using SW codec, CWMAudioDecoder::Decode() (called in CWMAudioFormat::DecodeAudioData() ) returns exact number of samples produced after decoding. This value is used to keep track of decoded output time. This is later used to make decision on whether buffering is required or not. In case of DSP codec CHXMDFAudioDecoder::Decode()returns a dummy value for number of samples produced which is equal to HXMDFAudioFormat::m_uSamplesPerFrame. This is incorrect as number of samples produced per audio block is not constant. In this defect this value was much lower than the actual value. Therefore, helix goes into buffering mode and loading happens at regular intervals. Number of samples produced is required by CWMAudioFormat to keep track of current decode time. This value need not be accurate but should be close enough to actual decode time. Number of samples produces cannot be known without decoding. In case of DSP codec CHXMDFAudioDecoder::Decode() does not actually decode audio but simply stores data which is later sent in CMDFDevSound::BufferToBeFilled() call. CWMAudioFormat module is not aware of this and it updates current decode time according to the values retuned. Therefore, changes are needed in CHXMDFAudioDecoder::Decode() to ensure that total accumulated time is close to decode time. Fix: 1. Number of samples produced can also be calculated using difference of presentation times of two consecutive audio blocks. For first audio block number of samples produce is approximated to HXMDFAudioFormat::m_uSamplesPerFrame. From next block onwards samples produced is equal to presentation time difference between the last audio block and current audio block (which is append to the buffer to be sent to DSP). This gives a better approximation for total output time than fixed m_uSamplesPerFrame. These calculations are done GetSamplesPerFrame() (a new function added to HXMDFAudioFormat) 2. In WMA audio format 0x161, wSamplesPerBlock (defined in union Samples (type WORD) of WAVEFORMATEXTENSIBLE) is present if and only if wBitsPerSample==0. If value of Samples is zero it means that wSamplesPerBlock is not constant. So it is safer to initialized m_uSamplesPerFrame with BlockAlign*channels( also done in SW codec). This value is used once and rest of calculation are based on the timestamp of audio blocks. Files modified & changes: /datatype/mdf/audio/dsp/mdfaudfmt.cpp /datatype/mdf/audio/dsp/mdfaudfmt.h /datatype/mdf/audio/dsp/mdfauddecoder.h /datatype/mdf/audio/dsp/mdfauddecoder.cpp Image Size and Heap Use impact: No major impact Module Release testing (STIF) : Passed Test case(s) Added : Yes WMV specfic Memory leak check performed : Passed, No additional leaks introduced. Platforms and Profiles Build Verified: helix-client-s60-52-mmf-mdf-dsp Platforms and Profiles Functionality verified: armv5 Branch: 210CayS, 420Bizo and HEAD Index: mdfauddecoder.h =================================================================== RCS file: /cvsroot/datatype/mdf/audio/dsp/mdfauddecoder.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- mdfauddecoder.h 9 Feb 2010 16:49:54 -0000 1.3 +++ mdfauddecoder.h 29 Apr 2010 11:35:44 -0000 1.4 @@ -133,6 +133,8 @@ // timing UINT32 m_ulStartTime; UINT32 m_ulNextFrameTime; + UINT32 m_ulLastFrameTime; + };