[prev in list] [next in list] [prev in thread] [next in thread]
List: helix-datatype-cvs
Subject: [Datatype-cvs] mdf/audio/dsp mdfauddecoder.cpp,1.13,1.14
From: jcroker () helixcommunity ! org
Date: 2012-04-30 12:44:36
[Download RAW message or body]
Update of /cvsroot/datatype/mdf/audio/dsp
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv22152
Modified Files:
mdfauddecoder.cpp
Log Message:
"Nokiasubmits this code under the terms of a commercial contribution agreement \
withReal Networks, and I am authorized to contribute this code under saidagreement."
Modifiedby: ext-basudev.achary@nokia.com
Reviewedby:girish.shetty@nokia.com
RCId: ou1cimx1#739014
Date: 27/04/2011
Project:symbian_client_apps
Synopsis: Crashoccurs when playing certain streaming link to the end
Overview:
Whenplaying the given link \
(http://10.48.2.56:443/WMTest/KennyRogers-LoveLiftedMe.wma?MSWMExt=.asf) from the \
NOKIA Browser, Helix iscrashing("MMFControllerProxyServer-762") when playing near \
theend,Based on the frame we are computing samples and For a particular frame \
withTimestamp=220356 and framesize= 6690 and the samples produced by theHWdecoder is \
110602, where as sample produced by SWDecoder is 4460.Because ofthis when PCM samples \
are being copied to HXAudioData, memcpy operationfails as sample produced value is \
more than maximum WMA decoded buffer size.
Fix:
Nowfrom the Helix side we are checking whether sampleproduced is greater thanMaximun \
decoded buffer size i.e 96000 and setting the value. After addingthis check there is \
no Crash from the Helix side.
Filesmodified & changes:
datatype\mdf\audio\dsp\mdfauddecoder.cpp
ImageSize and Heap Use impact: No major impact
ModuleRelease testing (STIF): Passed
Testcase(s) Added: No
Memoryleak check performed: Passed, No additional leaks introduced.
Platformsand Profiles Build Verified: helix-client-symbian-4
Platformsand Profiles Functionality verified: armv5
Branch:420Brizo and HEAD
Index: mdfauddecoder.cpp
===================================================================
RCS file: /cvsroot/datatype/mdf/audio/dsp/mdfauddecoder.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- mdfauddecoder.cpp 13 Oct 2010 18:40:36 -0000 1.13
+++ mdfauddecoder.cpp 30 Apr 2012 12:44:31 -0000 1.14
@@ -288,24 +288,25 @@
//
// IHXMDFAudioDecoder::Decode()
//
-HX_RESULT CHXMDFAudioDecoder::Decode
+HX_RESULT CHXMDFAudioDecoder::Decode
(
- const UCHAR* data,
- UINT32 nBytes,
- UINT32 &nBytesConsumed,
- INT16 *samplesOut,
- UINT32& nSamplesOut,
+ const UCHAR* data,
+ UINT32 nBytes,
+ UINT32 &nBytesConsumed,
+ INT16 *samplesOut,
+ UINT32& nSamplesOut,
HXBOOL eof
)
-{
- HXLOGL4(HXLOG_MDFA, "mdfdec::Decode < bn=%d b0=%x\n", nBytes, data[0]);
+{
+ HXLOGL4(HXLOG_MDFA, "mdfdec::Decode < bn=%d b0=%x\n", nBytes, data[0]);
+ UINT32 maxSamples = nSamplesOut;
if(eof)
{
m_pMDFDevice->SetStreamFinished(TRUE);
HXLOGL2(HXLOG_MDFA,"mdfdec::Decode .. Decoder Signal End Of Stream");
}
-
+
// --- ignore any frames prior to m_ulStartTime ---
if (m_ulNextFrameTime<m_ulStartTime)
{
@@ -314,7 +315,7 @@
HXLOGL4(HXLOG_MDFA, "mdfdec::Decode > IGNORE\n");
return HXR_IGNORE;
}
-
+
#ifdef HELIX_FEATURE_COMPRESSED_MEDIA_PIPELINE
if(((m_ulNextFrameTime - m_ulDeviceTime) > m_ulTargetAudioPushdown) && \
m_bReBufferRequestSent) {
@@ -323,7 +324,7 @@
((IHXStream*)m_pStream)->ReportRebufferStatus(1,1);
m_bReBufferRequestSent = FALSE;
}
-#endif //HELIX_FEATURE_COMPRESSED_MEDIA_PIPELINE
+#endif //HELIX_FEATURE_COMPRESSED_MEDIA_PIPELINE
// --- check for concealment ---
if(m_ulFramesToConceal > 0)
@@ -331,23 +332,23 @@
HXLOGL2(HXLOG_MDFA, "mdfdec::Decode .. CONCEAL\n");
m_ulFramesToConceal--;
UINT32 ulConcealed = m_pAudioFormat->m_uSamplesPerFrame;
-
+
// output silence for concealed samples
memset(samplesOut, 0, ulConcealed * sizeof(INT16));
// update the counters
nBytesConsumed = 0L;
nSamplesOut = ulConcealed;
-
- // indicate a concealed frame
+
+ // indicate a concealed frame
HXMDFAudioData* pAudioData = new HXMDFAudioData();
if(pAudioData)
{
- pAudioData->m_ulAudioTime = m_ulNextFrameTime;
+ pAudioData->m_ulAudioTime = m_ulNextFrameTime;
pAudioData->m_bConcealed = true;
pAudioData->m_pData = 0;
m_pMDFDevice->AddAudioData(pAudioData);
-
+
HXLOGL4(HXLOG_MDFA, "mdfdec::Decode > OK - CONCEAL\n");
return HXR_OK;
}
@@ -367,12 +368,12 @@
// --- create a buffer for encoded data ---
IHXBuffer* pBuffer = 0;
HX_RESULT theErr = m_pCommonClassFactory->CreateInstance(IID_IHXBuffer, \
(void**)&pBuffer);
- if (theErr != HXR_OK)
+ if (theErr != HXR_OK)
{
HXLOGL1(HXLOG_MDFA, "mdfdec::Decode > Bad. No mem for pBuffer %d\n", \
theErr); return HXR_OUTOFMEMORY;
}
-
+
// --- copy data into this HXBuffer ---
theErr = pBuffer->Set(data, nBytes);
if (theErr != HXR_OK)
@@ -380,18 +381,25 @@
HXLOGL4(HXLOG_MDFA, "mdfdec::Decode > Bad. No mem for data %d\n", theErr);
return HXR_OUTOFMEMORY;
}
-
+
// --- pass the data to dsp ---
pAudioData->m_pData = pBuffer;
pAudioData->m_ulAudioTime = m_ulNextFrameTime;
m_pMDFDevice->AddAudioData(pAudioData);
-
+
// --- return dummy data ---
nBytesConsumed = nBytes;
-
+
// For WMA this will be different from samples per frame
- nSamplesOut = m_pAudioFormat->GetSamplesPerFrame(m_ulNextFrameTime,m_ulLastFrameTime); \
-
+ nSamplesOut = m_pAudioFormat->GetSamplesPerFrame(m_ulNextFrameTime,m_ulLastFrameTime);
+ //Setting the samplesProduced to maximum allowed size i.e 96000 for dsp
+ if(nSamplesOut > maxSamples)
+ {
+ HXLOGL3(HXLOG_ASFF, "\tsamplesProduced is more than maximum allowed size \
(nSamplesOut=%lu,maxSamples=%lu)", + nSamplesOut, maxSamples);
+ nSamplesOut = maxSamples;
+ }
+
HXLOGL4(HXLOG_MDFA, "mdfdec::Decode > OK\n");
return HXR_OK;
}
@@ -403,18 +411,18 @@
HX_RESULT CHXMDFAudioDecoder::Conceal(UINT32 nDesiredSamples)
{
HXLOGL4(HXLOG_MDFA, "mdfdec:conceal < ");
-
+
// conceal only in increments of "max samples per frame"
// (desired samples should be at least 1 to conceal anything)
- m_ulFramesToConceal += (nDesiredSamples + m_pAudioFormat->m_uSamplesPerFrame - \
1) / m_pAudioFormat->m_uSamplesPerFrame; + m_ulFramesToConceal += \
(nDesiredSamples + m_pAudioFormat->m_uSamplesPerFrame - 1) / \
m_pAudioFormat->m_uSamplesPerFrame;
HXLOGL4(HXLOG_MDFA, "mdfdec:conceal > %lu", m_ulFramesToConceal);
-
+
return HXR_OK;
}
//
-// IHXAudioDecoder::GetNChannels()
+// IHXAudioDecoder::GetNChannels()
//
STDMETHODIMP CHXMDFAudioDecoder::GetNChannels(UINT32& nChannels) CONSTMETHOD
{
@@ -468,7 +476,7 @@
{
m_pAudioFormat->SetStartTime(ulStartTime);
}
-
+
return HXR_OK;
}
@@ -517,13 +525,13 @@
STDMETHODIMP CHXMDFAudioDecoder::GetClockSourceTime(REF(UINT32) rulTime)
{
HX_RESULT retVal = HXR_OK;
-
+
m_pMDFDevice->GetCurrentAudioTime(rulTime);
rulTime +=m_ulStartTime;
m_ulDeviceTime = rulTime;
HXLOGL4(HXLOG_MDFA, "CHXMDFAudioDecoder::GetClockSourceTime(ulTime=%ld)",
rulTime);
-
+
return retVal;
}
@@ -555,21 +563,21 @@
{
HX_RESULT retVal = HXR_OK;
HXLOGL4(HXLOG_MDFA, "CHXMDFAudioDecoder::StartStream()");
-
+
retVal = pStream->QueryInterface(IID_IHXStream, (void**)&m_pStream);
-
+
if (SUCCEEDED(retVal))
{
// Get interface to audio player
- retVal = pPlayer->QueryInterface(IID_IHXAudioPlayer,
+ retVal = pPlayer->QueryInterface(IID_IHXAudioPlayer,
(void**) &m_pAudioPlayer);
if (SUCCEEDED(retVal))
{
IHXClockSourceManager* pClockSourceManager = NULL;
-
- retVal = m_pAudioPlayer->QueryInterface(IID_IHXClockSourceManager,
+
+ retVal = m_pAudioPlayer->QueryInterface(IID_IHXClockSourceManager,
(void**) &m_pClockSourceManager);
-
+
if (SUCCEEDED(retVal))
{
retVal = m_pClockSourceManager->RegisterClockSource((IHXClockSource*)this);
@@ -628,15 +636,15 @@
#endif //HELIX_FEATURE_COMPRESSED_MEDIA_PIPELINE
//
-// Custom method:
+// Custom method:
//
HX_RESULT CHXMDFAudioDecoder::CreateAudioFormatByFourCC(const char* fourCC)
{
HXLOGL4(HXLOG_MDFA, "mdfdec:createFmt < %s", fourCC);
HX_RESULT hxr = HXR_OK;
-
+
if (fourCC == NULL) return HXR_FAIL;
-
+
if (strcmp("amrn", fourCC) == 0)
{
m_pAudioFormat = new HXMDFAudioAmrNB();
@@ -652,7 +660,7 @@
HXLOGL2(HXLOG_MDFA, "mdfdec:createFmt .. aac:%s", fourCC);
m_pAudioFormat = new HXMDFAudioAac();
}
- else
+ else
if((strcmp("WMA9", fourCC) == 0) || (strcmp("wmaA", fourCC) == 0))
{
HXLOGL2(HXLOG_MDFA, "mdfdec:createFmt .. wma:%s", fourCC);
@@ -672,26 +680,26 @@
}
else
if (strcmp("mp3d", fourCC) == 0)
- {
+ {
HXLOGL2(HXLOG_MDFA, "mdfdec:createFmt .. mp3:%s", fourCC);
m_pAudioFormat = new HXMDFAudioMP3();
-
+
}
- else
+ else
{
hxr = HXR_FAIL;
}
HXLOGL2(HXLOG_MDFA, "mdfdec:createFmt .. hxr=%d", hxr);
-
- if (m_pAudioFormat)
+
+ if (m_pAudioFormat)
{
strncpy((char*)m_pAudioFormat->m_fourCC, fourCC, 4);
}
- else
+ else
{
hxr = HXR_FAIL;
}
-
+
HXLOGL4(HXLOG_MDFA, "mdfdec:createFmt > hxr=%d", hxr);
return hxr;
}
_______________________________________________
Datatype-cvs mailing list
Datatype-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/datatype-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic