Hi Sheldon,
Thanks for review.
I have removed the additional logic of resseting the player, as its not
needed.
Thanks for noticing that.
Rollback buffer is already deleted in imp_close of CAudioOutUnix.
The changes in audAndroid.cpp is needed because on android we don't use
imp_open/imp_close to open/close the audio device. imp_open is just a
dummy call.
TLC opens the audio device and replaces that in audio service.
So when audio service wants to reset it, it finds that its a replaced
device, there fore ignores this.
Also in AudOutUnix, when we check format, we are suppose to open and
close a new device but instead we use the same device created by TLC,
this is because of limitation by android.
Please find updated diffs attached.
Thanks,
Gurpreet
On 3/9/2010 8:37 PM, Sheldon Fu wrote:
rollback buffer belongs to the base class, CAudioOutUnix. The
cleanup/reset belongs there too.
In hxaudply.cpp, there is already a block of code (just below your
change) to handle the special case that the last stream is removed
from the list. The change, if any, should go in there I think. The
list search fix though should be in the first block and is a good catch.
I don't think the additional logic of resetting the audio player and
audio session when last stream is removed is correct in general. It
may work for your single audio-only playback case but for more
complicated cases (e.g. 20s video and 10s audio starts at the same
time) Audio player is supposed to continue providing fake timeline
after all its audio streams are gone (this is evidential from the
logic handling AUD_PLYR_STR_REMOVE and (0 ==
m_pStreamList->GetCount()), namely the ResumeFakeTimeLine() call). If
you reset the player and session, likely you'll lose the timeline
continuity.
fxd
Gurpreet wrote:
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: 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;
}
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 10 Mar 2010 06:38:42 -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);
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]);
}
_______________________________________________
Audio-dev mailing list
[email protected]
http://lists.helixcommunity.org/mailman/listinfo/audio-dev