Hi mohit,
I think you can find how to switch camera on WebRTCDemo instead of AppRTCDemo.
You can start read code from:
toggleCamer() function in webrtc/examples/android/media_demo/src/org/webrtc/webrtcdemo/MediaEngine.java
For AppRTCDemo,
You should add similar logic into it by yourself. After you switch camera, you should update your stream also.
BR,
Lu Qiang
--
---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
discuss-webrt...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Once you get it build successfully, you can find those JNI shared library on out/Debug directory. (libwebrtc-video-demo-jni.so)
Hi SProgrammer,
Thanks for your sharing this knowledge about “seamless switch”.
I am not familiar with it and will to learn it. Hopefully it can be used by WebRTC.
And, I just mentioned the mechanism of switch camera used on WebRTCDemoJ
BR,
Lu Qiang
From: discuss...@googlegroups.com [mailto:discuss...@googlegroups.com] On Behalf Of SProgrammer
Sent: Wednesday, December 25, 2013 6:02 AM
To: discuss...@googlegroups.com
I think the same regardless of any platform is the principle
BR,
Peter Lee
Thanks!!
Java => C++
------------------
> org/webrtc/VideoCapturer.java
++ void switchCamera(int cameraId, CameraInfo cameraInfo) ==> native call
++ private static native void nativeSwitchCamera(long nativeVideoCapturer, int cameraId)
C++
------
> talk/app/webrtc/java/jni/peerconnection_jni.cc
++ JOW(void, VideoCapturer_nativeSwitchCamera)(JNIEnv* jni, jclass, jlong pointer, jint camera_id) {
++ (reinterpret_cast<cricket::VideoCapturer*>(pointer))->SwitchCamera(camera_id);
++ }
> webrtc/modules/video_capture/include/video_capture.h
++ virtual void SwitchCamera(int cameraId) = 0;
> talk/media/base/videocapturer.h
++ virtual void SwitchCamera(int camera_id){};
> talk/media/webrtc/webrtcvideocapturer.h
++ virtual void SwitchCamera(int camera_id);
> webrtc/modules/video_capture/android/video_capture_android.h
++ virtual void SwitchCamera(int cameraId);
> talk/media/webrtc/webrtcvideocapturer.cc
++ void WebRtcVideoCapturer::SetCaptureRotation(int rotation) {
++ ...
++ module_->SetCaptureRotation(lRotation);
++}
C++ => Java
------------------
> webrtc/modules/video_capture/android/video_capture_android.cc
++void VideoCaptureAndroid::SwitchCamera(int cameraId) {
++ ...
++ jmethodID cid = env->GetMethodID(g_java_capturer_class, "switchCamera", "(I)V");
++ if (cid != NULL) {
++ env->CallVoidMethod(_jCapturer, cid, cameraId);
++ }
++}
Java
------
> org/webrtc/videoengine/VideoCaptureAndroid.java
++ private synchronized void switchCamera(int id) {
++ if (camera != null) {
++ stopCapture();
++}
++ ...
++ startCapture(captureWidth, captureHeight, captureMinMfps, captureMaxMfps);
++}
...
--
---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.