I'm developing a video call app and facing strange behavior of pjsip.
From example app there are helper classes for working with camera:
PjCamera.java and PjCameraInfo.java
I'm trying to switch camera via the next code:
try {
CallVidSetStreamParam callVidSetStreamParam = new
CallVidSetStreamParam();
callVidSetStreamParam.setCapDev(mCameraId);
myCall.vidSetStream(pjsua_call_vid_strm_op.PJSUA_CALL_VID_STRM_CHANGE_CAP_DEV,
callVidSetStreamParam);
}catch (Exception e){
e.printStackTrace();
}
Where mCameraId is ID of the camera that is elected by the user. My
conception is to allow user choose camera only before the calling. So I put
this method into onCallMediaState(OnCallMediaStateParam prm) callback
inside myCall after all media parsing operations done (same as in the
example app).
So the sequencing of app logic is:
All is fine here while user chooses the front camera. But when user chooses
the back one strange thing happens:
After investigation I have found the reason of crash:
PjCamera.java contains methods Start() and Stop() that initialize and
free/destroy android camera object to work with.
These methods are called by pjsip lib.
Using the debugger I have noticed that behavior of theese differs for calls
with front camera and for calls with back camera.
let suppose facing camera id = 0 and back = 1
So for calls wit front camera the sequencing is:
And for calls with back camera the sequencing is:
So for front camera case the repeat is not fatal - second Stop() call is
just NOP
But for the back camera this becomes pain - library reopens the back camera
after the call was ended.
And this provides the app crash when calling after that.
I tried to investigate the pjsip source but failed to found a reason for
such behavior. I'm not very familiar with C/C++ programming though.
So why is it happens?
Why pjsip tries to Stop() front camera twice while it reopens the back
camera after call is ended and camera closed?
And how to overcome this issue?
Best Regards,
Sergey
Ok, I've found something strange with it.
This issue appears when I use 2 account with 1 endpoint simultaneously.
When I use only 1 account, this is not happening.
Please consider this.
There are also issues with 2 video calls at the same time, but I will point
them later, when figure out all conditions...
Regards,
Sergey
вт, 5 апр. 2016 г. в 19:19, Сергей Митрофанов goretz.m@gmail.com:
I'm developing a video call app and facing strange behavior of pjsip.
From example app there are helper classes for working with camera:
PjCamera.java and PjCameraInfo.java
I'm trying to switch camera via the next code:
try {
CallVidSetStreamParam callVidSetStreamParam = new
CallVidSetStreamParam();
callVidSetStreamParam.setCapDev(mCameraId);
myCall.vidSetStream(pjsua_call_vid_strm_op.PJSUA_CALL_VID_STRM_CHANGE_CAP_DEV,
callVidSetStreamParam);
}catch (Exception e){
e.printStackTrace();
}
Where mCameraId is ID of the camera that is elected by the user. My
conception is to allow user choose camera only before the calling. So I put
this method into onCallMediaState(OnCallMediaStateParam prm) callback
inside myCall after all media parsing operations done (same as in the
example app).
So the sequencing of app logic is:
All is fine here while user chooses the front camera. But when user
chooses the back one strange thing happens:
After investigation I have found the reason of crash:
PjCamera.java contains methods Start() and Stop() that initialize and
free/destroy android camera object to work with.
These methods are called by pjsip lib.
Using the debugger I have noticed that behavior of theese differs for
calls with front camera and for calls with back camera.
let suppose facing camera id = 0 and back = 1
So for calls wit front camera the sequencing is:
And for calls with back camera the sequencing is:
So for front camera case the repeat is not fatal - second Stop() call is
just NOP
But for the back camera this becomes pain - library reopens the back
camera after the call was ended.
And this provides the app crash when calling after that.
I tried to investigate the pjsip source but failed to found a reason for
such behavior. I'm not very familiar with C/C++ programming though.
So why is it happens?
Why pjsip tries to Stop() front camera twice while it reopens the back
camera after call is ended and camera closed?
And how to overcome this issue?
Best Regards,
Sergey