Remove unused configuration
[platform/core/multimedia/libmm-camcorder.git] / src / mm_camcorder_audiorec.c
index 5856eab..fc8768c 100644 (file)
@@ -88,17 +88,17 @@ static int __mmcamcorder_create_audiop_with_encodebin(MMHandleType handle)
 
        info = (_MMCamcorderAudioInfo *)sc->info_audio;
 
-       _mmcam_dbg_log("");
+       MMCAM_LOG_INFO("");
 
        mux_elem = _mmcamcorder_get_type_element(handle, MM_CAM_FILE_FORMAT);
        err = _mmcamcorder_conf_get_value_element_name(mux_elem, &mux_name);
 
        if (!mux_name || !strcmp(mux_name, "wavenc")) {
                /* IF MUX in not chosen then record in raw file */
-               _mmcam_dbg_log("Record without muxing.");
+               MMCAM_LOG_INFO("Record without muxing.");
                info->bMuxing = FALSE;
        } else {
-               _mmcam_dbg_log("Record with mux.");
+               MMCAM_LOG_INFO("Record with mux.");
                info->bMuxing = TRUE;
        }
 
@@ -129,7 +129,7 @@ static int __mmcamcorder_create_audiop_with_encodebin(MMHandleType handle)
                        MMCAM_TARGET_FILENAME, &file_name, &file_name_len,
                        NULL);
                if (err != MM_ERROR_NONE) {
-                       _mmcam_dbg_err("failed to get filename [0x%x]", err);
+                       MMCAM_LOG_ERROR("failed to get filename [0x%x]", err);
                        err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
                        goto pipeline_creation_error;
                }
@@ -137,14 +137,14 @@ static int __mmcamcorder_create_audiop_with_encodebin(MMHandleType handle)
                /* without muxing. can't use encodebin. */
                aenc_elem = _mmcamcorder_get_type_element(handle, MM_CAM_AUDIO_ENCODER);
                if (!aenc_elem) {
-                       _mmcam_dbg_err("Fail to get type element");
+                       MMCAM_LOG_ERROR("Fail to get type element");
                        err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
                        goto pipeline_creation_error;
                }
 
                err = _mmcamcorder_conf_get_value_element_name(aenc_elem, &aenc_name);
                if ((!err) || (!aenc_name)) {
-                       _mmcam_dbg_err("Fail to get element name");
+                       MMCAM_LOG_ERROR("Fail to get element name");
                        err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
                        goto pipeline_creation_error;
                }
@@ -164,7 +164,7 @@ static int __mmcamcorder_create_audiop_with_encodebin(MMHandleType handle)
                        &sink_elem);
                _mmcamcorder_conf_get_value_element_name(sink_elem, &sink_name);
 
-               _mmcam_dbg_log("encode sink : %s", sink_name);
+               MMCAM_LOG_INFO("encode sink : %s", sink_name);
 
                _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCSINK_SINK, sink_name, NULL, element_list, err);
 
@@ -172,14 +172,14 @@ static int __mmcamcorder_create_audiop_with_encodebin(MMHandleType handle)
 
                /* add elements to encode pipeline */
                if (!_mmcamcorder_add_elements_to_bin(GST_BIN(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst), element_list)) {
-                       _mmcam_dbg_err("add encode elements error.");
+                       MMCAM_LOG_ERROR("add encode elements error.");
                        err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
                        goto pipeline_creation_error;
                }
 
                /* link elements */
                if (!_mmcamcorder_link_elements(element_list)) {
-                       _mmcam_dbg_err("encode element link error.");
+                       MMCAM_LOG_ERROR("encode element link error.");
                        err = MM_ERROR_CAMCORDER_GST_LINK;
                        goto pipeline_creation_error;
                }
@@ -213,9 +213,6 @@ static int __mmcamcorder_create_audiop_with_encodebin(MMHandleType handle)
 
        bus = gst_pipeline_get_bus(GST_PIPELINE(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst));
 
-       /* register message callback  */
-       hcamcorder->pipeline_cb_event_id = gst_bus_add_watch(bus, (GstBusFunc)_mmcamcorder_pipeline_cb_message, hcamcorder);
-
        /* set sync callback */
        gst_bus_set_sync_handler(bus, _mmcamcorder_encode_pipeline_bus_sync_callback, hcamcorder, NULL);
 
