Tuesday, July 01, 2008

No Time stamp has been set for this sample Error

I got the "No Time stamp has been set for this sample" while playing the 3gp file;
-----------------------------------------------------------------------------------
HRESULT FillBuffer()
{
HRESULT hr;
hr = GetMP4Sample (pSample);
if(SUCCEEDED(hr))
{
REFERENCE_TIME rtStart = 0, rtStop = 0;
hr = pSample->GetTime(&rtStart, &rtStop);
if(SUCCEEDED(hr))
{
wchar_t szMsg[MAX_PATH];
swprintf(szMsg,L"\n 0-vid,1- audio,TrackType = %d, Start = %ld, Stop : %ld",m_nTrakType,(LONG)rtStart,(LONG) rtStop);
OutputDebugString(szMsg);
}
}
return hr;

}



Solution:
===========
the above code displays the "No timestamp has been set for this sample " error;
Reason is
if GetTime() is failed, then that hr value will be returned from the
FillBuffer() fn; So I got this error; if I modified it as follows, then I wont get an error;

hr = GetMP4Sample (pSample);
if(SUCCEEDED(hr))
{
REFERENCE_TIME rtStart = 0, rtStop = 0;
HRESULT temphr = pSample->GetTime(&rtStart, &rtStop);
if(SUCCEEDED(temphr))
{
wchar_t szMsg[MAX_PATH];
swprintf(szMsg,L"\n 0-vid,1- audio,TrackType = %d, Start = %ld, Stop : %ld",m_nTrakType,(LONG)rtStart,(LONG) rtStop);
OutputDebugString(szMsg);
}
}

No comments: