据观察,即使添加连接侦听器后,会话也不会重新连接。这导致如果网络连接稍有中断,移动应用程序停止接收呼叫的情况。以下是Android Studio的代码段。请指教。
以下是请求的日志(没有任何过滤器的详细模式)。在我们关闭wi-fi后立即捕获前三行。理想情况下,我们希望看到一些重新连接活动开始,但这没有发生。第4行以后是我们打开wi-fi并尝试呼叫另一方后立即捕获的声明。谢谢你的帮助!
注意:“MFSession是我们的应用程序使用的日志标记:
--- Log Start ----
06-07 01:44:58.555 26551-26551/in.medfone D/MFSession: Session Message= Wi-fi network is
not available. Quality of video call may suffer
06-07 01:44:58.705 26551-26551/in.medfone D/ViewRootImpl: Buffer Count from app info with
::-1 && -1 for :: in.medfone from View :: -1 DBQ Enabled ::false false
06-07 01:44:58.825 26551-27107/in.medfone D/mali_winsys: new_window_surface returns 0x3000,
[668x136]-format:1
06-07 01:45:07.475 26551-26551/in.medfone D/MFSession: Session Message= Wi-fi network is
now available
06-07 01:45:07.530 26551-26551/in.medfone D/ViewRootImpl: Buffer Count from app info with
::-1 && -1 for :: in.medfone from View :: -1 DBQ Enabled ::false false
06-07 01:45:07.625 26551-27107/in.medfone D/mali_winsys: new_window_surface returns 0x3000,
[499x104]-format:1
06-07 01:45:07.895 26551-26551/in.medfone D/ViewRootImpl: ViewPostImeInputStage ACTION_DOWN
06-07 01:45:24.470 26551-26551/in.medfone D/ViewRootImpl: ViewPostImeInputStage ACTION_DOWN
06-07 01:45:24.525 26551-13422/in.medfone D/MediaCodecVideo: SetAndroidObjects for surface
decoding.
06-07 01:45:24.525 26551-13422/in.medfone D/MediaCodecVideo: NULL VideoDecoder EGL context
- HW surface decoding is disabled.
06-07 01:45:24.530 26551-13422/in.medfone V/MediaCodecVideoEncoder: Found candidate encoder OMX.google.vp8.encoder
06-07 01:45:24.530 26551-13422/in.medfone V/MediaCodecVideoEncoder: Found candidate encoder
OMX.Exynos.AVC.Encoder
06-07 01:45:24.530 26551-13422/in.medfone V/MediaCodecVideoEncoder: Found candidate encoder
OMX.google.h264.encoder
06-07 01:45:24.530 26551-13422/in.medfone V/MediaCodecVideoDecoder: Found candidate decoder
OMX.Exynos.vp8.dec
06-07 01:45:24.530 26551-13422/in.medfone V/MediaCodecVideoDecoder: Color: 0x7f420888
06-07 01:45:24.530 26551-13422/in.medfone V/MediaCodecVideoDecoder: Color: 0x15
06-07 01:45:24.530 26551-13422/in.medfone V/MediaCodecVideoDecoder: Color: 0x13
06-07 01:45:24.530 26551-13422/in.medfone V/MediaCodecVideoDecoder: Color: 0x7fc00002
06-07 01:45:24.530 26551-13422/in.medfone D/MediaCodecVideoDecoder: Found target decoder
OMX.Exynos.vp8.dec. Color: 0x13
06-07 01:45:24.530 26551-13422/in.medfone D/MediaCodecVideo: VP8 HW Decoder supported.
06-07 01:45:24.530 26551-13422/in.medfone V/MediaCodecVideoDecoder: Found candidate decoder
OMX.Exynos.avc.dec
06-07 01:45:24.530 26551-13422/in.medfone V/MediaCodecVideoDecoder: Found candidate decoder
OMX.SEC.avc.sw.dec
06-07 01:45:24.530 26551-13422/in.medfone V/MediaCodecVideoDecoder: Found candidate decoder
OMX.google.h264.decoder
06-07 01:45:24.545 26551-13424/in.medfone D/JVM: AttachCurrentThreadIfNeeded
::ctor@[tid=13424]
06-07 01:45:24.545 26551-13424/in.medfone D/JVM: Attaching thread to JVM
06-07 01:45:24.545 26551-13424/in.medfone D/JVM: JVM::environment@[tid=13424]
06-07 01:45:24.545 26551-13424/in.medfone D/JVM: JNIEnvironment::ctor@[tid=13424]
06-07 01:45:24.545 26551-13424/in.medfone D/AudioManager: ctor@[tid=13424]
06-07 01:45:24.545 26551-13424/in.medfone D/JVM: JNIEnvironment::
RegisterNatives(org/webrtc/voiceengine/WebRtcAudioManager)
06-07 01:45:24.545 26551-13424/in.medfone D/JVM: NativeRegistration::ctor@[tid=13424]
06-07 01:45:24.545 26551-13424/in.medfone D/JVM: NativeRegistration::NewObject@[tid=13424]
06-07 01:45:24.545 26551-13424/in.medfone D/WebRtcAudioManager: ctor@[name=Thread-3328,
id=3328]
06-07 01:45:24.555 26551-26551/in.medfone D/ViewRootImpl: Buffer Count from app info with
::-1 && -1 for :: in.medfone from View :: -1 DBQ Enabled ::false false
06-07 01:45:24.560 26551-13424/in.medfone D/AudioManager: OnCacheAudioParameters@[tid=13424]
06-07 01:45:24.560 26551-13424/in.medfone D/AudioManager: hardware_aec: 1
06-07 01:45:24.560 26551-13424/in.medfone D/AudioManager: low_latency_output: 0
06-07 01:45:24.560 26551-13424/in.medfone D/AudioManager: sample_rate: 48000
06-07 01:45:24.560 26551-13424/in.medfone D/AudioManager: channels: 1
06-07 01:45:24.560 26551-13424/in.medfone D/AudioManager: output_buffer_size: 3840
06-07 01:45:24.560 26551-13424/in.medfone D/AudioManager: input_buffer_size: 1920
06-07 01:45:24.560 26551-13424/in.medfone D/JVM: GlobalRef::ctor@[tid=13424]
06-07 01:45:24.560 26551-13424/in.medfone D/AudioManager: JavaAudioManager::ctor@[tid=13424]
06-07 01:45:24.560 26551-13424/in.medfone D/AudioManager: IsLowLatencyPlayoutSupported()
06-07 01:45:24.560 26551-13424/in.medfone D/JVM: AttachCurrentThreadIfNeeded
::ctor@[tid=13424]
06-07 01:45:24.560 26551-13424/in.medfone D/JVM: JVM::environment@[tid=13424]
06-07 01:45:24.560 26551-13424/in.medfone D/JVM: JNIEnvironment
::ctor@[tid=13424]
06-07 01:45:24.560 26551-13424/in.medfone D/AudioTrackJni: ctor@[tid=13424]
06-07 01:45:24.560 26551-13424/in.medfone D/JVM: JNIEnvironment::RegisterNatives
(org/webrtc/voiceengine/WebRtcAudioTrack)
06-07 01:45:24.560 26551-13424/in.medfone D/JVM: NativeRegistration::ctor@[tid=13424]
06-07 01:45:24.560 26551-13424/in.medfone D/JVM: NativeRegistration::NewObject@[tid=13424]
06-07 01:45:24.560 26551-13424/in.medfone D/WebRtcAudioTrack:
ctor@[name=Thread-3328, id=3328]
06-07 01:45:24.560 26551-13424/in.medfone D/WebRtcAudioTrack: Android SDK: 22,
Release: 5.1.1, Brand: samsung, Device: hl3g, Id: LMY47X,
Hardware: universal5260, Manufacturer: samsung, Model: SM-N750, Product: hl3gxx
06-07 01:45:24.560 26551-13424/in.medfone D/JVM: GlobalRef::ctor@[tid=13424]
06-07 01:45:24.560 26551-13424/in.medfone D/JVM: AttachCurrentThreadIfNeeded::
ctor@[tid=13424]
06-07 01:45:24.560 26551-13424/in.medfone D/JVM: JVM::environment@[tid=13424]
06-07 01:45:24.560 26551-13424/in.medfone D/JVM: JNIEnvironment::
ctor@[tid=13424]
06-07 01:45:24.560 26551-13424/in.medfone D/AudioRecordJni: ctor@[tid=13424]
06-07 01:45:24.560 26551-13424/in.medfone D/JVM: JNIEnvironment::RegisterNatives
(org/webrtc/voiceengine/WebRtcAudioRecord)
06-07 01:45:24.560 26551-13424/in.medfone D/JVM: NativeRegistration::ctor@[tid=13424]
06-07 01:45:24.560 26551-13424/in.medfone D/JVM: NativeRegistration::NewObject@[tid=13424]
06-07 01:45:24.560 26551-13424/in.medfone D/WebRtcAudioRecord: ctor@[name=Thread-3328, id=3328]
06-07 01:45:24.560 26551-13424/in.medfone D/JVM: GlobalRef::ctor@[tid=13424]
06-07 01:45:24.560 26551-13424/in.medfone D/AudioManager: SetActiveAudioLayer(5)@[tid=13424]
06-07 01:45:24.560 26551-13424/in.medfone D/AudioManager: delay_estimate_in_milliseconds: 150
06-07 01:45:24.560 26551-13424/in.medfone D/AudioTrackJni: AttachAudioBuffer@[tid=13424]
06-07 01:45:24.560 26551-13424/in.medfone D/AudioTrackJni: SetPlayoutSampleRate(48000)
06-07 01:45:24.560 26551-13424/in.medfone D/AudioTrackJni: SetPlayoutChannels(1)
06-07 01:45:24.560 26551-13424/in.medfone D/AudioRecordJni: AttachAudioBuffer
06-07 01:45:24.560 26551-13424/in.medfone D/AudioRecordJni: SetRecordingSampleRate(48000)
06-07 01:45:24.560 26551-13424/in.medfone D/AudioRecordJni: SetRecordingChannels(1)
06-07 01:45:24.560 26551-13424/in.medfone D/AudioRecordJni: total_delay_in_milliseconds: 150
06-07 01:45:24.560 26551-13424/in.medfone D/AudioManager: Init@[tid=13424]
06-07 01:45:24.560 26551-13424/in.medfone D/WebRtcAudioManager: init@[name=Thread-3328, id=3328]
06-07 01:45:24.560 26551-13424/in.medfone D/WebRtcAudioManager: audio mode is: MODE_NORMAL
06-07 01:45:24.560 26551-13424/in.medfone D/AudioRecordJni: EnableBuiltInAEC@[tid=13424]
06-07 01:45:24.560 26551-13424/in.medfone D/WebRtcAudioRecord: EnableBuiltInAEC(true)
06-07 01:45:24.570 26551-13424/in.medfone D/AudioRecordJni: EnableBuiltInAEC@[tid=13424]
06-07 01:45:24.570 26551-13424/in.medfone D/WebRtcAudioRecord: EnableBuiltInAEC(true)
06-07 01:45:24.575 26551-26551/in.medfone D/VideoRendererGui: VideoRendererGui.setView
06-07 01:45:24.575 26551-26551/in.medfone D/VideoRendererGui: YuvImageRenderer.Create id: 0
06-07 01:45:24.580 26551-26551/in.medfone D/VideoRendererGui: VideoRendererGui.setView
06-07 01:45:24.580 26551-26551/in.medfone D/VideoRendererGui: YuvImageRenderer.Create id: 0
06-07 01:45:24.640 26551-27107/in.medfone D/mali_winsys: new_window_surface returns 0x3000, [668x125]-format:1
06-07 01:45:24.670 26551-26551/in.medfone D/SRIB_DBQ: SurfaceView:updateWindow: viewRoot.sSVBufferCount=-1 mSVBufferCount=-1
06-07 01:45:24.670 26551-13433/in.medfone D/libEGL: eglInitialize EGLDisplay = 0x8b00ea14
06-07 01:45:24.675 26551-13433/in.medfone D/mali_winsys: new_window_surface returns 0x3000, [240x240]-format:2
06-07 01:45:24.675 26551-13433/in.medfone D/VideoRendererGui: VideoRendererGui.onSurfaceCreated
06-07 01:45:24.675 26551-13433/in.medfone D/VideoRendererGui: VideoRendererGui EGL Context: android.opengl.EGLContext@6803ed4f
06-07 01:45:24.715 26551-13433/in.medfone D/VideoRendererGui: YuvImageRenderer.createTextures 0 on GL thread:3329
06-07 01:45:24.720 26551-13433/in.medfone D/VideoRendererGui: VideoRendererGui.onSurfaceChanged: 240 x 240
06-07 01:45:24.720 26551-13433/in.medfone D/VideoRendererGui: ID: 0. YuvImageRenderer.setScreenSize: 240 x 240
06-07 01:45:24.725 26551-26551/in.medfone D/SRIB_DBQ: SurfaceView:updateWindow: viewRoot.sSVBufferCount=-1 mSVBufferCount=-1
06-07 01:45:24.725 26551-13434/in.medfone D/libEGL: eglInitialize EGLDisplay = 0x8b112a14
06-07 01:45:24.735 26551-13434/in.medfone D/mali_winsys: new_window_surface returns 0x3000, [720x1124]-format:2
06-07 01:45:24.735 26551-13434/in.medfone D/VideoRendererGui: VideoRendererGui.onSurfaceCreated
06-07 01:45:24.735 26551-13434/in.medfone D/VideoRendererGui: VideoRendererGui EGL Context: android.opengl.EGLContext@79f679ce
06-07 01:45:24.785 26551-13434/in.medfone D/VideoRendererGui: YuvImageRenderer.createTextures 0 on GL thread:3330
06-07 01:45:24.785 26551-13434/in.medfone D/VideoRendererGui: VideoRendererGui.onSurfaceChanged: 720 x 1124
06-07 01:45:24.785 26551-13434/in.medfone D/VideoRendererGui: ID: 0. YuvImageRenderer.setScreenSize: 720 x 1124
06-07 01:45:24.820 26551-13426/in.medfone D/VideoCapturerAndroid: VideoCapturerAndroid
06-07 01:45:24.820 26551-13426/in.medfone D/VideoCapturerAndroid: init: Camera 1, Facing front, Orientation 270
06-07 01:45:24.825 26551-13426/in.medfone D/VideoCapturerAndroid: Supported formats for camera 1: [
{
"width": 1920,
"height": 1080,
"framerate": 30
},
{
"width": 1440,
"height": 1080,
"framerate": 30
},
{
"width": 1280,
"height": 960,
"framerate": 30
},
{
"width": 1280,
"height": 720,
"framerate": 30
},
{
"width": 1056,
"height": 864,
"framerate": 30
},
{
"width": 1024,
"height": 768,
"framerate": 30
},
{
"width": 960,
"height": 720,
"framerate": 30
},
{
"width": 720,
"height": 720,
"framerate": 30
},
{
"width": 800,
"height": 600,
"framerate": 30
},
{
"width": 800,
"height": 480,
"framerate": 30
},
{
"width": 800,
"height": 450,
"framerate": 30
},
{
"width": 720,
"height": 480,
"framerate": 30
},
{
"width": 640,
"height": 480,
"framerate": 30
},
{
"width": 528,
"height": 432,
"framerate": 30
},
{
"width": 480,
"height": 320,
"framerate": 30
},
{
"width": 480,
"height": 270,
"framerate": 30
},
{
"width": 352,
"height": 288,
"framerate": 30
},
{
"width": 320,
"height": 240,
"framerate": 30
}
]
06-07 01:45:25.335 26551-13424/in.medfone D/VideoCapturerAndroid: startCapture requested: 640x480@30
06-07 01:45:25.335 26551-13444/in.medfone D/VideoCapturerAndroid: Opening camera 1
06-07 01:45:25.345 26551-13426/in.medfone D/AppRTCAudioManager: Android SDK: 22, Release: 5.1.1, Brand: samsung, Device: hl3g, Id: LMY47X, Hardware: universal5260, Manufacturer: samsung, Model: SM-N750, Product: hl3gxx
06-07 01:45:25.400 26551-13444/in.medfone D/VideoCapturerAndroid: Camera orientation: 270 .Device orientation: 0
06-07 01:45:25.405 26551-13444/in.medfone D/VideoCapturerAndroid: isVideoStabilizationSupported: true
06-07 01:45:25.405 26551-13444/in.medfone D/VideoCapturerAndroid: Start capturing: 640x480@[30000:30000]
06-07 01:45:25.410 26551-13444/in.medfone D/VideoCapturerAndroid: queueCameraBuffers enqued 3 buffers of size 460800.
06-07 01:45:25.505 26551-28550/in.medfone D/QBASDK: Can't parse the 'date_sent' value null: Invalid double: "null"
06-07 01:45:25.955 26551-13424/in.medfone D/VideoRendererGui: ID: 0. YuvImageRenderer.setSize: 480 x 640 rotation 0
06-07 01:45:25.960 26551-13424/in.medfone D/VideoRendererGui: YuvImageRenderer.setSize done.
06-07 01:45:25.965 26551-13433/in.medfone D/VideoRendererGui: ID: 0. AdjustTextureCoords. Display: 240.0 x 240.0. Video: 480 x 640. Rotation: 0. Mirror: true
06-07 01:45:25.965 26551-13433/in.medfone D/VideoRendererGui: Texture vertices: (-1.0,-1.0) - (1.0,1.0)
06-07 01:45:25.970 26551-13433/in.medfone D/VideoRendererGui: Texture UV: (0.0,0.125) - (1.0,0.875)
06-07 01:45:25.970 26551-13433/in.medfone D/VideoRendererGui: AdjustTextureCoords done
06-07 01:45:30.625 26551-13444/in.medfone D/VideoCapturerAndroid: Camera fps: 28. CaptureBuffers: 3.0. Pending buffers: []
06-07 01:45:35.485 26551-28550/in.medfone D/QBASDK: Can't parse the 'date_sent' value null: Invalid double: "null"
06-07 01:45:35.625 26551-13444/in.medfone D/VideoCapturerAndroid: Camera fps: 30. CaptureBuffers: 3.0. Pending buffers: []
06-07 01:45:35.900 26551-13433/in.medfone D/VideoRendererGui: ID: 0. Type: RENDERER_YUV. Frames received: 300. Dropped: 0. Rendered: 300
06-07 01:45:35.900 26551-13433/in.medfone D/VideoRendererGui: Duration: 9934 ms. FPS: 30.198616548669253
06-07 01:45:35.900 26551-13433/in.medfone D/VideoRendererGui: Draw time: 1869 us. Copy time: 1120 us
---记录结束----
private QBChatService connectWithChatService(){
//Create Session
QBAuth.createSession(qbUser, new QBEntityCallback<QBSession>() {
@Override
public void onSuccess(QBSession qbSession, Bundle bundle) {
QBChatService.getInstance().addConnectionListener(connectionListener);
currentQBSession=qbSession;
login();
}
@Override
public void onError(QBResponseException e) {
currentQBSession=null;
throwStatusMessages("Medfone Communication Hub Session Error - "+e.getMessage(), NotificationType.NOT_DEBUG_MESSAGE);
}
});
return chatService;
}
private void login(){
//Login to chat service
chatService.login(qbUser, new QBEntityCallback() {
@Override
public void onSuccess(Object o, Bundle bundle) {
QBChatService.getInstance().getMessageStatusesManager()
.addMessageStatusListener(new QBMessageStatusListener() {
@Override
public void processMessageDelivered(String s, String s1, Integer integer) {
Log.d("MFSession", s+" Message delivered");
}
@Override
public void processMessageRead(String s, String s1, Integer integer) {
Log.d("MFSession", s+" Message read");
if(textChatMessageStack.containsKey(s))
textChatMessageStack.remove(s);
}
});
try {
token=BaseService.getBaseService().getToken();
dateTokenExpiration=BaseService.getBaseService().getTokenExpirationDate();
Log.d("MFSession", "Token= "+token);
Log.d("MFSession", "DExp= "+dateTokenExpiration.toString());
} catch (BaseServiceException e) {
e.printStackTrace();
}
try{
initQBRTCClient();
throwStatusMessages("Successfully connected to Medfone communication hub", NotificationType.IS_DEBUG_MESSAGE);
}catch (Exception e){
e.printStackTrace();
}
}
@Override
public void onError(QBResponseException e) {
throwStatusMessages("Medfone communication hub Login Error - "+e.getMessage(), NotificationType.NOT_DEBUG_MESSAGE);
}
});
}
和QBRTCClient:
private void initQBRTCClient() throws Exception{
if(!isLoggedInToService){
connectWithChatService();
}
rtcClient = QBRTCClient.getInstance(this);
// Add signalling manager
QBChatService.getInstance().getVideoChatWebRTCSignalingManager()
.addSignalingManagerListener(new QBVideoChatSignalingManagerListener() {
@Override
public void signalingCreated(QBSignaling qbSignaling, boolean createdLocally) {
if (!createdLocally) {
rtcClient.addSignaling((QBWebRTCSignaling) qbSignaling);
}
}
});
rtcClient.setCameraErrorHendler(new VideoCapturerAndroid.CameraErrorHandler() {
@Override
public void onCameraError(final String s) {
}
});
QBRTCConfig.setMaxOpponentsCount(1);
QBRTCConfig.setDisconnectTime(30);
QBRTCConfig.setAnswerTimeInterval(30l);
QBRTCConfig.setDebugEnabled(false);
QBRTCConfig.setDialingTimeInterval(10);
//Set up Turn servers
try{
List<PeerConnection.IceServer> iceServerList = new LinkedList<>();
iceServerList.add(new PeerConnection.IceServer("turn:turn.quickblox.com:3478", "quickblox", "baccb97ba2d92d71e26eb9886da5f1e0"));
iceServerList.add(new PeerConnection.IceServer("turn:turnsingapore.quickblox.com:3478", "quickblox", "baccb97ba2d92d71e26eb9886da5f1e0"));
iceServerList.add(new PeerConnection.IceServer("turn:turnireland.quickblox.com:3478", "quickblox", "baccb97ba2d92d71e26eb9886da5f1e0"));
QBRTCConfig.setIceServerList(iceServerList);
}catch(Exception e){
}
rtcClient.addSessionCallbacksListener(this);
rtcClient.prepareToProcessCalls();
throwStatusMessages("Successfully connected to Medfone communication hub", NotificationType.IS_DEBUG_MESSAGE);
}