Bug 869206 - Make webrtc code build on gonk-JB, r=jesup

This commit is contained in:
Michael Wu 2013-05-04 11:00:35 -04:00
parent e4b71e139e
commit 78451df40a
5 changed files with 27 additions and 27 deletions

View File

@ -41,7 +41,7 @@ namespace mozilla {
void
MediaEngineWebRTC::EnumerateVideoDevices(nsTArray<nsRefPtr<MediaEngineVideoSource> >* aVSources)
{
#ifdef MOZ_WIDGET_GONK
#ifdef MOZ_B2G_CAMERA
MutexAutoLock lock(mMutex);
if (!mCameraManager) {
return;

View File

@ -45,7 +45,7 @@
#include "video_engine/include/vie_render.h"
#include "video_engine/include/vie_capture.h"
#include "video_engine/include/vie_file.h"
#ifdef MOZ_WIDGET_GONK
#ifdef MOZ_B2G_CAMERA
#include "CameraPreviewMediaStream.h"
#include "DOMCameraManager.h"
#include "GonkCameraControl.h"
@ -58,7 +58,7 @@
namespace mozilla {
#ifdef MOZ_WIDGET_GONK
#ifdef MOZ_B2G_CAMERA
class CameraAllocateRunnable;
class GetCameraNameRunnable;
#endif
@ -82,7 +82,7 @@ class GetCameraNameRunnable;
*/
class MediaEngineWebRTCVideoSource : public MediaEngineVideoSource
, public nsRunnable
#ifdef MOZ_WIDGET_GONK
#ifdef MOZ_B2G_CAMERA
, public nsICameraGetCameraCallback
, public nsICameraPreviewStreamCallback
, public nsICameraTakePictureCallback
@ -94,7 +94,7 @@ class MediaEngineWebRTCVideoSource : public MediaEngineVideoSource
#endif
{
public:
#ifdef MOZ_WIDGET_GONK
#ifdef MOZ_B2G_CAMERA
MediaEngineWebRTCVideoSource(nsDOMCameraManager* aCameraManager,
int aIndex, uint64_t aWindowId)
: mCameraManager(aCameraManager)
@ -155,7 +155,7 @@ public:
TrackTicks &aLastEndTime);
NS_DECL_ISUPPORTS
#ifdef MOZ_WIDGET_GONK
#ifdef MOZ_B2G_CAMERA
NS_DECL_NSICAMERAGETCAMERACALLBACK
NS_DECL_NSICAMERAPREVIEWSTREAMCALLBACK
NS_DECL_NSICAMERATAKEPICTURECALLBACK
@ -200,7 +200,7 @@ private:
void Shutdown();
// Engine variables.
#ifdef MOZ_WIDGET_GONK
#ifdef MOZ_B2G_CAMERA
// MediaEngine hold this DOM object, and the MediaEngine is hold by Navigator
// Their life time is always much longer than this object. Use a raw-pointer
// here should be safe.
@ -337,7 +337,7 @@ private:
class MediaEngineWebRTC : public MediaEngine
{
public:
#ifdef MOZ_WIDGET_GONK
#ifdef MOZ_B2G_CAMERA
MediaEngineWebRTC(nsDOMCameraManager* aCameraManager, uint64_t aWindowId)
: mMutex("mozilla::MediaEngineWebRTC")
, mVideoEngine(nullptr)
@ -387,7 +387,7 @@ private:
nsRefPtrHashtable<nsStringHashKey, MediaEngineWebRTCVideoSource > mVideoSources;
nsRefPtrHashtable<nsStringHashKey, MediaEngineWebRTCAudioSource > mAudioSources;
#ifdef MOZ_WIDGET_GONK
#ifdef MOZ_B2G_CAMERA
// MediaEngine hold this DOM object, and the MediaEngine is hold by Navigator
// Their life time is always much longer than this object. Use a raw-pointer
// here should be safe.

View File

@ -25,7 +25,7 @@ extern PRLogModuleInfo* GetMediaManagerLog();
NS_IMPL_THREADSAFE_ISUPPORTS1(MediaEngineWebRTCVideoSource, nsIRunnable)
// ViEExternalRenderer Callback.
#ifndef MOZ_WIDGET_GONK
#ifndef MOZ_B2G_CAMERA
int
MediaEngineWebRTCVideoSource::FrameSizeChange(
unsigned int w, unsigned int h, unsigned int streams)
@ -156,7 +156,7 @@ MediaEngineWebRTCVideoSource::NotifyPull(MediaStreamGraph* aGraph,
void
MediaEngineWebRTCVideoSource::ChooseCapability(const MediaEnginePrefs &aPrefs)
{
#ifdef MOZ_WIDGET_GONK
#ifdef MOZ_B2G_CAMERA
mCapability.width = aPrefs.mWidth;
mCapability.height = aPrefs.mHeight;
#else
@ -224,7 +224,7 @@ nsresult
MediaEngineWebRTCVideoSource::Allocate(const MediaEnginePrefs &aPrefs)
{
LOG((__FUNCTION__));
#ifdef MOZ_WIDGET_GONK
#ifdef MOZ_B2G_CAMERA
ReentrantMonitorAutoEnter sync(mCallbackMonitor);
if (mState == kReleased && mInitDone) {
ChooseCapability(aPrefs);
@ -262,13 +262,13 @@ MediaEngineWebRTCVideoSource::Deallocate()
{
LOG((__FUNCTION__));
if (mSources.IsEmpty()) {
#ifdef MOZ_WIDGET_GONK
#ifdef MOZ_B2G_CAMERA
ReentrantMonitorAutoEnter sync(mCallbackMonitor);
#endif
if (mState != kStopped && mState != kAllocated) {
return NS_ERROR_FAILURE;
}
#ifdef MOZ_WIDGET_GONK
#ifdef MOZ_B2G_CAMERA
// We do not register success callback here
NS_DispatchToMainThread(WrapRunnable(this,
@ -319,7 +319,7 @@ MediaEngineWebRTCVideoSource::Start(SourceMediaStream* aStream, TrackID aID)
aStream->AddTrack(aID, USECS_PER_S, 0, new VideoSegment());
aStream->AdvanceKnownTracksTime(STREAM_TIME_MAX);
#ifdef MOZ_WIDGET_GONK
#ifdef MOZ_B2G_CAMERA
ReentrantMonitorAutoEnter sync(mCallbackMonitor);
#endif
@ -328,7 +328,7 @@ MediaEngineWebRTCVideoSource::Start(SourceMediaStream* aStream, TrackID aID)
}
mImageContainer = layers::LayerManager::CreateImageContainer();
#ifdef MOZ_WIDGET_GONK
#ifdef MOZ_B2G_CAMERA
NS_DispatchToMainThread(WrapRunnable(this,
&MediaEngineWebRTCVideoSource::StartImpl,
mCapability));
@ -367,7 +367,7 @@ MediaEngineWebRTCVideoSource::Stop(SourceMediaStream *aSource, TrackID aID)
if (!mSources.IsEmpty()) {
return NS_OK;
}
#ifdef MOZ_WIDGET_GONK
#ifdef MOZ_B2G_CAMERA
ReentrantMonitorAutoEnter sync(mCallbackMonitor);
#endif
if (mState != kStarted) {
@ -382,7 +382,7 @@ MediaEngineWebRTCVideoSource::Stop(SourceMediaStream *aSource, TrackID aID)
// usage
mImage = nullptr;
}
#ifdef MOZ_WIDGET_GONK
#ifdef MOZ_B2G_CAMERA
NS_DispatchToMainThread(WrapRunnable(this,
&MediaEngineWebRTCVideoSource::StopImpl));
#else
@ -413,14 +413,14 @@ MediaEngineWebRTCVideoSource::Snapshot(uint32_t aDuration, nsIDOMFile** aFile)
* return from this function after cleaning up the temporary stream object
* and caling Stop() on the media source.
*/
#ifdef MOZ_WIDGET_GONK
#ifdef MOZ_B2G_CAMERA
ReentrantMonitorAutoEnter sync(mCallbackMonitor);
#endif
*aFile = nullptr;
if (!mInitDone || mState != kAllocated) {
return NS_ERROR_FAILURE;
}
#ifdef MOZ_WIDGET_GONK
#ifdef MOZ_B2G_CAMERA
mLastCapture = nullptr;
NS_DispatchToMainThread(WrapRunnable(this,
@ -529,7 +529,7 @@ MediaEngineWebRTCVideoSource::Init()
{
mDeviceName[0] = '\0'; // paranoia
mUniqueId[0] = '\0';
#ifdef MOZ_WIDGET_GONK
#ifdef MOZ_B2G_CAMERA
nsCString deviceName;
mCameraManager->GetCameraName(mCaptureIndex, deviceName);
@ -579,7 +579,7 @@ MediaEngineWebRTCVideoSource::Shutdown()
if (!mInitDone) {
return;
}
#ifdef MOZ_WIDGET_GONK
#ifdef MOZ_B2G_CAMERA
ReentrantMonitorAutoEnter sync(mCallbackMonitor);
#endif
if (mState == kStarted) {
@ -592,7 +592,7 @@ MediaEngineWebRTCVideoSource::Shutdown()
if (mState == kAllocated || mState == kStopped) {
Deallocate();
}
#ifndef MOZ_WIDGET_GONK
#ifndef MOZ_B2G_CAMERA
mViECapture->Release();
mViERender->Release();
mViEBase->Release();
@ -601,7 +601,7 @@ MediaEngineWebRTCVideoSource::Shutdown()
mInitDone = false;
}
#ifdef MOZ_WIDGET_GONK
#ifdef MOZ_B2G_CAMERA
// All these functions must be run on MainThread!
void

View File

@ -1050,7 +1050,7 @@ MediaManager::GetUserMedia(bool aPrivileged, nsPIDOMWindow* aWindow,
);
}
#ifdef MOZ_WIDGET_GONK
#ifdef MOZ_B2G_CAMERA
if (mCameraManager == nullptr) {
mCameraManager = nsDOMCameraManager::CheckPermissionAndCreateInstance(aWindow);
if (!mCameraManager) {
@ -1146,7 +1146,7 @@ MediaManager::GetBackend(uint64_t aWindowId)
MutexAutoLock lock(mMutex);
if (!mBackend) {
#if defined(MOZ_WEBRTC)
#ifndef MOZ_WIDGET_GONK
#ifndef MOZ_B2G_CAMERA
mBackend = new MediaEngineWebRTC();
#else
mBackend = new MediaEngineWebRTC(mCameraManager, aWindowId);

View File

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifdef ANDROID
#if defined(ANDROID) && !defined(MOZ_WIDGET_GONK)
#include "modules/audio_device/android/audio_device_jni_android.h"
#endif