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 4b295e95c7
commit 1d3b7048f5
4 changed files with 27 additions and 8 deletions

View File

@ -97,7 +97,10 @@ MediaEngineWebRTC::EnumerateVideoDevices(nsTArray<nsRefPtr<MediaEngineVideoSourc
JNIEnv *env;
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);
#endif
@ -230,7 +233,10 @@ MediaEngineWebRTC::EnumerateAudioDevices(nsTArray<nsRefPtr<MediaEngineAudioSourc
JNIEnv *env;
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);
#endif

View File

@ -152,7 +152,10 @@ MediaConduitErrorCode WebrtcAudioConduit::Init(WebrtcAudioConduit *other)
}
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);
#endif

View File

@ -115,7 +115,10 @@ MediaConduitErrorCode WebrtcVideoConduit::Init()
}
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);
#endif

View File

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