OSDN Git Service

Automated import from //branches/donutburger/...@141711,141711
authorAndreas Huber <>
Wed, 25 Mar 2009 03:47:19 +0000 (20:47 -0700)
committerThe Android Open Source Project <initial-contribution@android.com>
Wed, 25 Mar 2009 03:47:19 +0000 (20:47 -0700)
camera/libcameraservice/CameraService.cpp
media/libmedia/mediaplayer.cpp

index 6a6a811..7e5fdbe 100644 (file)
@@ -492,6 +492,7 @@ status_t CameraService::Client::startPreview()
 status_t CameraService::Client::startRecording()
 {
     if (mMediaPlayerBeep.get() != NULL) {
+        mMediaPlayerBeep->seekTo(0);
         mMediaPlayerBeep->start();
     }
     return startCameraMode(CAMERA_RECORDING_MODE);
@@ -533,6 +534,7 @@ void CameraService::Client::stopRecording()
     }
 
     if (mMediaPlayerBeep.get() != NULL) {
+        mMediaPlayerBeep->seekTo(0);
         mMediaPlayerBeep->start();
     }
     mHardware->stopRecording();
@@ -733,6 +735,7 @@ void CameraService::Client::shutterCallback(void *user)
 
     // Play shutter sound.
     if (client->mMediaPlayerClick.get() != NULL) {
+        client->mMediaPlayerClick->seekTo(0);
         client->mMediaPlayerClick->start();
     }
 
index 5841922..809316a 100644 (file)
@@ -416,8 +416,12 @@ status_t MediaPlayer::seekTo_l(int msec)
 
 status_t MediaPlayer::seekTo(int msec)
 {
+    mLockThreadId = getThreadId();
     Mutex::Autolock _l(mLock);
-    return seekTo_l(msec);
+    status_t result = seekTo_l(msec);
+    mLockThreadId = 0;
+
+    return result;
 }
 
 status_t MediaPlayer::reset()
@@ -501,8 +505,9 @@ void MediaPlayer::notify(int msg, int ext1, int ext2)
     // this will deadlock.
     // 
     // The threadId hack below works around this for the care of prepare
-    // within the same process.
-
+    // and seekTo within the same process.
+    // FIXME: Remember, this is a hack, it's not even a hack that is applied
+    // consistently for all use-cases, this needs to be revisited.
      if (mLockThreadId != getThreadId()) {
         mLock.lock();
         locked = true;