diff options
author | Vinay Vaka <vvaka@codeaurora.org> | 2012-05-04 15:36:08 +0530 |
---|---|---|
committer | Giulio Cervera <giulio.cervera@gmail.com> | 2012-06-06 15:27:07 +0200 |
commit | 6638822c1121c14519118db0368c20aa59d0100f (patch) | |
tree | a9484b75dcdf309ec3cd555aaf4537f8416e7666 /media | |
parent | 3e887699b9c6875f6a0940a51976ea8e7a2a7cb7 (diff) | |
download | frameworks_base-6638822c1121c14519118db0368c20aa59d0100f.zip frameworks_base-6638822c1121c14519118db0368c20aa59d0100f.tar.gz frameworks_base-6638822c1121c14519118db0368c20aa59d0100f.tar.bz2 |
libstagefirght: Fix for music skip in LPA A2DP case
-Portion of music repeating twice after disconnecting and
connecting A2DP
-When A2DP disconnects, timeplayed will be updated with the data
sent to A2DP. But Decoder thread already has some decoded data
which is not sent to A2DP.Here if A2DP connects back decoder
thread calls fillbuffer with the time played position.
Because of this fillbuffer getting some of the decoded data
which is already decoded earlier.
-To address this issue when the A2DP disconnect and connect happens
clearing all the buffer which are there in response queue.
CRs-Fixed: 356571
(cherry picked from commit b52619bdc157646278fce30ceb84057370f030c1)
Conflicts:
media/libstagefright/LPAPlayer.cpp
Change-Id: I98578d4470021757625ad1203682da4bb45cd055
Diffstat (limited to 'media')
-rw-r--r-- | media/libstagefright/LPAPlayer.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/media/libstagefright/LPAPlayer.cpp b/media/libstagefright/LPAPlayer.cpp index 86a8419..752667d 100644 --- a/media/libstagefright/LPAPlayer.cpp +++ b/media/libstagefright/LPAPlayer.cpp @@ -70,6 +70,7 @@ mObserver(observer), AudioPlayer(audioSink,observer) {
LOGV("LPAPlayer::LPAPlayer() ctor");
a2dpDisconnectPause = false;
+ a2dpResumeAfterReConnect = false;
mSeeked = false;
objectsAlive++;
timeStarted = 0;
@@ -507,6 +508,7 @@ void LPAPlayer::resume() { mReachedEOS = false;
mSeekTimeUs = timePlayed;
a2dpDisconnectPause = false;
+ a2dpResumeAfterReConnect = true;
mAudioSink->start();
pthread_cond_signal(&decoder_cv);
pthread_cond_signal(&a2dp_cv);
@@ -1149,6 +1151,19 @@ void LPAPlayer::A2DPThreadEntry() { //Seeked: break out of loop, flush old buffers and write new buffers
LOGV("@_@bytes To write1:%d",bytesToWrite);
}
+ /* Incase of A2DP disconnect and connects back flushing all the buffers
+ which are decoded by fillbuffer and not sent to A2DP */
+ if( a2dpResumeAfterReConnect == true )
+ {
+ a2dpResumeAfterReConnect = false;
+ while (!memBuffersResponseQueue.empty()) {
+ List<BuffersAllocated>::iterator it = memBuffersResponseQueue.begin();
+ BuffersAllocated buf = *it;
+ memBuffersRequestQueue.push_back(buf);
+ memBuffersResponseQueue.erase(it);
+ }
+ break;
+ }
if (mSeeked) {
LOGV("Seeking A2DP Playback");
break;
@@ -1504,7 +1519,14 @@ realTimeOffset = 0; return mPositionTimeMediaUs + realTimeOffset;
*/
- LOGV("getMediaTimeUs() isPaused %d timeStarted %d timePlayed %d", isPaused, timeStarted, timePlayed);
+ /* When A2DP connects in the middile timePlayed will be updated to the
+ number of buffer played from zero which will be non-zero value
+ incase if user does not perform any seek operation timePlayed will be
+ willbe non-zero and which will effect the seekbar after playback
+ to resolve this sending zero when the EOS reached and A2DP enable */
+ if( isPaused && bIsA2DPEnabled && mReachedEOS )
+ return 0;
+ LOGV("getMediaTimeUs() isPaused %d timeStarted %lld timePlayed %lld", isPaused, timeStarted, timePlayed);
if (isPaused || timeStarted == 0) {
return timePlayed;
} else {
|