Skip to content

Commit b335a5a

Browse files
James DongAndroid (Google) Code Review
authored andcommitted
Merge "When Camera is launched by media recording framework, stagefright controls the stop and release."
2 parents a81fe3b + 8312278 commit b335a5a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

media/libstagefright/CameraSource.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,12 @@ status_t CameraSource::stop() {
635635
mStarted = false;
636636
mFrameAvailableCondition.signal();
637637

638+
int64_t token;
639+
bool isTokenValid = false;
640+
if (mCamera != 0) {
641+
token = IPCThreadState::self()->clearCallingIdentity();
642+
isTokenValid = true;
643+
}
638644
releaseQueuedFrames();
639645
while (!mFramesBeingEncoded.empty()) {
640646
if (NO_ERROR !=
@@ -645,6 +651,9 @@ status_t CameraSource::stop() {
645651
}
646652
stopCameraRecording();
647653
releaseCamera();
654+
if (isTokenValid) {
655+
IPCThreadState::self()->restoreCallingIdentity(token);
656+
}
648657

649658
if (mCollectStats) {
650659
LOGI("Frames received/encoded/dropped: %d/%d/%d in %lld us",

0 commit comments

Comments
 (0)