@@ -285,10 +282,10 @@ _mmcamcorder_destroy_audio_pipeline(MMHandleType handle)
 
        info = sc->info_audio;
 
-       _mmcam_dbg_log("start");
+       MMCAM_LOG_INFO("start");
 
        if (sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst) {
-               _mmcam_dbg_warn("release audio pipeline");
+               MMCAM_LOG_WARNING("release audio pipeline");
 
                _mmcamcorder_gst_set_state(handle, sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst, GST_STATE_NULL);
 
@@ -313,7 +310,7 @@ _mmcamcorder_destroy_audio_pipeline(MMHandleType handle)
                gst_object_unref(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst);
        }
 
-       _mmcam_dbg_log("done");
+       MMCAM_LOG_INFO("done");
 
        return;
 }
@@ -342,7 +339,7 @@ _mmcamcorder_audio_command(MMHandleType handle, int command)
        pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst;
        info = sc->info_audio;
 
-       _mmcam_dbg_log("");
+       MMCAM_LOG_INFO("");
 
        pipeline = sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst;
        audioSrc = sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst;
@@ -370,13 +367,13 @@ _mmcamcorder_audio_command(MMHandleType handle, int command)
                                MMCAM_ROOT_DIRECTORY, &hcamcorder->root_directory, &root_directory_length,
                                NULL);
                        if (ret != MM_ERROR_NONE) {
-                               _mmcam_dbg_warn("failed to get attribute. (%s:%x)", err_attr_name, ret);
+                               MMCAM_LOG_WARNING("failed to get attribute. (%s:%x)", err_attr_name, ret);
                                SAFE_FREE(err_attr_name);
                                goto _ERR_CAMCORDER_AUDIO_COMMAND;
                        }
 
                        if (!target_filename && !hcamcorder->mstream_cb) {
-                               _mmcam_dbg_err("filename is not set and muxed stream cb is NULL");
+                               MMCAM_LOG_ERROR("filename is not set and muxed stream cb is NULL");
                                ret = MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
                                goto _ERR_CAMCORDER_AUDIO_COMMAND;
                        }
@@ -386,15 +383,15 @@ _mmcamcorder_audio_command(MMHandleType handle, int command)
                        if (target_filename) {
                                info->filename = g_strdup(target_filename);
                                if (!info->filename) {
-                                       _mmcam_dbg_err("STRDUP was failed for [%s]", target_filename);
+                                       MMCAM_LOG_ERROR("STRDUP was failed for [%s]", target_filename);
                                        goto _ERR_CAMCORDER_AUDIO_COMMAND;
                                }
 
-                               _mmcam_dbg_log("Record start : file name [%s]", info->filename);
+                               MMCAM_LOG_INFO("Record start : file name [%s]", info->filename);
 
                                MMCAMCORDER_G_OBJECT_SET_POINTER(sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst, "location", info->filename);
                        } else {
-                               _mmcam_dbg_log("Recorded data will be written in [%s]", _MMCamcorder_FILENAME_NULL);
+                               MMCAM_LOG_INFO("Recorded data will be written in [%s]", _MMCamcorder_FILENAME_NULL);
                                MMCAMCORDER_G_OBJECT_SET_POINTER(sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst, "location", _MMCamcorder_FILENAME_NULL);
                        }
 
@@ -419,7 +416,7 @@ _mmcamcorder_audio_command(MMHandleType handle, int command)
                        ret = _mmcamcorder_get_storage_validity(handle, info->filename,
                                _MMCAMCORDER_AUDIO_MINIMUM_SPACE, &storage_validity);
                        if (ret != MM_ERROR_NONE || !storage_validity) {
-                               _mmcam_dbg_err("storage validation failed[0x%x]:%d", ret, storage_validity);
+                               MMCAM_LOG_ERROR("storage validation failed[0x%x]:%d", ret, storage_validity);
                                return ret;
                        }
 
@@ -438,7 +435,7 @@ _mmcamcorder_audio_command(MMHandleType handle, int command)
                int count = 0;
 
                if (info->b_committing) {
-                       _mmcam_dbg_warn("now on commiting previous file!!(cmd : %d)", cmd);
+                       MMCAM_LOG_WARNING("now on commiting previous file!!(cmd : %d)", cmd);
                        return MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
                }
 
