|
|
@@ -6,8 +6,6 @@
|
|
|
#include "../../Other/libvideohorflip/videohorflip.h"
|
|
|
#include "../../Other/libvideoframework/video_common/ffmpeg_api_cpp_adapter.h"
|
|
|
#else
|
|
|
-
|
|
|
-
|
|
|
#endif // RVC_OS_WIN
|
|
|
|
|
|
#include <locale.h>
|
|
|
@@ -571,11 +569,11 @@ static void env_cap_on_frame(void *user_data, video_frame *frame)
|
|
|
|
|
|
rc = video_shm_enqueue(video_cap->snapshot_shm_queue, frame, VIDEOQUEUE_FLAG_VERTICAL_FLIP);
|
|
|
|
|
|
- static int isnapshot_shm_queue = 0;
|
|
|
- if (isnapshot_shm_queue == 0) {
|
|
|
- video_frame_save_bmpfile("snapshot_shm_queue_1.bmp", frame);
|
|
|
- isnapshot_shm_queue++;
|
|
|
- }
|
|
|
+ //static int isnapshot_shm_queue = 0;
|
|
|
+ //if (isnapshot_shm_queue == 0) {
|
|
|
+ // video_frame_save_bmpfile("snapshot_shm_queue_1.bmp", frame);
|
|
|
+ // isnapshot_shm_queue++;
|
|
|
+ //}
|
|
|
|
|
|
if (rc != Error_Succeed)
|
|
|
{
|
|
|
@@ -593,6 +591,7 @@ static void env_cap_on_frame(void *user_data, video_frame *frame)
|
|
|
#ifdef RVC_OS_WIN
|
|
|
InterlockedDecrement(cap->config.ref_env_capture_count);
|
|
|
#else
|
|
|
+ __sync_fetch_and_sub(cap->config.ref_env_capture_count, 1);
|
|
|
#endif
|
|
|
LogEvent(Severity_Middle, MOD_EVENT_MEDIACONTROLLER_FINISHED_CAPTURE_ENV, "agent capture env ok, and capture env finished!");
|
|
|
}
|
|
|
@@ -602,7 +601,7 @@ static void env_cap_on_frame(void *user_data, video_frame *frame)
|
|
|
#ifdef RVC_OS_WIN
|
|
|
_InterlockedAnd(cap->config.ref_envopt_capture_count, 0xfffffffD);
|
|
|
#else
|
|
|
-
|
|
|
+ __sync_fetch_and_add(cap->config.ref_env_capture_count, 0xfffffffD);
|
|
|
#endif // RVC_OS_WIN
|
|
|
|
|
|
if (*cap->config.ref_envopt_capture_count == 0)
|
|
|
@@ -624,15 +623,17 @@ static void env_cap_on_frame(void *user_data, video_frame *frame)
|
|
|
Dbg("preview_shm_queue enqueue failed, error = %d", rc);
|
|
|
}
|
|
|
else {
|
|
|
- //Dbg("preview_shm_queue enqueue[%d] success, and current video queue len is %d.", video_cap->frame_id, video_cap->preview_shm_queue->GetVideoLens());
|
|
|
+ //if (0 == video_cap->frame_id%10){
|
|
|
+ // Dbg("preview_shm_queue enqueue[%d] success, and current video queue len is %d.", video_cap->frame_id, video_cap->preview_shm_queue->GetVideoLens());
|
|
|
+ //}
|
|
|
}
|
|
|
video_frame_free(&preview_frame);
|
|
|
|
|
|
- static int ipreview_shm_queue = 0;
|
|
|
- if (ipreview_shm_queue == 0) {
|
|
|
- video_frame_save_bmpfile("preview_shm_queue_1.bmp", frame);
|
|
|
- ipreview_shm_queue++;
|
|
|
- }
|
|
|
+ //static int ipreview_shm_queue = 0;
|
|
|
+ //if (ipreview_shm_queue == 0) {
|
|
|
+ // video_frame_save_bmpfile("preview_shm_queue_1.bmp", frame);
|
|
|
+ // ipreview_shm_queue++;
|
|
|
+ //}
|
|
|
}
|
|
|
// rtp
|
|
|
{
|
|
|
@@ -649,11 +650,11 @@ static void env_cap_on_frame(void *user_data, video_frame *frame)
|
|
|
// Dbg("rtp_shm_queue enqueue success!");
|
|
|
//}
|
|
|
|
|
|
- /*static*/ int irtp_frame = 0;
|
|
|
- if (irtp_frame == 0){
|
|
|
- video_frame_save_bmpfile("rtp_shm_queue.bmp", &rtp_frame);
|
|
|
- irtp_frame++;
|
|
|
- }
|
|
|
+ //static int irtp_frame = 0;
|
|
|
+ //if (irtp_frame == 0){
|
|
|
+ // video_frame_save_bmpfile("rtp_shm_queue.bmp", &rtp_frame);
|
|
|
+ // irtp_frame++;
|
|
|
+ //}
|
|
|
|
|
|
#if 0
|
|
|
static int i = 0;
|
|
|
@@ -741,22 +742,38 @@ static void opt_cap_on_frame(void *user_data, video_frame *frame)
|
|
|
{
|
|
|
Dbg("opt snapshot queue enqueue shm failed! Error = %d, camera_type=%d", rc, video_cap->camera_type);
|
|
|
}
|
|
|
- //else {
|
|
|
- // Dbg("opt snapshot queue enqueue success!" );
|
|
|
+ else {
|
|
|
+ //Dbg("opt snapshot queue enqueue[%d] success, and current video queue len is %d.", video_cap->frame_id, video_cap->snapshot_shm_queue->GetVideoLens());
|
|
|
+ }
|
|
|
+
|
|
|
+ //static int isnapshot_shm_queue = 0;
|
|
|
+ //if (isnapshot_shm_queue == 0) {
|
|
|
+ // video_frame_save_bmpfile("opt_snapshot_shm_queue.bmp", &rframe);
|
|
|
+ // isnapshot_shm_queue++;
|
|
|
//}
|
|
|
+
|
|
|
// snapshot
|
|
|
if (rc==Error_Succeed)
|
|
|
{
|
|
|
if (*cap->config.ref_opt_capture_count)
|
|
|
{
|
|
|
Dbg("opt camera ref_opt_capture_count=%d",*cap->config.ref_opt_capture_count);
|
|
|
+#ifdef RVC_OS_WIN
|
|
|
InterlockedDecrement(cap->config.ref_opt_capture_count);
|
|
|
+#else
|
|
|
+ __sync_fetch_and_sub(cap->config.ref_opt_capture_count, 1);
|
|
|
+#endif
|
|
|
LogEvent(Severity_Middle, MOD_EVENT_MEDIACONTROLLER_FINISHED_CAPTURE_OPT, "agent capture opt ok, and capture opt finished!");
|
|
|
}
|
|
|
else if (*cap->config.ref_envopt_capture_count&1)
|
|
|
{
|
|
|
Dbg("opt camera ref_envopt_capture_count=%d",*cap->config.ref_envopt_capture_count);
|
|
|
+#ifdef RVC_OS_WIN
|
|
|
if (InterlockedDecrement(cap->config.ref_envopt_capture_count) == 0)
|
|
|
+#else
|
|
|
+ __sync_fetch_and_sub(cap->config.ref_envopt_capture_count,1);
|
|
|
+ if (0 == cap->config.ref_envopt_capture_count)
|
|
|
+#endif
|
|
|
{
|
|
|
LogEvent(Severity_Middle, MOD_EVENT_MEDIACONTROLLER_FINISHED_CAPTURE_ENVOPT, "agent capture opt ok, and capture envopt finished!");
|
|
|
}
|
|
|
@@ -772,9 +789,16 @@ static void opt_cap_on_frame(void *user_data, video_frame *frame)
|
|
|
{
|
|
|
Dbg("rtp_shm_queue enqueue shm failed! Error = %d, camera_type=%d", rc, video_cap->camera_type);
|
|
|
}
|
|
|
- //else {
|
|
|
- // Dbg("rtp_shm_queue enqueue success!");
|
|
|
+ else {
|
|
|
+ //Dbg("opt rtp_shm_queue enqueue[%d] success, and current video queue len is %d.", video_cap->frame_id, video_cap->rtp_shm_queue->GetVideoLens());
|
|
|
+ }
|
|
|
+
|
|
|
+ //static int irtp_frame = 0;
|
|
|
+ //if (irtp_frame == 0){
|
|
|
+ // video_frame_save_bmpfile("opt_rtp_shm_queue.bmp", &rtp_frame);
|
|
|
+ // irtp_frame++;
|
|
|
//}
|
|
|
+
|
|
|
video_frame_free(&rtp_frame);
|
|
|
}
|
|
|
|