|
一共发了两次DEMO的代码,你们用后面发的代码测试了吗?我这边测试正常
第二次的改动主要是被动接收invte时的回调处理:@Override
public void OnPasvDialogEvent(int hDialog, int iEventCode, BVCU_Event_DialogCmd pParam) {
Log.d(TAG, "被动 OnPasvDialogEvent hDialog :" + hDialog + " iEventCode : " +iEventCode + " pParam : " + new Gson().toJson(pParam));
if (myBvcuEventCallback != null) {
myBvcuEventCallback.OnPasvDialogEvent(hDialog, iEventCode, pParam);
}
int channelIndex = pParam.pDialogParam.pTarget[0].iIndexMajor;
int dir = pParam.pDialogParam.iAVStreamDir;
Log.d(TAG, "OnPasvDialogEvent------hDialog=" + hDialog + ",iEventCode=" + iEventCode + ",channelIndex=" + channelIndex + ",dir=" + dir);
switch (iEventCode) {
case BVCU_EVENT_DIALOG.BVCU_EVENT_DIALOG_OPEN:
Log.d(TAG, "DIALOG_OPEN命令");
if (pParam.iResult == BVCU_Result.BVCU_RESULT_S_PENDING) {
}
break;
case BVCU_EVENT_DIALOG.BVCU_EVENT_DIALOG_CLOSE:
Log.d(TAG, "DIALOG_CLOSE命令");
if (channelIndex == BVCU_SubDev.BVCU_SUBDEV_INDEXMAJOR_MIN_CHANNEL) {
tempAvDir = 0;
if (dir == 0) {
sendVideoData = false;
if (recorderUtils.isRecording()) {
recorderUtils.stopRecorder();
}
mHandler.sendEmptyMessage(MESSAGE_TRANSFER_NOTHING);
}
}
if (channelIndex == BVCU_SubDev.BVCU_SUBDEV_INDEXMAJOR_MIN_GPS && dir == 0) {
locationTools.stopLocation();
}
break;
}
}
@Override
public int OnPasvDialogCmd(int hDialog, int iEventCode, BVCU_DialogParam pParam) {
Log.d(TAG, "被动 OnPasvDialogCmd hDialog :" + hDialog + " iEventCode : " + iEventCode + " pParam : " + new Gson().toJson(pParam));
if (myBvcuEventCallback != null) {
myBvcuEventCallback.OnPasvDialogCmd(hDialog, iEventCode, pParam);
}
int channelIndex = pParam.pTarget[0].iIndexMajor;
int avDir = pParam.iAVStreamDir;
Log.d(TAG, "OnPasvDialogCmd ------channelIndex=" + channelIndex + ",avDir=" + avDir);
if (channelIndex >= BVCU_SubDev.BVCU_SUBDEV_INDEXMAJOR_MIN_CHANNEL && channelIndex <= BVCU_SubDev.BVCU_SUBDEV_INDEXMAJOR_MAX_CHANNEL) {
Message message = Message.obtain();
message.what = MESSAGE_TRANSFER_STATUS;
message.obj = getTransferState(avDir);
mHandler.sendMessage(message);
/*****************************************************/
if ((avDir & BVCU_MEDIADIR_VIDEOSEND) == BVCU_MEDIADIR_VIDEOSEND &&
(tempAvDir & BVCU_MEDIADIR_VIDEOSEND) != BVCU_MEDIADIR_VIDEOSEND) {
sendVideoData = true;
} else if ((tempAvDir & BVCU_MEDIADIR_VIDEOSEND) == BVCU_MEDIADIR_VIDEOSEND
&& (avDir & BVCU_MEDIADIR_VIDEOSEND) != BVCU_MEDIADIR_VIDEOSEND) {
sendVideoData = false;
}
if ((avDir & BVCU_MEDIADIR_AUDIOSEND) == BVCU_MEDIADIR_AUDIOSEND &&
(tempAvDir & BVCU_MEDIADIR_AUDIOSEND) != BVCU_MEDIADIR_AUDIOSEND) {
if (!recorderUtils.isRecording()) {
recorderUtils.startRecorder();
}
} else if ((avDir & BVCU_MEDIADIR_AUDIOSEND) != BVCU_MEDIADIR_AUDIOSEND &&
(tempAvDir & BVCU_MEDIADIR_AUDIOSEND) == BVCU_MEDIADIR_AUDIOSEND) {
if (recorderUtils.isRecording()) {
recorderUtils.stopRecorder();
}
}
/*****************************************************/
updateParam(pParam);
tempAvDir = avDir;
} else if (channelIndex >= BVCU_SubDev.BVCU_SUBDEV_INDEXMAJOR_MIN_GPS && channelIndex <= BVCU_SubDev.BVCU_SUBDEV_INDEXMAJOR_MAX_GPS) {
if (avDir == BVCU_MediaDir.BVCU_MEDIADIR_DATASEND) {
locationTools.startLocation();
}
}
return 0;
}
|
|