@@ -446,11 +443,11 @@ _mmcamcorder_audio_command(MMHandleType handle, int command)
                        if (info->filesize > 0) {
                                break;
                        } else if (count == _MMCAMCORDER_RETRIAL_COUNT) {
-                               _mmcam_dbg_err("Pause fail, wait 200 ms, but file size is %"G_GUINT64_FORMAT,
+                               MMCAM_LOG_ERROR("Pause fail, wait 200 ms, but file size is %"G_GUINT64_FORMAT,
                                        info->filesize);
                                return MM_ERROR_CAMCORDER_INVALID_CONDITION;
                        } else {
-                               _mmcam_dbg_warn("Wait for enough audio frame, retry count[%d], file size is %"G_GUINT64_FORMAT,
+                               MMCAM_LOG_WARNING("Wait for enough audio frame, retry count[%d], file size is %"G_GUINT64_FORMAT,
                                        count, info->filesize);
                        }
                        usleep(_MMCAMCORDER_FRAME_WAIT_TIME);
@@ -468,7 +465,7 @@ _mmcamcorder_audio_command(MMHandleType handle, int command)
 
        case _MMCamcorder_CMD_CANCEL:
                if (info->b_committing) {
-                       _mmcam_dbg_warn("now on commiting previous file!!(cmd : %d)", cmd);
+                       MMCAM_LOG_WARNING("now on commiting previous file!!(cmd : %d)", cmd);
                        return MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
                }
 
@@ -495,7 +492,7 @@ _mmcamcorder_audio_command(MMHandleType handle, int command)
                sc->isMaxtimePausing = FALSE;
 
                if (info->filename) {
-                       _mmcam_dbg_log("file delete(%s)", info->filename);
+                       MMCAM_LOG_INFO("file delete(%s)", info->filename);
                        unlink(info->filename);
                        SAFE_G_FREE(info->filename);
                }
@@ -505,13 +502,13 @@ _mmcamcorder_audio_command(MMHandleType handle, int command)
        {
                int count = 0;
                guint64 free_space = 0;
-               _mmcam_dbg_log("_MMCamcorder_CMD_COMMIT");
+               MMCAM_LOG_INFO("_MMCamcorder_CMD_COMMIT");
 
                if (info->b_committing) {
-                       _mmcam_dbg_warn("now on commiting previous file!!(cmd : %d)", cmd);
+                       MMCAM_LOG_WARNING("now on commiting previous file!!(cmd : %d)", cmd);
                        return MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
                } else {
-                       _mmcam_dbg_log("_MMCamcorder_CMD_COMMIT : start");
+                       MMCAM_LOG_INFO("_MMCamcorder_CMD_COMMIT : start");
                        info->b_committing = TRUE;
                }
 
@@ -519,11 +516,11 @@ _mmcamcorder_audio_command(MMHandleType handle, int command)
                        if (info->filesize > 0) {
                                break;
                        } else if (count == _MMCAMCORDER_RETRIAL_COUNT) {
-                               _mmcam_dbg_err("Commit fail, waited 200 ms, but file size is %"G_GUINT64_FORMAT, info->filesize);
+                               MMCAM_LOG_ERROR("Commit fail, waited 200 ms, but file size is %"G_GUINT64_FORMAT, info->filesize);
                                        info->b_committing = FALSE;
                                return MM_ERROR_CAMCORDER_INVALID_CONDITION;
                        } else {
-                               _mmcam_dbg_warn("Waiting for enough audio frame, re-count[%d], file size is %"G_GUINT64_FORMAT,
+                               MMCAM_LOG_WARNING("Waiting for enough audio frame, re-count[%d], file size is %"G_GUINT64_FORMAT,
                                        count, info->filesize);
                        }
                        usleep(_MMCAMCORDER_FRAME_WAIT_TIME);
@@ -531,20 +528,20 @@ _mmcamcorder_audio_command(MMHandleType handle, int command)
 
                _mmcamcorder_get_freespace(hcamcorder->storage_info.type, &free_space);
                if (free_space < _MMCAMCORDER_AUDIO_MINIMUM_SPACE) {
-                       _mmcam_dbg_warn("_MMCamcorder_CMD_COMMIT out of storage [%" G_GUINT64_FORMAT "]", free_space);
+                       MMCAM_LOG_WARNING("_MMCamcorder_CMD_COMMIT out of storage [%" G_GUINT64_FORMAT "]", free_space);
                        ret = MM_ERROR_OUT_OF_STORAGE;
                        goto _ERR_CAMCORDER_AUDIO_COMMAND;
                }
 
                if (audioSrc) {
                        if (gst_element_send_event(audioSrc, gst_event_new_eos()) == FALSE) {
-                               _mmcam_dbg_err("send EOS failed");
+                               MMCAM_LOG_ERROR("send EOS failed");
                                info->b_committing = FALSE;
                                ret = MM_ERROR_CAMCORDER_INTERNAL;
                                goto _ERR_CAMCORDER_AUDIO_COMMAND;
                        }
 
-                       _mmcam_dbg_log("send EOS done");
+                       MMCAM_LOG_INFO("send EOS done");
 
                        /* for pause -> commit case */
                        if (_mmcamcorder_get_state((MMHandleType)hcamcorder) == MM_CAMCORDER_STATE_PAUSED) {
@@ -555,14 +552,14 @@ _mmcamcorder_audio_command(MMHandleType handle, int command)
                                }
                        }
                } else {
-                       _mmcam_dbg_err("No audio stream source");
+                       MMCAM_LOG_ERROR("No audio stream source");
                        info->b_committing = FALSE;
                        ret = MM_ERROR_CAMCORDER_INTERNAL;
                        goto _ERR_CAMCORDER_AUDIO_COMMAND;
                }
 
                /* wait until finishing EOS */
-               _mmcam_dbg_log("Start to wait EOS");
+               MMCAM_LOG_INFO("Start to wait EOS");
                if ((ret = _mmcamcorder_get_eos_message(handle)) != MM_ERROR_NONE) {
                        info->b_committing = FALSE;
                        goto _ERR_CAMCORDER_AUDIO_COMMAND;
@@ -604,7 +601,7 @@ int _mmcamcorder_audio_handle_eos(MMHandleType handle)
        mmf_return_val_if_fail(sc, FALSE);
        mmf_return_val_if_fail(sc->info_audio, FALSE);
 
-       _mmcam_dbg_err("");
+       MMCAM_LOG_ERROR("");
 
        info = sc->info_audio;
 
@@ -612,15 +609,11 @@ int _mmcamcorder_audio_handle_eos(MMHandleType handle)
 
        err = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY);
        if (err != MM_ERROR_NONE)
-               _mmcam_dbg_warn("Failed:_MMCamcorder_CMD_COMMIT:GST_STATE_READY. err[%x]", err);
+               MMCAM_LOG_WARNING("Failed:_MMCamcorder_CMD_COMMIT:GST_STATE_READY. err[%x]", err);
 
        /* Send recording report message to application */
        msg.id = MM_MESSAGE_CAMCORDER_AUDIO_CAPTURED;
-       report = (MMCamRecordingReport*) g_malloc(sizeof(MMCamRecordingReport));
-       if (!report) {
-               _mmcam_dbg_err("Recording report fail(%s). Out of memory.", info->filename);
-               return FALSE;
-       }
+       report = (MMCamRecordingReport *)g_malloc(sizeof(MMCamRecordingReport));
 
 /* START TAG HERE */
        /* MM_AUDIO_CODEC_AAC + MM_FILE_FORMAT_MP4 */
@@ -647,7 +640,7 @@ int _mmcamcorder_audio_handle_eos(MMHandleType handle)
 
        SAFE_G_FREE(info->filename);
 
-       _mmcam_dbg_err("_MMCamcorder_CMD_COMMIT : end");
+       MMCAM_LOG_ERROR("_MMCamcorder_CMD_COMMIT : end");
 
        info->b_committing = FALSE;
 
@@ -700,7 +693,7 @@ __mmcamcorder_get_decibel(unsigned char* raw, int size, MMCamcorderAudioFormat f
        }
 
        /*
-       _mmcam_dbg_log("size[%d],depthByte[%d],count[%d],rms[%f],db[%f]",
+       MMCAM_LOG_INFO("size[%d],depthByte[%d],count[%d],rms[%f],db[%f]",
                                        size, depthByte, count, rms, db);
        */
 
@@ -726,7 +719,7 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_voicerecorder(GstPad *pad
 
        current_state = _mmcamcorder_get_state((MMHandleType)hcamcorder);
        if (current_state < MM_CAMCORDER_STATE_PREPARE) {
-               _mmcam_dbg_warn("Not ready for stream callback");
+               MMCAM_LOG_WARNING("Not ready for stream callback");
                return GST_PAD_PROBE_OK;
        }
 
@@ -740,7 +733,7 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_voicerecorder(GstPad *pad
                NULL);
 
        if (err < 0) {
-               _mmcam_dbg_warn("Get attrs fail. (%s:%x)", err_name, err);
+               MMCAM_LOG_WARNING("Get attrs fail. (%s:%x)", err_name, err);
                SAFE_FREE(err_name);
                return err;
        }
@@ -759,20 +752,18 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_voicerecorder(GstPad *pad
 
        _MMCAMCORDER_LOCK_ASTREAM_CALLBACK(hcamcorder);
 
+       MMCAM_LOG_DEBUG("audio stream cb[%p][%"GST_TIME_FORMAT"] - fmt[%d], ch[%d], size[%"G_GSIZE_FORMAT"], dB[%f]",
+               hcamcorder->astream_cb, GST_TIME_ARGS(GST_BUFFER_PTS(buffer)), format, channel, mapinfo.size, curdcb);
+
        /* CALL audio stream callback */
        if (hcamcorder->astream_cb && buffer && mapinfo.data && mapinfo.size > 0) {
                MMCamcorderAudioStreamDataType stream;
 
-               /*
-               _mmcam_dbg_log("Call audio steramCb, data[%p], format[%d], channel[%d], length[%d], volume_dB[%f]",
-                       GST_BUFFER_DATA(buffer), format, channel, GST_BUFFER_SIZE(buffer), curdcb);
-               */
-
                stream.data = (void *)mapinfo.data;
                stream.format = format;
                stream.channel = channel;
                stream.length = mapinfo.size;
-               stream.timestamp = (unsigned int)(GST_BUFFER_PTS(buffer)/1000000);      /* nano -> msecond */
+               stream.timestamp = (unsigned int)(GST_TIME_AS_MSECONDS(GST_BUFFER_PTS(buffer)));
                stream.volume_dB = curdcb;
 
                hcamcorder->astream_cb(&stream, hcamcorder->astream_cb_param);
@@ -810,7 +801,7 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa
        audioinfo = sc->info_audio;
 
        if (sc->isMaxtimePausing || sc->isMaxsizePausing) {
-               _mmcam_dbg_warn("isMaxtimePausing[%d],isMaxsizePausing[%d]",
+               MMCAM_LOG_WARNING("isMaxtimePausing[%d],isMaxsizePausing[%d]",
                        sc->isMaxtimePausing, sc->isMaxsizePausing);
                return GST_PAD_PROBE_DROP;
        }
@@ -828,7 +819,7 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa
        }
 
        if (sc->ferror_send) {
-               _mmcam_dbg_warn("file write error, drop frames");
+               MMCAM_LOG_WARNING("file write error, drop frames");
                return GST_PAD_PROBE_DROP;
        }
 
@@ -839,7 +830,7 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa
                audioinfo->fileformat == MM_FILE_FORMAT_AAC) ? TRUE : FALSE;
        if (get_trailer_size) {
                MMCAMCORDER_G_OBJECT_GET(sc->encode_element[_MMCAMCORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size);
-               /*_mmcam_dbg_log("trailer_size %d", trailer_size);*/
+               MMCAM_LOG_VERBOSE("trailer_size %"G_GUINT64_FORMAT, trailer_size);
        } else {
                trailer_size = 0; /* no trailer */
        }
@@ -853,7 +844,7 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa
                /* check free space */
                free_space_ret = _mmcamcorder_get_freespace(hcamcorder->storage_info.type, &free_space);
                if (free_space_ret != 0) {
-                       _mmcam_dbg_err("Error occured. [%d]", free_space_ret);
+                       MMCAM_LOG_ERROR("Error occurred. [%d]", free_space_ret);
                        if (sc->ferror_count == 2 && sc->ferror_send == FALSE) {
                                sc->ferror_send = TRUE;
 
@@ -872,16 +863,16 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa
                        /* check storage state */
                        storage_get_state(hcamcorder->storage_info.id, &storage_state);
 
-                       _mmcam_dbg_warn("storage state %d", storage_state);
+                       MMCAM_LOG_WARNING("storage state %d", storage_state);
 
                        if (storage_state == STORAGE_STATE_REMOVED ||
                                storage_state == STORAGE_STATE_UNMOUNTABLE) {
-                               _mmcam_dbg_err("storage was removed!");
+                               MMCAM_LOG_ERROR("storage was removed!");
 
                                _MMCAMCORDER_LOCK(hcamcorder);
 
                                if (sc->ferror_send == FALSE) {
-                                       _mmcam_dbg_err("OUT_OF_STORAGE error");
+                                       MMCAM_LOG_ERROR("OUT_OF_STORAGE error");
 
                                        sc->ferror_send = TRUE;
 
@@ -893,7 +884,7 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa
                                        _mmcamcorder_send_message((MMHandleType)hcamcorder, &msg);
                                } else {
                                        _MMCAMCORDER_UNLOCK(hcamcorder);
-                                       _mmcam_dbg_warn("error was already sent");
+                                       MMCAM_LOG_WARNING("error was already sent");
                                }
 
                                return GST_PAD_PROBE_DROP;
@@ -901,8 +892,8 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa
                }
 
                if (free_space < (guint64)(_MMCAMCORDER_AUDIO_MINIMUM_SPACE + buffer_size + trailer_size)) {
-                       _mmcam_dbg_warn("No more space for recording!!!");
-                       _mmcam_dbg_warn("Free Space : [%" G_GUINT64_FORMAT "], file size : [%" G_GUINT64_FORMAT "]",
+                       MMCAM_LOG_WARNING("No more space for recording!!!");
+                       MMCAM_LOG_WARNING("Free Space : [%" G_GUINT64_FORMAT "], file size : [%" G_GUINT64_FORMAT "]",
                                free_space, audioinfo->filesize);
 
                        if (audioinfo->bMuxing)
@@ -919,7 +910,7 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa
        }
 
        if (!GST_CLOCK_TIME_IS_VALID(GST_BUFFER_PTS(buffer))) {
-               _mmcam_dbg_err("Buffer timestamp is invalid, check it");
+               MMCAM_LOG_ERROR("Buffer timestamp is invalid, check it");
                return GST_PAD_PROBE_DROP;
        }
 
@@ -935,13 +926,11 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa
                remained_time = (unsigned long long)((long double)rec_pipe_time * (max_size/current_size)) - rec_pipe_time;
        }
 
-       /*_mmcam_dbg_log("remained time : %u", remained_time);*/
-
        /* check max size of recorded file */
        if (audioinfo->max_size > 0 &&
                        audioinfo->max_size < audioinfo->filesize + buffer_size + trailer_size + _MMCAMCORDER_MMS_MARGIN_SPACE) {
-               _mmcam_dbg_warn("Max size!!! Recording is paused.");
-               _mmcam_dbg_warn("Max [%" G_GUINT64_FORMAT "], file [%" G_GUINT64_FORMAT "], trailer : [%" G_GUINT64_FORMAT "]", \
+               MMCAM_LOG_WARNING("Max size!!! Recording is paused.");
+               MMCAM_LOG_WARNING("Max [%" G_GUINT64_FORMAT "], file [%" G_GUINT64_FORMAT "], trailer : [%" G_GUINT64_FORMAT "]", \
                        audioinfo->max_size, audioinfo->filesize, trailer_size);
 
                /* just same as pause status. After blocking two queue, this function will not call again. */
@@ -956,7 +945,7 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa
                msg.param.recording_status.remained_time = 0;
                _mmcamcorder_send_message((MMHandleType)hcamcorder, &msg);
 
-               _mmcam_dbg_warn("Last filesize sent by message : %"G_GUINT64_FORMAT, audioinfo->filesize + trailer_size);
+               MMCAM_LOG_WARNING("Last filesize sent by message : %"G_GUINT64_FORMAT, audioinfo->filesize + trailer_size);
 
                sc->isMaxsizePausing = TRUE;
                msg.id = MM_MESSAGE_CAMCORDER_MAX_SIZE;
@@ -968,8 +957,8 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa
 
        /* check recording time limit and send recording status message */
        if (audioinfo->max_time > 0 && rec_pipe_time > audioinfo->max_time) {
-               _mmcam_dbg_warn("Current time : [%" G_GUINT64_FORMAT "], Maximum time : [%" G_GUINT64_FORMAT "]", \
-                       rec_pipe_time, audioinfo->max_time);
+               MMCAM_LOG_WARNING("Current time : [%"GST_TIME_FORMAT"], Maximum time : [%"GST_TIME_FORMAT"]",
+                       GST_TIME_ARGS(GST_BUFFER_PTS(buffer)), GST_TIME_ARGS(audioinfo->max_time * GST_MSECOND));
 
                if (audioinfo->bMuxing)
                        MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
@@ -992,6 +981,10 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa
                msg.param.recording_status.elapsed = (unsigned long long)rec_pipe_time;
                msg.param.recording_status.filesize = (unsigned long long)((audioinfo->filesize + trailer_size) >> 10);
                msg.param.recording_status.remained_time = remained_time;
+
+               MMCAM_LOG_DEBUG("audio rec[%"GST_TIME_FORMAT"], size[%"G_GUINT64_FORMAT"(trailer:%"G_GUINT64_FORMAT")]",
+                       GST_TIME_ARGS(GST_BUFFER_PTS(buffer)), audioinfo->filesize + trailer_size, trailer_size);
+
                _mmcamcorder_send_message((MMHandleType)hcamcorder, &msg);
 
                return GST_PAD_PROBE_OK;
@@ -1052,7 +1045,7 @@ static gboolean __mmcamcorder_audio_add_metadata_info_m4a(MMHandleType handle)
        f = fopen64(info->filename, "rb+");
        if (f == NULL) {
                strerror_r(errno, err_msg, 128);
-               _mmcam_dbg_err("file open failed [%s]", err_msg);
+               MMCAM_LOG_ERROR("file open failed [%s]", err_msg);
                return FALSE;
        }
 
@@ -1062,7 +1055,7 @@ static gboolean __mmcamcorder_audio_add_metadata_info_m4a(MMHandleType handle)
        if (_mmcamcorder_find_fourcc(f, MMCAM_FOURCC('u', 'd', 't', 'a'), TRUE)) {
                size_t nread = 0;
 
-               _mmcam_dbg_log("find udta container");
+               MMCAM_LOG_INFO("find udta container");
 
                /* read size */
                if (fseek(f, -8L, SEEK_CUR) != 0)
@@ -1074,7 +1067,7 @@ static gboolean __mmcamcorder_audio_add_metadata_info_m4a(MMHandleType handle)
 
                nread = fread(&buf, sizeof(char), sizeof(buf), f);
 
-               _mmcam_dbg_log("recorded file fread %zu", nread);
+               MMCAM_LOG_INFO("recorded file fread %zu", nread);
 
                udta_size = _mmcamcorder_get_container_size(buf);
 
@@ -1097,7 +1090,7 @@ static gboolean __mmcamcorder_audio_add_metadata_info_m4a(MMHandleType handle)
                if (!_mmcamcorder_update_size(f, udta_pos, current_pos))
                        goto fail;
        } else {
-               _mmcam_dbg_log("No udta container");
+               MMCAM_LOG_INFO("No udta container");
                if (fseek(f, 0, SEEK_END) != 0)
                        goto fail;
 
@@ -1112,7 +1105,7 @@ static gboolean __mmcamcorder_audio_add_metadata_info_m4a(MMHandleType handle)
 
        if (_mmcamcorder_find_fourcc(f, MMCAM_FOURCC('m', 'o', 'o', 'v'), TRUE)) {
 
-               _mmcam_dbg_log("found moov container");
+               MMCAM_LOG_INFO("found moov container");
                if (fseek(f, -8L, SEEK_CUR) != 0)
                        goto fail;
 
@@ -1124,7 +1117,7 @@ static gboolean __mmcamcorder_audio_add_metadata_info_m4a(MMHandleType handle)
                        goto fail;
 
        } else {
-               _mmcam_dbg_err("No 'moov' container");
+               MMCAM_LOG_ERROR("No 'moov' container");
                goto fail;
        }
 
@@ -1137,7 +1130,7 @@ fail:
        return FALSE;
 
 ftell_fail:
-       _mmcam_dbg_err("ftell() returns negative value.");
+       MMCAM_LOG_ERROR("ftell() returns negative value.");
        fclose(f);
        return FALSE;
 }