Synopsis:
Changes to reset and remove audio stream from audio device when decoders
dynamically switch sample rate and Resampler is disabled.
Overview:
Some decoders may want to change sample rate dynamically i.e AAC SBR
decoder doubles the sample rate after implicitly detecting sbr payload.
If resampler is off this case is not handled and we hear no audio.
Now for this we remove the old stream from audio player and add a new
stream to the audio player.
Changes have been done to audio service to reset the player when stream
count reaches zero so that we would be able to set it with new sample rate.
Also when removing old stream we find it using IHXAudioStream pointer
instead of earlier IHXAudioStream3 pointer this is because we set
IHXAudioStream pointer in list when adding a stream.
A minor fix is also added to audio device on android to delete the
rollback buffer so that new rollback buffer can be created with sample
rate size.
Files Modified:
client/audiosvc/hxaudply.cpp
audio/device/platform/unix/audAndroid.cpp
datatype/common/audrend/audrend.cpp
Platforms and Profiles Build Verified:
BIF branch -> atlas 361
Target(s) -> android_all
Profile -> helix-client-android-surf_8x50
SYSTEM_ID -> android-donut-arm-qsd_8x50
Branch:
Atlas361
Files Attached:
Audrend.diff
audply.diff
audAnd.diff
Best Regards,
Gurpreet
Index: audrend.cpp
===================================================================
RCS file: /cvsroot/datatype/common/audrend/audrend.cpp,v
retrieving revision 1.44.8.2
diff -u -r1.44.8.2 audrend.cpp
--- audrend.cpp 6 Feb 2009 04:54:21 -0000 1.44.8.2
+++ audrend.cpp 9 Mar 2010 10:27:46 -0000
@@ -1657,6 +1657,15 @@
retVal = pStream2->RemoveDryNotification(pDryNot);
if (SUCCEEDED(retVal))
{
+#ifndef HELIX_FEATURE_RESAMPLER
+ IHXAudioPlayer2* pPlayer = NULL;
+ m_pAudioPlayer->QueryInterface(IID_IHXAudioPlayer2,
(void**) &pPlayer);
+ if(pPlayer)
+ {
+ pPlayer->ManageAudioStreams(1,
&m_ppAudioStream[ulOldStreamIndex], AUD_PLYR_STR_REMOVE, NULL);
+ HX_RELEASE(pPlayer);
+ }
+#endif
// Init the new stream
retVal = InitAudioStream(m_pHeader,
&m_ppAudioStream[ulNewStreamIndex]);
}
Index: hxaudply.cpp
===================================================================
RCS file: /cvsroot/client/audiosvc/hxaudply.cpp,v
retrieving revision 1.56.2.3.2.1
diff -u -r1.56.2.3.2.1 hxaudply.cpp
--- hxaudply.cpp 23 Nov 2009 18:51:23 -0000 1.56.2.3.2.1
+++ hxaudply.cpp 9 Mar 2010 10:31:38 -0000
@@ -1067,7 +1066,7 @@
break;
case AUD_PLYR_STR_REMOVE:
{
- LISTPOSITION pos = m_pStreamList->Find(pAudioStream);
+ LISTPOSITION pos =
m_pStreamList->Find(pAudioStreamArray[uIdx]);
if (pos)
{
m_pStreamList->RemoveAt(pos);
@@ -1077,6 +1076,11 @@
bSessionRewindNeededForStream =
!pAudioStream->IsRewound();
pAudioStream->Stop();
HX_RELEASE(pAudioStream);
+ if(!m_pStreamList->GetCount())
+ {
+ ResetPlayer();
+ m_Owner->ResetSession();
+ }
}
break;
default:
Index: device/platform/unix/audAndroid.cpp
===================================================================
RCS file: /cvsroot/audio/device/platform/unix/audAndroid.cpp,v
retrieving revision 1.1.2.6
diff -u -r1.1.2.6 audAndroid.cpp
--- device/platform/unix/audAndroid.cpp 20 Jul 2009 23:28:37 -0000 1.1.2.6
+++ device/platform/unix/audAndroid.cpp 4 Mar 2010 06:42:19 -0000
@@ -311,14 +316,17 @@
HX_RESULT CAudioOutAndroid::_CloseAudio()
{
HX_RESULT retCode = RA_AOE_NOERR;
-
+ m_wState=RA_AOS_CLOSED;
+ HX_VECTOR_DELETE(m_pRollbackBuffer);
+ m_ulDeviceBufferSize = 0;
m_wLastError = retCode;
return m_wLastError;
}
_______________________________________________
Audio-dev mailing list
[email protected]
http://lists.helixcommunity.org/mailman/listinfo/audio-dev