Restarting a VideoCapture on Android not working

730 views
Skip to first unread message

Albert Devesa Triscon

unread,
Jul 10, 2014, 3:57:00 AM7/10/14
to discuss...@googlegroups.com

Hi,

I’m developing an Android WebRTC application based on AppRTCDemo but I have a problem which I don’t know how to solve it. I have a MainActivity with settings, if a button is pressed it goes to RTCActivity which has a WebRtcClient object. The problem is, after the videoconference is done, RTCActivity finishes and it does an Intent to return to MainActivity. The app goes well so far until here, now if I try to restart the conference going again to RTCActivity the app crashes showing this error:

  1. 07-09 13:37:45.536    3817-6834/com.app.android E/WEBRTC-JC﹕ startCapture failed
  2.     java.lang.RuntimeException: Fail to connect to camera service
  3.             at android.hardware.Camera.native_setup(Native Method)
  4.             at android.hardware.Camera.<init>(Camera.java:353)
  5.             at android.hardware.Camera.open(Camera.java:312)
  6.             at org.webrtc.videoengine.VideoCaptureAndroid.startCaptureOnCameraThread(VideoCaptureAndroid.java:145)
  7.             at org.webrtc.videoengine.VideoCaptureAndroid.access$400(VideoCaptureAndroid.java:40)
  8.             at org.webrtc.videoengine.VideoCaptureAndroid$2.run(VideoCaptureAndroid.java:132)
  9.             at android.os.Handler.handleCallback(Handler.java:615)
  10.             at android.os.Handler.dispatchMessage(Handler.java:92)
  11.             at android.os.Looper.loop(Looper.java:137)
  12.             at org.webrtc.videoengine.VideoCaptureAndroid$CameraThread.run(VideoCaptureAndroid.java:107)
  13. 07-09 13:37:45.536    3817-6829/com.app.android D/SensorManager﹕ registerListener :: handle = 0  name= LSM330DLC 3-axis Accelerometer delay= 200000 Listener= android.view.OrientationEventListener$SensorEventListenerImpl@41b08d48
  14. 07-09 13:37:45.536    3817-6829/com.app.android E/libjingle﹕ Error(webrtcvideocapturer.cc:274): Camera 'Camera 1, Facing front, Orientation 0' failed to start
  15. 07-09 13:37:45.541    3817-6830/com.app.android E/libjingle﹕ Error(common.cc:76): ../../talk/app/webrtc/videosource.cc(458): ASSERT FAILED: state_ != new_state @ SetState
  16. 07-09 13:46:20.596    7361-7363/com.app.android D/dalvikvm﹕ GC_CONCURRENT freed 391K, 15% free 7330K/8583K, paused 12ms+2ms, total 32ms


It seems that the app can’t catch the VideoCapturer again eventhough I disposed the VideoCapture before the activity finishes. Does anyone know how to solve it?

mparis

unread,
Jul 10, 2014, 3:51:06 PM7/10/14
to discuss...@googlegroups.com
I opened an issue that could be related with this.
https://code.google.com/p/webrtc/issues/detail?id=3568

gla...@webrtc.org

unread,
Jul 10, 2014, 7:16:11 PM7/10/14
to discuss...@googlegroups.com
This may be a duplicate of

Albert, can you attach logcat output? When closing the camera the log should contain "stopCapture", "stopCapture done" messages.

Albert Devesa Triscon

unread,
Jul 11, 2014, 5:01:40 AM7/11/14
to discuss...@googlegroups.com
You're right it's a duplicate of Issue 3467. I'm sorry (and happy at the same time) but today I updated Android Studio and now it works correctly (I do not know if it's something related). Based on my experience the camera disposes (camera.dispose()) properly but after this when it runs videosource.dispose() it showes the error ("Refcount unexpectedly not 0 "). Maybe the videosource didn't let the camera close correctly (that's why when you create again the VideoCapture it failed). I'll do more tests on more devices. 

El divendres 11 de juliol de 2014 1:16:11 UTC+2, gla...@webrtc.org va escriure:
Reply all
Reply to author
Forward
0 new messages