mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Src/AdvancedAudioPlayController.cpp
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Src/AdvancedAudioPlayController.cpp Fri May 14 18:19:45 2010 -0500
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Src/AdvancedAudioPlayController.cpp Fri May 28 19:26:28 2010 -0500
@@ -986,11 +986,6 @@
{
DP0(_L("CAdvancedAudioPlayController::RemoveDataSinkL"));
- if (!iDataSink)
- {
- User::Leave(KErrNotReady);
- }
-
if (iDataSink != &aDataSink)
{
User::Leave(KErrArgument);
@@ -1000,9 +995,12 @@
{
User::Leave(KErrNotReady);
}
-
- iDataSink->SinkStopL(); // should always stop source before logoff
- iDataSink->SinkThreadLogoff();
+
+ if (iDataSink)
+ {
+ iDataSink->SinkStopL(); // should always stop source before logoff
+ iDataSink->SinkThreadLogoff();
+ }
// dereference Decoder from Utility before deleting AudioOutput (which took ownership of decoder)
if (iAudioUtility)
@@ -1010,8 +1008,8 @@
iAudioUtility->DeReferenceDecoder();
}
- delete iAudioOutput;
- iAudioOutput = NULL;
+ delete iAudioOutput;
+ iAudioOutput = NULL;
iDataSink = NULL;
iDecoderExists = EFalse;
}
@@ -1025,7 +1023,12 @@
DP0(_L("CAdvancedAudioPlayController::ResetL"));
RemoveDataSourceL(*iDataSource);
- RemoveDataSinkL(*iDataSink);
+
+ if (iDataSink)
+ {
+ DP0(_L("CAdvancedAudioPlayController::ResetL, calling RemoveDataSinkL"));
+ RemoveDataSinkL(*iDataSink);
+ }
}
// -----------------------------------------------------------------------------
@@ -1349,6 +1352,21 @@
{// we got preempted during a seek
// we're already seeking to a position. When we get there we'll come here again, but handle it below
DP0(_L("CAdvancedAudioPlayController::DoPauseL got a preemption during seek"));
+
+ // if we are seeking, we need to flush the devsound buffers regardless of loop play
+ DP0(_L("CAdvancedAudioPlayController::DoPauseL AudioOutput->StopL()"));
+ iAudioOutput->StopL();
+
+ if (iPlayingForInitPos)
+ {
+ iState = EInitialized;
+ }
+ else
+ {
+ iState = EPaused;
+ }
+ iPlayingForPauseSeek = EFalse;
+ iPlayingForInitPos = EFalse;
return;
}
@@ -1907,7 +1925,7 @@
}
else
{
- // This is needed for non-seekable sources as DoRepeat() calls DoInitialize in this case
+ // This is needed for non-seekable sources as DoRepeatL() calls DoInitialize in this case
// this resets the source to read from 0 and sets the iState to EInitializing.
// BufferFilled will not read the header again, change state to EInitialized and seek to the iInitPosition.
// The next BufferFilled will come here, where we will continue playback from byte position 0
@@ -2409,20 +2427,20 @@
DP0(_L("CAdvancedAudioPlayController::LastBufferSent End"));
}
-void CAdvancedAudioPlayController::DoRepeat()
+void CAdvancedAudioPlayController::DoRepeatL()
{
- DP0(_L("CAdvancedAudioPlayController::DoRepeat Begin"));
+ DP0(_L("CAdvancedAudioPlayController::DoRepeatL Begin"));
// save the current position, this will be used to calculate the position in loop play when
// client calls for PositionL() or Pause() operations
// TODO: need to check this position when loop play is going on in a play window
iSavedTimePositionInMicroSecs = iAudioOutput->CalculateAudioOutputPositionL();
- DP1(_L("CAdvancedAudioPlayController::DoRepeat iSavedTimePositionInMicroSecs[%u]"), iSavedTimePositionInMicroSecs);
+ DP1(_L("CAdvancedAudioPlayController::DoRepeatL iSavedTimePositionInMicroSecs[%u]"), iSavedTimePositionInMicroSecs);
if ((!iRepeatForever) && (iCurrentRepeatCount < iRepeatCount))
{
iCurrentRepeatCount++;
}
- DP1(_L("CAdvancedAudioPlayController::DoRepeat Number of times played till now = %d"), iCurrentRepeatCount);
+ DP1(_L("CAdvancedAudioPlayController::DoRepeatL Number of times played till now = %d"), iCurrentRepeatCount);
if (iSourceIsTimeSeekable || iSourceIsPosSeekable)
{ // For seekable source
@@ -2431,25 +2449,25 @@
// SetPlayWindow(iPlayWindowStartPosition, iPlayWindowEndPosition);
if (iPlayWindowStartPosition > 0)
{
- DP1(_L("CAdvancedAudioPlayController::DoRepeat SetPositionL[%d]ms"), I64LOW(iPlayWindowStartPosition.Int64()/1000));
+ DP1(_L("CAdvancedAudioPlayController::DoRepeatL SetPositionL[%d]ms"), I64LOW(iPlayWindowStartPosition.Int64()/1000));
SetPositionL(iPlayWindowStartPosition);
}
else
{
- DP0(_L("CAdvancedAudioPlayController::DoRepeat SetPositionL(0)"));
+ DP0(_L("CAdvancedAudioPlayController::DoRepeatL SetPositionL(0)"));
SetPositionL(0);
}
// Register for PlayWindow end position as the FrameTable has set its playwindowendpostime to zero
if (iPlayWindowEndPosition > 0)
{
- DP1(_L("CAdvancedAudioPlayController::DoRepeat iAudioUtility->SetPlayWindowEndTimeMs(%d)"), I64LOW(iPlayWindowEndPosition.Int64()/1000));
+ DP1(_L("CAdvancedAudioPlayController::DoRepeatL iAudioUtility->SetPlayWindowEndTimeMs(%d)"), I64LOW(iPlayWindowEndPosition.Int64()/1000));
iAudioUtility->SetPlayWindowEndTimeMs(iPlayWindowEndPosition.Int64() / 1000);
}
}
else
{ // For non-seekable source
// Stop and start playback
- DP0(_L("CAdvancedAudioPlayController::DoRepeat Non-Seekable source."));
+ DP0(_L("CAdvancedAudioPlayController::DoRepeatL Non-Seekable source."));
iAudioOutput->StopL(EFalse);
iDataSourceAdapter->SourceStopL(); // clear the buffers in the source before seeking and priming it
DoInitializeL();
@@ -2457,13 +2475,19 @@
// and the current position is adjusted to be placed after the header.
iReadHeader = ETrue;
}
- DP0(_L("CAdvancedAudioPlayController::DoRepeat End") );
+ DP0(_L("CAdvancedAudioPlayController::DoRepeatL End") );
}
EXPORT_C void CAdvancedAudioPlayController::TrailingSilenceTimerComplete()
{
DP0(_L("CAdvancedAudioPlayController::TrailingSilenceTimerComplete "));
- DoRepeat();
+
+ TRAPD(err,DoRepeatL()); //Fix for Bug ECWG-84WE9J
+ DP1(_L("CAdvancedAudioPlayController::TrailingSilenceTimerComplete: DoRepeatL [%d]"), err);
+ if(err)
+ {
+ SendEventToClient(TMMFEvent(KMMFEventCategoryPlaybackComplete,err));
+ }
}
EXPORT_C TInt CAdvancedAudioPlayController::GetCodecConfigData(RArray<TInt>& aCodecConfigData)