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:
Sami Kalliomäki
2018-05-16 15:49:18 +02:00
committed by Commit Bot
parent 09133af36f
commit c475ac14a9
6 changed files with 90 additions and 22 deletions

View File

@ -21,6 +21,7 @@
#include "rtc_base/scoped_ref_ptr.h"
#include "rtc_base/thread_checker.h"
#include "sdk/android/native_api/jni/scoped_java_ref.h"
#include "sdk/android/native_api/video/videosource.h"
namespace webrtc_examples {
@ -36,6 +37,10 @@ class AndroidCallClient {
// A helper method for Java code to delete this object. Calls delete this.
void Delete(JNIEnv* env, const webrtc::JavaRef<jobject>& cls);
webrtc::ScopedJavaLocalRef<jobject> GetJavaVideoCapturerObserver(
JNIEnv* env,
const webrtc::JavaRef<jobject>& cls);
private:
class PCObserver;
@ -60,7 +65,7 @@ class AndroidCallClient {
RTC_GUARDED_BY(thread_checker_);
std::unique_ptr<rtc::VideoSinkInterface<webrtc::VideoFrame>> remote_sink_
RTC_GUARDED_BY(thread_checker_);
rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> video_source_
rtc::scoped_refptr<webrtc::JavaVideoTrackSourceInterface> video_source_
RTC_GUARDED_BY(thread_checker_);
rtc::CriticalSection pc_mutex_;