Bug 863290 - Correctly detect failure to initialize Android capture objects. r=jesup

This commit is contained in:
Gian-Carlo Pascutto 2013-05-08 07:39:03 +02:00
parent 686166e5e2
commit 25e36cb988
4 changed files with 27 additions and 8 deletions

View File

@ -97,7 +97,10 @@ MediaEngineWebRTC::EnumerateVideoDevices(nsTArray<nsRefPtr<MediaEngineVideoSourc
JNIEnv *env; JNIEnv *env;
jint res = jvm->AttachCurrentThread(&env, NULL); jint res = jvm->AttachCurrentThread(&env, NULL);
webrtc::VideoEngine::SetAndroidObjects(jvm, (void*)context); if (webrtc::VideoEngine::SetAndroidObjects(jvm, (void*)context) != 0) {
LOG(("VieCapture:SetAndroidObjects Failed"));
return;
}
env->DeleteGlobalRef(context); env->DeleteGlobalRef(context);
#endif #endif
@ -230,7 +233,10 @@ MediaEngineWebRTC::EnumerateAudioDevices(nsTArray<nsRefPtr<MediaEngineAudioSourc
JNIEnv *env; JNIEnv *env;
jvm->AttachCurrentThread(&env, NULL); jvm->AttachCurrentThread(&env, NULL);
webrtc::VoiceEngine::SetAndroidObjects(jvm, (void*)context); if (webrtc::VoiceEngine::SetAndroidObjects(jvm, (void*)context) != 0) {
LOG(("VoiceEngine:SetAndroidObjects Failed"));
return;
}
env->DeleteGlobalRef(context); env->DeleteGlobalRef(context);
#endif #endif

View File

@ -152,7 +152,10 @@ MediaConduitErrorCode WebrtcAudioConduit::Init(WebrtcAudioConduit *other)
} }
jvm->AttachCurrentThread(&env, NULL); jvm->AttachCurrentThread(&env, NULL);
webrtc::VoiceEngine::SetAndroidObjects(jvm, (void*)context); if (webrtc::VoiceEngine::SetAndroidObjects(jvm, (void*)context) != 0) {
CSFLogError(logTag, "%s Unable to set Android objects", __FUNCTION__);
return kMediaConduitSessionNotInited;
}
env->DeleteGlobalRef(context); env->DeleteGlobalRef(context);
#endif #endif

View File

@ -115,7 +115,10 @@ MediaConduitErrorCode WebrtcVideoConduit::Init()
} }
jvm->AttachCurrentThread(&env, NULL); jvm->AttachCurrentThread(&env, NULL);
webrtc::VideoEngine::SetAndroidObjects(jvm, (void*)context); if (webrtc::VideoEngine::SetAndroidObjects(jvm, (void*)context) != 0) {
CSFLogError(logTag, "%s: could not set Android objects", __FUNCTION__);
return kMediaConduitSessionNotInited;
}
env->DeleteGlobalRef(context); env->DeleteGlobalRef(context);
#endif #endif

View File

@ -145,15 +145,22 @@ public:
WebrtcVideoConduit(): WebrtcVideoConduit():
mVideoEngine(NULL), mVideoEngine(nullptr),
mTransport(NULL), mTransport(nullptr),
mRenderer(NULL), mRenderer(nullptr),
mEngineTransmitting(false), mEngineTransmitting(false),
mEngineReceiving(false), mEngineReceiving(false),
mEngineRendererStarted(false), mEngineRendererStarted(false),
mChannel(-1), mChannel(-1),
mCapId(-1), mCapId(-1),
mCurSendCodecConfig(NULL) mCurSendCodecConfig(nullptr),
mPtrViEBase(nullptr),
mPtrViECapture(nullptr),
mPtrViECodec(nullptr),
mPtrViENetwork(nullptr),
mPtrViERender(nullptr),
mPtrExtCapture(nullptr),
mPtrRTP(nullptr)
{ {
} }