Update Android native API example to use real camera.
For simplicity, camera with index 0 is used. User also has to manually give the permission to use the camera for the app. Bug: webrtc:8769 Change-Id: I371f26f94d629411fd299671b4f3202e84556b80 Reviewed-on: https://webrtc-review.googlesource.com/76982 Commit-Queue: Sami Kalliomäki <sakal@webrtc.org> Reviewed-by: Paulina Hensman <phensman@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23284}
This commit is contained in:
committed by
Commit Bot
parent
09133af36f
commit
c475ac14a9
@ -20,7 +20,6 @@
|
||||
#include "media/engine/internalencoderfactory.h"
|
||||
#include "media/engine/webrtcmediaengine.h"
|
||||
#include "modules/audio_processing/include/audio_processing.h"
|
||||
#include "pc/test/fakeperiodicvideocapturer.h"
|
||||
#include "rtc_base/ptr_util.h"
|
||||
#include "sdk/android/native_api/jni/java_types.h"
|
||||
#include "sdk/android/native_api/video/wrapper.h"
|
||||
@ -97,16 +96,8 @@ void AndroidCallClient::Call(JNIEnv* env,
|
||||
local_sink_ = webrtc::JavaToNativeVideoSink(env, local_sink.obj());
|
||||
remote_sink_ = webrtc::JavaToNativeVideoSink(env, remote_sink.obj());
|
||||
|
||||
// The fake video source wants to be created on the same thread as it is
|
||||
// destroyed. It is destroyed on the signaling thread so we have to invoke
|
||||
// here.
|
||||
// TODO(sakal): Get picture from camera?
|
||||
video_source_ = pcf_->CreateVideoSource(
|
||||
signaling_thread_
|
||||
->Invoke<std::unique_ptr<webrtc::FakePeriodicVideoCapturer>>(
|
||||
RTC_FROM_HERE, [&] {
|
||||
return rtc::MakeUnique<webrtc::FakePeriodicVideoCapturer>();
|
||||
}));
|
||||
video_source_ = webrtc::CreateJavaVideoSource(env, signaling_thread_.get(),
|
||||
false /* is_screencast */);
|
||||
|
||||
CreatePeerConnection();
|
||||
Connect();
|
||||
@ -138,6 +129,15 @@ void AndroidCallClient::Delete(JNIEnv* env,
|
||||
delete this;
|
||||
}
|
||||
|
||||
webrtc::ScopedJavaLocalRef<jobject>
|
||||
AndroidCallClient::GetJavaVideoCapturerObserver(
|
||||
JNIEnv* env,
|
||||
const webrtc::JavaRef<jobject>& cls) {
|
||||
RTC_DCHECK_RUN_ON(&thread_checker_);
|
||||
|
||||
return video_source_->GetJavaVideoCapturerObserver(env);
|
||||
}
|
||||
|
||||
void AndroidCallClient::CreatePeerConnectionFactory() {
|
||||
network_thread_ = rtc::Thread::CreateWithSocketServer();
|
||||
network_thread_->SetName("network_thread", nullptr);
|
||||
@ -277,10 +277,10 @@ void SetLocalSessionDescriptionObserver::OnFailure(const std::string& error) {
|
||||
RTC_LOG(LS_INFO) << "Set local description failure: " << error;
|
||||
}
|
||||
|
||||
} // namespace webrtc_examples
|
||||
|
||||
static jlong JNI_CallClient_CreateClient(
|
||||
JNIEnv* env,
|
||||
const webrtc::JavaParamRef<jclass>& cls) {
|
||||
return webrtc::NativeToJavaPointer(new webrtc_examples::AndroidCallClient());
|
||||
}
|
||||
|
||||
} // namespace webrtc_examples
|
||||
|
||||
Reference in New Issue
Block a user