mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
Bug 1022705 - allow StopRecordingImpl() to be called from any thread, r=jesup
This commit is contained in:
parent
7d954e43ff
commit
0dfa16ea76
@ -7,7 +7,6 @@ support-files =
|
|||||||
systemapp_helper.js
|
systemapp_helper.js
|
||||||
|
|
||||||
[test_sandbox_permission.html]
|
[test_sandbox_permission.html]
|
||||||
skip-if = true # bug 984274 - frequent timeouts
|
|
||||||
[test_filepicker_path.html]
|
[test_filepicker_path.html]
|
||||||
[test_permission_deny.html]
|
[test_permission_deny.html]
|
||||||
[test_permission_gum_remember.html]
|
[test_permission_gum_remember.html]
|
||||||
|
@ -72,10 +72,11 @@ nsGonkCameraControl::nsGonkCameraControl(uint32_t aCameraId)
|
|||||||
, mDeferConfigUpdate(0)
|
, mDeferConfigUpdate(0)
|
||||||
, mMediaProfiles(nullptr)
|
, mMediaProfiles(nullptr)
|
||||||
, mRecorder(nullptr)
|
, mRecorder(nullptr)
|
||||||
|
, mRecorderMonitor("GonkCameraControl::mRecorder.Monitor")
|
||||||
, mProfileManager(nullptr)
|
, mProfileManager(nullptr)
|
||||||
, mRecorderProfile(nullptr)
|
, mRecorderProfile(nullptr)
|
||||||
, mVideoFile(nullptr)
|
, mVideoFile(nullptr)
|
||||||
, mReentrantMonitor("GonkCameraControl::OnTakePictureMonitor")
|
, mReentrantMonitor("GonkCameraControl::OnTakePicture.Monitor")
|
||||||
{
|
{
|
||||||
// Constructor runs on the main thread...
|
// Constructor runs on the main thread...
|
||||||
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
|
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
|
||||||
@ -952,6 +953,8 @@ nsGonkCameraControl::StartRecordingImpl(DeviceStorageFileDescriptor* aFileDescri
|
|||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_GetCurrentThread() == mCameraThread);
|
MOZ_ASSERT(NS_GetCurrentThread() == mCameraThread);
|
||||||
|
|
||||||
|
ReentrantMonitorAutoEnter mon(mRecorderMonitor);
|
||||||
|
|
||||||
NS_ENSURE_TRUE(mRecorderProfile, NS_ERROR_NOT_INITIALIZED);
|
NS_ENSURE_TRUE(mRecorderProfile, NS_ERROR_NOT_INITIALIZED);
|
||||||
NS_ENSURE_FALSE(mRecorder, NS_ERROR_FAILURE);
|
NS_ENSURE_FALSE(mRecorder, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
@ -1041,7 +1044,7 @@ nsGonkCameraControl::StopRecordingImpl()
|
|||||||
nsRefPtr<DeviceStorageFile> mFile;
|
nsRefPtr<DeviceStorageFile> mFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
MOZ_ASSERT(NS_GetCurrentThread() == mCameraThread);
|
ReentrantMonitorAutoEnter mon(mRecorderMonitor);
|
||||||
|
|
||||||
// nothing to do if we have no mRecorder
|
// nothing to do if we have no mRecorder
|
||||||
NS_ENSURE_TRUE(mRecorder, NS_OK);
|
NS_ENSURE_TRUE(mRecorder, NS_OK);
|
||||||
@ -1570,6 +1573,8 @@ nsGonkCameraControl::SetupRecording(int aFd, int aRotation,
|
|||||||
const size_t SIZE = 256;
|
const size_t SIZE = 256;
|
||||||
char buffer[SIZE];
|
char buffer[SIZE];
|
||||||
|
|
||||||
|
ReentrantMonitorAutoEnter mon(mRecorderMonitor);
|
||||||
|
|
||||||
mRecorder = new GonkRecorder();
|
mRecorder = new GonkRecorder();
|
||||||
CHECK_SETARG_RETURN(mRecorder->init(), NS_ERROR_FAILURE);
|
CHECK_SETARG_RETURN(mRecorder->init(), NS_ERROR_FAILURE);
|
||||||
|
|
||||||
|
@ -155,6 +155,10 @@ protected:
|
|||||||
|
|
||||||
android::MediaProfiles* mMediaProfiles;
|
android::MediaProfiles* mMediaProfiles;
|
||||||
nsRefPtr<android::GonkRecorder> mRecorder;
|
nsRefPtr<android::GonkRecorder> mRecorder;
|
||||||
|
// Touching mRecorder happens inside this monitor because the destructor
|
||||||
|
// can run on any thread, and we need to be able to clean up properly if
|
||||||
|
// GonkCameraControl goes away.
|
||||||
|
ReentrantMonitor mRecorderMonitor;
|
||||||
|
|
||||||
// Camcorder profile settings for the desired quality level
|
// Camcorder profile settings for the desired quality level
|
||||||
nsRefPtr<GonkRecorderProfileManager> mProfileManager;
|
nsRefPtr<GonkRecorderProfileManager> mProfileManager;
|
||||||
|
Loading…
Reference in New Issue
Block a user