|
@@ -1191,14 +1191,17 @@ static void cap_on_original_frame(void* user_data, video_frame* vframe)
|
|
|
video_capture_t* video_cap = (video_capture_t*)user_data;
|
|
|
#ifdef RVC_OS_WIN
|
|
|
share_queue* shm_queue = &video_cap->original_shm_queue;
|
|
|
- if (!shared_queue_push_video(shm_queue, (uint32_t*)vframe->linesize, vframe->width, vframe->height, vframe->data, os_gettime_ns())) {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("caution: insert original frame to shm video failed!");
|
|
|
+ if (shm_queue->hwnd != NULL && shm_queue->header != NULL) {
|
|
|
+ if (!shared_queue_push_video(shm_queue, (uint32_t*)vframe->linesize, vframe->width, vframe->height, vframe->data, os_gettime_ns())) {
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("caution: insert original frame to shm video failed!");
|
|
|
+ }
|
|
|
+ //else {
|
|
|
+ // share_queue original_queue = video_cap->original_shm_queue;
|
|
|
+ // DEBUG_QUEUE_INFO(original_queue)
|
|
|
+ // DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("insert original frame to shm video ok, and video frame id is %d.", video_cap->frame_id);
|
|
|
+ //}
|
|
|
}
|
|
|
- //else {
|
|
|
- // share_queue original_queue = video_cap->original_shm_queue;
|
|
|
- // DEBUG_QUEUE_INFO(original_queue)
|
|
|
- // DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("insert original frame to shm video ok, and video frame id is %d.", video_cap->frame_id);
|
|
|
- //}
|
|
|
+
|
|
|
#else
|
|
|
if (-1 != video_cap->virtual_device_fd) {
|
|
|
size_t udatalen = vframe->linesize[0] * vframe->height;
|
|
@@ -1234,8 +1237,6 @@ static video_capture_t *video_capture_create(capture_t *cap, int camera_type)
|
|
|
video_cap->isaveinterval = 0;
|
|
|
#endif
|
|
|
#endif
|
|
|
- uint64_t interval = (uint64_t)1000000000ULL / (uint64_t)cap->config.video_env_fps;
|
|
|
- int iqueuelen = cap->config.video_env_fps;
|
|
|
if (camera_type == CAMERA_TYPE_ENV) {
|
|
|
video_cap->snapshot_shm_queue = new Clibvideoqueue(REC_COMMON_VIDEO_ENV_SHM_SNAPSHOT_QUEUE);
|
|
|
video_cap->rtp_shm_queue = new Clibvideoqueue(REC_COMMON_VIDEO_ENV_SHM_RTP_QUEUE);
|
|
@@ -1256,8 +1257,6 @@ static video_capture_t *video_capture_create(capture_t *cap, int camera_type)
|
|
|
SWS_FAST_BILINEAR, NULL, NULL, NULL);
|
|
|
}
|
|
|
else {
|
|
|
- interval = (uint64_t)1000000000ULL / (uint64_t)cap->config.video_opt_fps;
|
|
|
- iqueuelen = cap->config.video_opt_fps;
|
|
|
video_cap->snapshot_shm_queue = new Clibvideoqueue(REC_COMMON_VIDEO_OPT_SHM_SNAPSHOT_QUEUE);
|
|
|
video_cap->rtp_shm_queue = new Clibvideoqueue(REC_COMMON_VIDEO_OPT_SHM_RTP_QUEUE);
|
|
|
video_cap->rtp_sws_ctx = sws_getContext(REC_COMMON_VIDEO_SNAPSHOT_HEIGHT,
|
|
@@ -1278,17 +1277,24 @@ static video_capture_t *video_capture_create(capture_t *cap, int camera_type)
|
|
|
}
|
|
|
|
|
|
#ifdef RVC_OS_WIN
|
|
|
- bool bret = shared_queue_create(&video_cap->original_shm_queue, camera_type,
|
|
|
- VIDEO_FORMAT_YUY2, REC_COMMON_VIDEO_SNAPSHOT_WIDTH, REC_COMMON_VIDEO_SNAPSHOT_HEIGHT, interval,
|
|
|
- iqueuelen);
|
|
|
+ int idevid = capture_get_video_device_id((camera_type == CAMERA_TYPE_ENV) ? RVC_ENV_VIRTUALCAMERA : RVC_OPT_VIRTUALCAMERA);
|
|
|
+ if (idevid >= 0) {
|
|
|
+ int ivideo_cap_fps = ((camera_type == CAMERA_TYPE_ENV) ? cap->config.video_env_fps : cap->config.video_opt_fps);
|
|
|
+ uint64_t interval = (uint64_t)1000000000ULL / (uint64_t)ivideo_cap_fps;
|
|
|
+ int iqueuelen = ivideo_cap_fps;
|
|
|
|
|
|
- if (bret) {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("create %s original share video queue success.", (camera_type == CAMERA_TYPE_ENV) ? "env":"opt");
|
|
|
- share_queue original_queue = video_cap->original_shm_queue;
|
|
|
- DEBUG_QUEUE_INFO(original_queue)
|
|
|
- }
|
|
|
- else {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("create %s original share video queue failed.", (camera_type == CAMERA_TYPE_ENV) ? "env" : "opt");
|
|
|
+ bool bret = shared_queue_create(&video_cap->original_shm_queue, camera_type,
|
|
|
+ VIDEO_FORMAT_YUY2, REC_COMMON_VIDEO_SNAPSHOT_WIDTH, REC_COMMON_VIDEO_SNAPSHOT_HEIGHT, interval,
|
|
|
+ iqueuelen);
|
|
|
+
|
|
|
+ if (bret) {
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("create %s original share video queue success.", (camera_type == CAMERA_TYPE_ENV) ? "env" : "opt");
|
|
|
+ share_queue original_queue = video_cap->original_shm_queue;
|
|
|
+ DEBUG_QUEUE_INFO(original_queue)
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("create %s original share video queue failed.", (camera_type == CAMERA_TYPE_ENV) ? "env" : "opt");
|
|
|
+ }
|
|
|
}
|
|
|
#else
|
|
|
video_cap->virtual_device_fd = -1;
|
|
@@ -1343,9 +1349,14 @@ static void video_capture_destroy(video_capture_t *video_cap)
|
|
|
}
|
|
|
|
|
|
#ifdef RVC_OS_WIN
|
|
|
- shared_queue_write_close(&video_cap->original_shm_queue);
|
|
|
+ share_queue* q = &video_cap->original_shm_queue;
|
|
|
+ if ((NULL != q->hwnd) && (NULL != q->header)) {
|
|
|
+ shared_queue_write_close(&video_cap->original_shm_queue);
|
|
|
+ }
|
|
|
#else
|
|
|
- rvc_videocap_close_video_device(video_cap->virtual_device_fd);
|
|
|
+ if (-1 != video_cap->virtual_device_fd) {
|
|
|
+ rvc_videocap_close_video_device(video_cap->virtual_device_fd);
|
|
|
+ }
|
|
|
#endif
|
|
|
|
|
|
FREE(video_cap);
|
|
@@ -1849,8 +1860,6 @@ namespace MediaController {
|
|
|
|
|
|
ErrorCodeEnum capture_start(capture_t *cap, bool bstartaudio)
|
|
|
{
|
|
|
- int rc = 0;
|
|
|
-
|
|
|
if (bstartaudio) {
|
|
|
if ('N' == cap->config.strAudioState[0] || 'P' == cap->config.strAudioState[0]) {
|
|
|
ErrorCodeEnum rslt = start_audio_capture(cap->handfree_audio);
|
|
@@ -2085,7 +2094,7 @@ namespace MediaController {
|
|
|
|
|
|
char t2[MAX_PATH] = {0};
|
|
|
strcpy(t2, t1);
|
|
|
- for (int j = 0; j < strlen(t2); ++j)
|
|
|
+ for (int j = 0; j < (int)strlen(t2); ++j)
|
|
|
{
|
|
|
t2[j] = toupper(t2[j]);
|
|
|
if (t2[j] == '#') t2[j] = '\\';
|
|
@@ -2200,7 +2209,7 @@ namespace MediaController {
|
|
|
char t[MAX_PATH] = { 0 };
|
|
|
WCHAR tmp1[MAX_PATH] = { 0 };
|
|
|
char t1[MAX_PATH] = { 0 };
|
|
|
- WCHAR tmp2[MAX_PATH] = { 0 };
|
|
|
+ //WCHAR tmp2[MAX_PATH] = { 0 };
|
|
|
char t2[MAX_PATH] = { 0 };
|
|
|
videocap_get_device_name(i, tmp, ARRAYSIZE(tmp));
|
|
|
WideCharToMultiByte(CP_ACP, 0, tmp, -1, t, sizeof(t), 0, NULL);
|