Name: libmm-camcorder
Summary: Camera and recorder library
-Version: 0.10.49
+Version: 0.10.50
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0
#define _MMCAMCORDER_GET_COND(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).cond)
#define _MMCAMCORDER_WAIT(handle) g_cond_wait(&_MMCAMCORDER_GET_COND(handle), &_MMCAMCORDER_GET_LOCK(handle))
-#define _MMCAMCORDER_WAIT_UNTIL(handle, timeout) g_cond_wait_until(&_MMCAMCORDER_GET_COND(handle), &_MMCAMCORDER_GET_LOCK(handle), &end_time)
+#define _MMCAMCORDER_WAIT_UNTIL(handle, end_time) g_cond_wait_until(&_MMCAMCORDER_GET_COND(handle), &_MMCAMCORDER_GET_LOCK(handle), end_time)
#define _MMCAMCORDER_SIGNAL(handle) g_cond_signal(&_MMCAMCORDER_GET_COND(handle));
#define _MMCAMCORDER_BROADCAST(handle) g_cond_broadcast(&_MMCAMCORDER_GET_COND(handle));
/* for command */
#define _MMCAMCORDER_GET_CMD_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).cmd_lock)
+#define _MMCAMCORDER_GET_CMD_COND(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).cmd_cond)
#define _MMCAMCORDER_LOCK_CMD(handle) _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_CMD_LOCK(handle))
#define _MMCAMCORDER_TRYLOCK_CMD(handle) _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_CMD_LOCK(handle))
#define _MMCAMCORDER_UNLOCK_CMD(handle) _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_CMD_LOCK(handle))
+#define _MMCAMCORDER_CMD_WAIT(handle) g_cond_wait(&_MMCAMCORDER_GET_CMD_COND(handle), &_MMCAMCORDER_GET_CMD_LOCK(handle))
+#define _MMCAMCORDER_CMD_WAIT_UNTIL(handle, end_time) g_cond_wait_until(&_MMCAMCORDER_GET_CMD_COND(handle), &_MMCAMCORDER_GET_CMD_LOCK(handle), end_time)
+#define _MMCAMCORDER_CMD_SIGNAL(handle) g_cond_signal(&_MMCAMCORDER_GET_CMD_COND(handle));
/* for ASM */
#define _MMCAMCORDER_GET_ASM_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).asm_lock)
GMutex lock; /**< Mutex (for general use) */
GCond cond; /**< Condition (for general use) */
GMutex cmd_lock; /**< Mutex (for command) */
+ GCond cmd_cond; /**< Condition (for command) */
GMutex asm_lock; /**< Mutex (for ASM) */
GMutex state_lock; /**< Mutex (for state change) */
GMutex gst_state_lock; /**< Mutex (for gst pipeline state change) */
g_mutex_init(&(hcamcorder->mtsafe).lock);
g_cond_init(&(hcamcorder->mtsafe).cond);
g_mutex_init(&(hcamcorder->mtsafe).cmd_lock);
+ g_cond_init(&(hcamcorder->mtsafe).cmd_cond);
g_mutex_init(&(hcamcorder->mtsafe).asm_lock);
g_mutex_init(&(hcamcorder->mtsafe).state_lock);
g_mutex_init(&(hcamcorder->mtsafe).gst_state_lock);
g_mutex_clear(&(hcamcorder->mtsafe).lock);
g_cond_clear(&(hcamcorder->mtsafe).cond);
g_mutex_clear(&(hcamcorder->mtsafe).cmd_lock);
+ g_cond_clear(&(hcamcorder->mtsafe).cmd_cond);
g_mutex_clear(&(hcamcorder->mtsafe).asm_lock);
g_mutex_clear(&(hcamcorder->mtsafe).state_lock);
g_mutex_clear(&(hcamcorder->mtsafe).gst_state_lock);
g_mutex_clear(&(hcamcorder->mtsafe).lock);
g_cond_clear(&(hcamcorder->mtsafe).cond);
g_mutex_clear(&(hcamcorder->mtsafe).cmd_lock);
+ g_cond_clear(&(hcamcorder->mtsafe).cmd_cond);
g_mutex_clear(&(hcamcorder->mtsafe).asm_lock);
g_mutex_clear(&(hcamcorder->mtsafe).state_lock);
g_mutex_clear(&(hcamcorder->mtsafe).gst_state_lock);
} else if (!info->played_capture_sound) {
_mmcamcorder_sound_solo_play((MMHandleType)hcamcorder, _MMCAMCORDER_SAMPLE_SOUND_NAME_CAPTURE01, FALSE);
}
- } else {
- /* Handle capture in recording case */
- hcamcorder->capture_in_recording = FALSE;
-
- g_mutex_lock(&hcamcorder->task_thread_lock);
-
- if (hcamcorder->task_thread_state == _MMCAMCORDER_TASK_THREAD_STATE_CHECK_CAPTURE_IN_RECORDING) {
- _mmcam_dbg_log("send signal for capture in recording");
- g_cond_signal(&hcamcorder->task_thread_cond);
- } else {
- _mmcam_dbg_warn("unexpected task thread state : %d", hcamcorder->task_thread_state);
- }
-
- g_mutex_unlock(&hcamcorder->task_thread_lock);
}
/* init capture data */
}
}
+ if (current_state >= MM_CAMCORDER_STATE_RECORDING) {
+ /* Handle capture in recording case */
+ hcamcorder->capture_in_recording = FALSE;
+
+ g_mutex_lock(&hcamcorder->task_thread_lock);
+
+ if (hcamcorder->task_thread_state == _MMCAMCORDER_TASK_THREAD_STATE_CHECK_CAPTURE_IN_RECORDING) {
+ _mmcam_dbg_log("send signal for capture in recording");
+ g_cond_signal(&hcamcorder->task_thread_cond);
+ } else {
+ _mmcam_dbg_warn("unexpected task thread state : %d", hcamcorder->task_thread_state);
+ }
+
+ g_mutex_unlock(&hcamcorder->task_thread_lock);
+
+ _MMCAMCORDER_CMD_SIGNAL(hcamcorder);
+ }
+
_mmcam_dbg_err("END");
return;
}
}
- usleep(_MMCAMCORDER_FRAME_WAIT_TIME);
+ if (hcamcorder->capture_in_recording) {
+ gint64 end_time = g_get_monotonic_time() + (200 * G_TIME_SPAN_MILLISECOND);
+ if (_MMCAMCORDER_CMD_WAIT_UNTIL(handle, end_time)) {
+ _mmcam_dbg_warn("signal received");
+ } else {
+ _mmcam_dbg_warn("timeout");
+ }
+ } else {
+ usleep(_MMCAMCORDER_FRAME_WAIT_TIME);
+ }
}
/* block push buffer */