[0.6.143] resolve audio pipeline complexity issue 46/192546/4
authorEunhae Choi <eunhae1.choi@samsung.com>
Tue, 6 Nov 2018 08:58:35 +0000 (17:58 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Thu, 8 Nov 2018 04:04:24 +0000 (13:04 +0900)
- resolve cyclomatic complexity issue of
  __mmplayer_gst_create_audio_pipeline()
- rename the audio extract callback

Change-Id: Ib27a3fa43d460a12a6007ffc11f8df03432f5022

packaging/libmm-player.spec
src/include/mm_player.h
src/include/mm_player_internal.h
src/include/mm_player_priv.h
src/mm_player.c
src/mm_player_gst.c
src/mm_player_priv.c [changed mode: 0755->0644]

index 06bfb79..91f65b1 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    0.6.142
+Version:    0.6.143
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 11aac27..67341a5 100644 (file)
@@ -496,19 +496,6 @@ typedef struct _SubtitleStreamInfo {
 } MMPlayerSubtitleStreamInfo;
 
 /**
- * Audio stream callback function type.
- *
- * @param      stream          [in]    Reference pointer to audio frame data
- * @param      stream_size     [in]    Size of audio frame data
- * @param      user_param      [in]    User defined parameter which is passed when set
- *                                                             audio stream callback
- *
- * @return     This callback function have to return MM_ERROR_NONE.
- */
-typedef bool   (*mm_player_audio_stream_callback) (void *stream, int stream_size, void *user_param);
-
-
-/**
  * selected subtitle track number callback function type.
  *
  * @param      track_num       [in]    Track number of subtitle
index a660756..2fe959a 100644 (file)
@@ -106,7 +106,7 @@ typedef bool        (*mm_player_video_frame_render_error_callback) (void *error_id, voi
  *
  * @return     This callback function have to return MM_ERROR_NONE.
  */
-typedef bool   (*mm_player_audio_stream_callback_ex) (MMPlayerAudioStreamDataType *stream, void *user_param);
+typedef bool   (*mm_player_audio_stream_callback) (MMPlayerAudioStreamDataType *stream, void *user_param);
 /**
  * This function is to set play speed for playback.
  *
@@ -148,10 +148,10 @@ int mm_player_set_video_stream_callback(MMHandleType player, mm_player_video_str
  * @return     This function returns zero on success, or negative value with error
  *                     code.
  * @remark
- * @see                mm_player_audio_stream_callback_ex
+ * @see                mm_player_audio_stream_callback
  * @since
  */
-int mm_player_set_audio_stream_callback_ex(MMHandleType player, bool sync, mm_player_audio_stream_callback_ex callback, void *user_param);
+int mm_player_set_audio_stream_callback(MMHandleType player, bool sync, mm_player_audio_stream_callback callback, void *user_param);
 
 /**
  * This function is to capture video frame.
index dca8cf8..d6bbbe9 100644 (file)
@@ -638,14 +638,12 @@ typedef struct {
        int video_bo_size;
        bool video_stream_prerolled;
 
-       /* audio stram callback */
+       /* audio stream callback */
+       mm_player_audio_stream_callback audio_stream_render_cb;
        void* audio_stream_cb_user_param;
        bool audio_stream_sink_sync;
        GList* audio_stream_buff_list; /* mm_player_audio_stream_buff_t, buff list of extract pcm data */
 
-       /* audio buffer callback */
-       mm_player_audio_stream_callback_ex audio_stream_render_cb_ex;
-
        /* video capture callback*/
        gulong video_capture_cb_probe_id;
 
@@ -907,10 +905,9 @@ int _mmplayer_get_subtitle_silent(MMHandleType hplayer, int* silent);
 int _mmplayer_set_external_subtitle_path(MMHandleType hplayer, const char* filepath);
 int _mmplayer_get_buffer_position(MMHandleType hplayer, int format, unsigned long* start_pos, unsigned long* stop_pos);
 int _mmplayer_update_video_param(mm_player_t* player, char *param_name);
-int _mmplayer_set_audiobuffer_cb(MMHandleType hplayer, mm_player_audio_stream_callback callback, void *user_param);
 int _mmplayer_change_videosink(MMHandleType handle, MMDisplaySurfaceType surface_type, void *display_overlay);
 int _mmplayer_audio_effect_custom_apply(mm_player_t *player);
-int _mmplayer_set_audiostream_cb_ex(MMHandleType hplayer, bool sync, mm_player_audio_stream_callback_ex callback, void *user_param);
+int _mmplayer_set_audiostream_cb(MMHandleType hplayer, bool sync, mm_player_audio_stream_callback callback, void *user_param);
 int _mmplayer_change_track_language(MMHandleType hplayer, MMPlayerTrackType type, int index);
 int _mmplayer_sync_subtitle_pipeline(mm_player_t* player);
 int _mmplayer_set_video_hub_download_mode(MMHandleType hplayer, bool mode);
index 33c02f8..5510447 100644 (file)
@@ -195,7 +195,7 @@ int mm_player_set_pd_message_callback(MMHandleType player, MMMessageCallback cal
        return result;
 }
 
-int mm_player_set_audio_stream_callback_ex(MMHandleType player, bool sync, mm_player_audio_stream_callback_ex callback, void *user_param)
+int mm_player_set_audio_stream_callback(MMHandleType player, bool sync, mm_player_audio_stream_callback callback, void *user_param)
 {
        int result = MM_ERROR_NONE;
 
@@ -203,7 +203,7 @@ int mm_player_set_audio_stream_callback_ex(MMHandleType player, bool sync, mm_pl
 
        MMPLAYER_CMD_LOCK(player);
 
-       result = _mmplayer_set_audiostream_cb_ex(player, sync, callback, user_param);
+       result = _mmplayer_set_audiostream_cb(player, sync, callback, user_param);
 
        MMPLAYER_CMD_UNLOCK(player);
 
index d737d95..406b3ac 100644 (file)
@@ -1254,11 +1254,11 @@ __mmplayer_handle_eos_delay(mm_player_t* player, int delay_in_ms)
        MMPLAYER_RETURN_IF_FAIL(player);
 
        /* post now if delay is zero */
-       if (delay_in_ms == 0 || player->audio_stream_render_cb_ex) {
+       if (delay_in_ms == 0 || player->audio_stream_render_cb) {
                LOGD("eos delay is zero. posting EOS now\n");
                MMPLAYER_POST_MSG(player, MM_MESSAGE_END_OF_STREAM, NULL);
 
-               if (player->audio_stream_render_cb_ex)
+               if (player->audio_stream_render_cb)
                        __mmplayer_cancel_eos_timer(player);
 
                return;
@@ -1399,7 +1399,7 @@ __mmplayer_gst_handle_eos_message(mm_player_t* player, GstMessage *msg)
        if (player->pipeline && player->pipeline->textbin)
                __mmplayer_drop_subtitle(player, TRUE);
 
-       if ((player->audio_stream_render_cb_ex) && (!player->audio_stream_sink_sync))
+       if ((player->audio_stream_render_cb) && (!player->audio_stream_sink_sync))
                __mmplayer_audio_stream_clear_buffer(player, TRUE);
 
        /* rewind if repeat count is greater then zero */
old mode 100755 (executable)
new mode 100644 (file)
index 864bec4..482ae9e
@@ -2777,7 +2777,7 @@ __mmplayer_audio_stream_send_data(mm_player_t* player, mm_player_audio_stream_bu
        MMPlayerAudioStreamDataType audio_stream = { 0, };
 
        MMPLAYER_FENTER();
-       MMPLAYER_RETURN_IF_FAIL(player && player->audio_stream_render_cb_ex);
+       MMPLAYER_RETURN_IF_FAIL(player && player->audio_stream_render_cb);
 
        audio_stream.bitrate = a_buffer->bitrate;
        audio_stream.channel = a_buffer->channel;
@@ -2788,7 +2788,7 @@ __mmplayer_audio_stream_send_data(mm_player_t* player, mm_player_audio_stream_bu
        audio_stream.data = a_buffer->pcm_data;
 
        /* LOGD("[%"G_GUINT64_FORMAT"] send data size:%d, %p", audio_stream.channel_mask, audio_stream.data_size, player->audio_stream_cb_user_param); */
-       player->audio_stream_render_cb_ex(&audio_stream, player->audio_stream_cb_user_param);
+       player->audio_stream_render_cb(&audio_stream, player->audio_stream_cb_user_param);
 
        MMPLAYER_FLEAVE();
 }
@@ -2810,7 +2810,7 @@ __mmplayer_audio_stream_decoded_render_cb(GstElement* object, GstBuffer *buffer,
        GList *l = NULL;
 
        MMPLAYER_FENTER();
-       MMPLAYER_RETURN_IF_FAIL(player && player->audio_stream_render_cb_ex);
+       MMPLAYER_RETURN_IF_FAIL(player && player->audio_stream_render_cb);
 
        gst_buffer_map(buffer, &mapinfo, GST_MAP_READ);
        a_data = mapinfo.data;
@@ -2975,7 +2975,7 @@ ERROR:
        return;
 }
 
-void __mmplayer_gst_set_audiosink_property(mm_player_t* player, MMHandleType attrs)
+void __mmplayer_gst_set_pulsesink_property(mm_player_t* player, MMHandleType attrs)
 {
        #define MAX_PROPS_LEN 128
        gint latency_mode = 0;
@@ -2990,11 +2990,13 @@ void __mmplayer_gst_set_audiosink_property(mm_player_t* player, MMHandleType att
         * But, it can not be changed during playing.
         */
        MMPLAYER_FENTER();
+       MMPLAYER_RETURN_IF_FAIL(player && player->pipeline && player->pipeline->audiobin);
+
        mm_attrs_get_int_by_name(attrs, "sound_stream_index", &stream_id);
        mm_attrs_get_string_by_name(attrs, "sound_stream_type", &stream_type);
 
        if (!stream_type) {
-               LOGE("stream_type is null.\n");
+               LOGE("stream_type is null.");
        } else {
                if (player->sound.focus_id)
                        snprintf(stream_props, sizeof(stream_props)-1, "props,media.role=%s, media.parent_id=%d, media.focus_id=%d",
@@ -3004,7 +3006,7 @@ void __mmplayer_gst_set_audiosink_property(mm_player_t* player, MMHandleType att
                                        stream_type, stream_id);
                props = gst_structure_from_string(stream_props, NULL);
                g_object_set(player->pipeline->audiobin[MMPLAYER_A_SINK].gst, "stream-properties", props, NULL);
-               LOGI("stream_type[%s], stream_id[%d], focus_id[%d], result[%s].\n",
+               LOGI("stream_type[%s], stream_id[%d], focus_id[%d], result[%s].",
                        stream_type, stream_id, player->sound.focus_id, stream_props);
                gst_structure_free(props);
        }
@@ -3027,48 +3029,57 @@ void __mmplayer_gst_set_audiosink_property(mm_player_t* player, MMHandleType att
                        "latency", latency,
                        NULL);
 
-       LOGD("audiosink property - latency=%s \n", latency);
+       LOGD("audiosink property - latency=%s", latency);
 
        g_free(latency);
 
        MMPLAYER_FLEAVE();
 }
 
-static int
-__mmplayer_gst_create_audio_pipeline(mm_player_t* player)
+void __mmplayer_gst_set_openalsink_property(mm_player_t* player)
 {
-       MMPlayerGstElement *first_element = NULL;
        MMPlayerGstElement *audiobin = NULL;
-       MMHandleType attrs = 0;
-       GstPad *pad = NULL;
-       GstPad *ghostpad = NULL;
-       GList *element_bucket = NULL;
-       int i = 0;
-       GstCaps *acaps;
 
        MMPLAYER_FENTER();
+       MMPLAYER_RETURN_IF_FAIL(player && player->pipeline && player->pipeline->audiobin);
 
-       MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
+       audiobin = player->pipeline->audiobin;
 
-       /* alloc handles */
-       audiobin = (MMPlayerGstElement*)g_malloc0(sizeof(MMPlayerGstElement) * MMPLAYER_A_NUM);
-       if (!audiobin) {
-               LOGE("failed to allocate memory for audiobin\n");
-               return MM_ERROR_PLAYER_NO_FREE_SPACE;
+       g_object_set(G_OBJECT(audiobin[MMPLAYER_A_SINK].gst), "source-ambisonics-type", 1, NULL);
+       sound_manager_create_stream_information(SOUND_STREAM_TYPE_MEDIA, NULL, NULL, &stream_info);
+       g_object_set(G_OBJECT(audiobin[MMPLAYER_A_SINK].gst), "stream-info", stream_info, NULL);
+
+       if (player->video360_yaw_radians <= M_PI &&
+                       player->video360_yaw_radians >= -M_PI &&
+                       player->video360_pitch_radians <= M_PI_2 &&
+                       player->video360_pitch_radians >= -M_PI_2) {
+               g_object_set(G_OBJECT(audiobin[MMPLAYER_A_SINK].gst),
+                               "source-orientation-y", (int) (player->video360_yaw_radians * 180.0 / M_PI),
+                               "source-orientation-x", (int) (player->video360_pitch_radians * 180.0 / M_PI), NULL);
+       } else if (player->video360_metadata.init_view_heading || player->video360_metadata.init_view_pitch) {
+               g_object_set(G_OBJECT(audiobin[MMPLAYER_A_SINK].gst),
+                               "source-orientation-y", player->video360_metadata.init_view_heading,
+                               "source-orientation-x", player->video360_metadata.init_view_pitch, NULL);
        }
 
-       attrs = MMPLAYER_GET_ATTRS(player);
+       MMPLAYER_FLEAVE();
+}
 
-       /* create bin */
-       audiobin[MMPLAYER_A_BIN].id = MMPLAYER_A_BIN;
-       audiobin[MMPLAYER_A_BIN].gst = gst_bin_new("audiobin");
-       if (!audiobin[MMPLAYER_A_BIN].gst) {
-               LOGE("failed to create audiobin\n");
-               goto ERROR;
-       }
+static int
+__mmplayer_gst_fill_audio_bucket(mm_player_t *player, GList **bucket)
+{
+       MMPlayerGstElement *audiobin = NULL;
+       MMHandleType attrs = 0;
+       GList *element_bucket = NULL;
+       GstCaps *acaps = NULL;
+       GstPad *sink_pad = NULL;
 
-       /* take it */
-       player->pipeline->audiobin = audiobin;
+       MMPLAYER_FENTER();
+       MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline &&
+                               player->pipeline->audiobin, MM_ERROR_PLAYER_NOT_INITIALIZED);
+
+       audiobin = player->pipeline->audiobin;
+       attrs = MMPLAYER_GET_ATTRS(player);
 
        /* converter */
        MMPLAYER_CREATE_ELEMENT(audiobin, MMPLAYER_A_CONV, "audioconvert", "audio converter", TRUE, player);
@@ -3083,7 +3094,7 @@ __mmplayer_gst_create_audio_pipeline(mm_player_t* player)
        /* resampler */
        MMPLAYER_CREATE_ELEMENT(audiobin, MMPLAYER_A_RESAMPLER,  player->ini.audioresampler_element, "audio resampler", TRUE, player);
 
-       if (player->audio_stream_render_cb_ex) { /* pcm extraction only, no sound output */
+       if (player->audio_stream_render_cb) { /* pcm extraction only, no sound output */
                gchar *dst_format = NULL;
                int dst_len = 0;
                int dst_samplerate = 0;
@@ -3121,9 +3132,9 @@ __mmplayer_gst_create_audio_pipeline(mm_player_t* player)
 
                g_object_set(G_OBJECT(audiobin[MMPLAYER_A_DEINTERLEAVE].gst), "keep-positions", TRUE, NULL);
 
-               /* raw pad handling signal */
+               /* raw pad handling signal, audiosink will be added after getting signal */
                __mmplayer_add_signal_connection(player, G_OBJECT(audiobin[MMPLAYER_A_DEINTERLEAVE].gst),
-                       MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "pad-added", G_CALLBACK(__mmplayer_gst_audio_deinterleave_pad_added), (gpointer)player);
+                               MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "pad-added", G_CALLBACK(__mmplayer_gst_audio_deinterleave_pad_added), (gpointer)player);
 
        } else {
 
@@ -3135,7 +3146,7 @@ __mmplayer_gst_create_audio_pipeline(mm_player_t* player)
                g_object_set(G_OBJECT(audiobin[MMPLAYER_A_VOL].gst), "volume", player->sound.volume, NULL);
 
                if (player->sound.mute) {
-                       LOGD("mute enabled\n");
+                       LOGD("mute enabled");
                        g_object_set(G_OBJECT(audiobin[MMPLAYER_A_VOL].gst), "mute", player->sound.mute, NULL);
                }
 
@@ -3146,7 +3157,7 @@ __mmplayer_gst_create_audio_pipeline(mm_player_t* player)
 
                        if ((srcpad = gst_element_get_static_pad(player->pipeline->mainbin[MMPLAYER_M_DEMUX].gst, "src"))) {
                                if ((caps = gst_pad_query_caps(srcpad, NULL))) {
-                                       //MMPLAYER_LOG_GST_CAPS_TYPE(caps);
+                                       /* MMPLAYER_LOG_GST_CAPS_TYPE(caps); */
                                        GstStructure *str = gst_caps_get_structure(caps, 0);
                                        if (str)
                                                gst_structure_get_int(str, "channels", &channels);
@@ -3166,9 +3177,9 @@ __mmplayer_gst_create_audio_pipeline(mm_player_t* player)
 
                        if ((!player->bypass_audio_effect)
                                && (player->ini.use_audio_effect_preset || player->ini.use_audio_effect_custom)) {
-                               if (MM_AUDIO_EFFECT_TYPE_CUSTOM == player->audio_effect_info.effect_type) {
+                               if (player->audio_effect_info.effect_type == MM_AUDIO_EFFECT_TYPE_CUSTOM) {
                                        if (!_mmplayer_audio_effect_custom_apply(player))
-                                               LOGI("apply audio effect(custom) setting success\n");
+                                               LOGI("apply audio effect(custom) setting success");
                                }
                        }
 
@@ -3200,90 +3211,116 @@ __mmplayer_gst_create_audio_pipeline(mm_player_t* player)
                        gst_caps_unref(acaps);
 
                        MMPLAYER_CREATE_ELEMENT(audiobin, MMPLAYER_A_SINK, "openalsink", "audiosink", TRUE, player);
-                       g_object_set(G_OBJECT(audiobin[MMPLAYER_A_SINK].gst), "source-ambisonics-type", 1, NULL);
-                       sound_manager_create_stream_information(SOUND_STREAM_TYPE_MEDIA, NULL, NULL, &stream_info);
-                       g_object_set(G_OBJECT(audiobin[MMPLAYER_A_SINK].gst), "stream-info", stream_info, NULL);
 
                        player->is_openal_plugin_used = TRUE;
-
-                       if (player->video360_yaw_radians <= M_PI &&
-                                       player->video360_yaw_radians >= -M_PI &&
-                                       player->video360_pitch_radians <= M_PI_2 &&
-                                       player->video360_pitch_radians >= -M_PI_2) {
-                               g_object_set(G_OBJECT(audiobin[MMPLAYER_A_SINK].gst),
-                                               "source-orientation-y", (int) (player->video360_yaw_radians * 180.0 / M_PI),
-                                               "source-orientation-x", (int) (player->video360_pitch_radians * 180.0 / M_PI), NULL);
-                       } else if (player->video360_metadata.init_view_heading || player->video360_metadata.init_view_pitch) {
-                               g_object_set(G_OBJECT(audiobin[MMPLAYER_A_SINK].gst),
-                                               "source-orientation-y", player->video360_metadata.init_view_heading,
-                                               "source-orientation-x", player->video360_metadata.init_view_pitch, NULL);
-                       }
                } else {
                        if (player->is_360_feature_enabled && player->is_content_spherical)
-                               LOGW("Audio track isn't of the ambisonic type and can't be played back as a spatial sound.\n");
+                               LOGW("Audio track isn't of the ambisonic type and can't be played back as a spatial sound.");
                        MMPLAYER_CREATE_ELEMENT(audiobin, MMPLAYER_A_SINK, player->ini.audiosink_element, "audiosink", TRUE, player);
                }
 
-               /* qos on */
-               g_object_set(G_OBJECT(audiobin[MMPLAYER_A_SINK].gst), "qos", TRUE, NULL);       /* qos on */
-               g_object_set(G_OBJECT(audiobin[MMPLAYER_A_SINK].gst), "slave-method", GST_AUDIO_BASE_SINK_SLAVE_NONE, NULL);
-
-
                if ((MMPLAYER_IS_RTSP_STREAMING(player)) ||
                        (player->videodec_linked && player->ini.use_system_clock)) {
-                       LOGD("system clock will be used.\n");
+                       LOGD("system clock will be used.");
                        g_object_set(G_OBJECT(audiobin[MMPLAYER_A_SINK].gst), "provide-clock", FALSE,  NULL);
                }
 
                if (g_strrstr(player->ini.audiosink_element, "pulsesink"))
-                       __mmplayer_gst_set_audiosink_property(player, attrs);
-       }
+                       __mmplayer_gst_set_pulsesink_property(player, attrs);
+               else if (g_strrstr(player->ini.audiosink_element, "openalsink"))
+                       __mmplayer_gst_set_openalsink_property(player);
+
+               /* qos on */
+               g_object_set(G_OBJECT(audiobin[MMPLAYER_A_SINK].gst), "qos", TRUE, NULL);       /* qos on */
+               g_object_set(G_OBJECT(audiobin[MMPLAYER_A_SINK].gst), "slave-method", GST_AUDIO_BASE_SINK_SLAVE_NONE, NULL);
 
-       if (audiobin[MMPLAYER_A_SINK].gst) {
-               GstPad *sink_pad = NULL;
                sink_pad = gst_element_get_static_pad(audiobin[MMPLAYER_A_SINK].gst, "sink");
                __mmplayer_add_signal_connection(player, G_OBJECT(sink_pad), MM_PLAYER_SIGNAL_TYPE_AUDIOBIN,
                                        "notify::caps", G_CALLBACK(__mmplayer_gst_caps_notify_cb), (gpointer)player);
                gst_object_unref(GST_OBJECT(sink_pad));
+
+               __mmplayer_add_sink(player, audiobin[MMPLAYER_A_SINK].gst);
        }
 
-       __mmplayer_add_sink(player, audiobin[MMPLAYER_A_SINK].gst);
+       *bucket = element_bucket;
 
-       /* adding created elements to bin */
-       LOGD("adding created elements to bin\n");
-       if (!__mmplayer_gst_element_add_bucket_to_bin(GST_BIN(audiobin[MMPLAYER_A_BIN].gst), element_bucket)) {
-               LOGE("failed to add elements\n");
+       MMPLAYER_FLEAVE();
+       return MM_ERROR_NONE;
+
+ERROR:
+       g_list_free(element_bucket);
+
+       *bucket = NULL;
+       MMPLAYER_FLEAVE();
+       return MM_ERROR_PLAYER_INTERNAL;
+}
+
+static int
+__mmplayer_gst_create_audio_pipeline(mm_player_t* player)
+{
+       MMPlayerGstElement *first_element = NULL;
+       MMPlayerGstElement *audiobin = NULL;
+       GstPad *pad = NULL;
+       GstPad *ghostpad = NULL;
+       GList *element_bucket = NULL;
+       int i = 0;
+
+       MMPLAYER_FENTER();
+       MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
+
+       /* alloc handles */
+       audiobin = (MMPlayerGstElement*)g_malloc0(sizeof(MMPlayerGstElement) * MMPLAYER_A_NUM);
+       if (!audiobin) {
+               LOGE("failed to allocate memory for audiobin");
+               return MM_ERROR_PLAYER_NO_FREE_SPACE;
+       }
+
+       /* create bin */
+       audiobin[MMPLAYER_A_BIN].id = MMPLAYER_A_BIN;
+       audiobin[MMPLAYER_A_BIN].gst = gst_bin_new("audiobin");
+       if (!audiobin[MMPLAYER_A_BIN].gst) {
+               LOGE("failed to create audiobin");
                goto ERROR;
        }
 
+       /* take it */
+       player->pipeline->audiobin = audiobin;
+
+       /* create audio filters and audiosink */
+       if (__mmplayer_gst_fill_audio_bucket(player, &element_bucket) != MM_ERROR_NONE)
+               goto ERROR;
+
+       /* adding created elements to bin */
+       LOGD("adding created elements to bin");
+       if (!__mmplayer_gst_element_add_bucket_to_bin(GST_BIN(audiobin[MMPLAYER_A_BIN].gst), element_bucket))
+               goto ERROR;
+
        /* linking elements in the bucket by added order. */
-       LOGD("Linking elements in the bucket by added order.\n");
-       if (__mmplayer_gst_element_link_bucket(element_bucket) == -1) {
-               LOGE("failed to link elements\n");
+       LOGD("Linking elements in the bucket by added order.");
+       if (__mmplayer_gst_element_link_bucket(element_bucket) == -1)
                goto ERROR;
-       }
 
        /* get first element's sinkpad for creating ghostpad */
        first_element = (MMPlayerGstElement *)element_bucket->data;
        if (!first_element) {
-               LOGE("failed to get first elem\n");
+               LOGE("failed to get first elem");
                goto ERROR;
        }
 
        pad = gst_element_get_static_pad(GST_ELEMENT(first_element->gst), "sink");
        if (!pad) {
-               LOGE("failed to get pad from first element of audiobin\n");
+               LOGE("failed to get pad from first element of audiobin");
                goto ERROR;
        }
 
        ghostpad = gst_ghost_pad_new("sink", pad);
        if (!ghostpad) {
-               LOGE("failed to create ghostpad\n");
+               LOGE("failed to create ghostpad");
                goto ERROR;
        }
 
        if (!gst_element_add_pad(audiobin[MMPLAYER_A_BIN].gst, ghostpad)) {
-               LOGE("failed to add ghostpad to audiobin\n");
+               LOGE("failed to add ghostpad to audiobin");
                goto ERROR;
        }
 
@@ -3295,8 +3332,7 @@ __mmplayer_gst_create_audio_pipeline(mm_player_t* player)
        return MM_ERROR_NONE;
 
 ERROR:
-
-       LOGD("ERROR : releasing audiobin\n");
+       LOGD("ERROR : releasing audiobin");
 
        if (pad)
                gst_object_unref(GST_OBJECT(pad));
@@ -4739,7 +4775,7 @@ __mmplayer_can_do_interrupt(mm_player_t *player)
                goto FAILED;
        }
 
-       if (player->audio_stream_render_cb_ex) {
+       if (player->audio_stream_render_cb) {
                LOGW("not support in pcm extraction mode");
                goto FAILED;
        }
@@ -5658,18 +5694,18 @@ _mmplayer_set_audiostream_changed_cb(MMHandleType hplayer, mm_player_stream_chan
 }
 
 int
-_mmplayer_set_audiostream_cb_ex(MMHandleType hplayer, bool sync, mm_player_audio_stream_callback_ex callback, void *user_param)
+_mmplayer_set_audiostream_cb(MMHandleType hplayer, bool sync, mm_player_audio_stream_callback callback, void *user_param)
 {
-       mm_player_tplayer = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t*) hplayer;
 
        MMPLAYER_FENTER();
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
-       player->audio_stream_render_cb_ex = callback;
+       player->audio_stream_render_cb = callback;
        player->audio_stream_cb_user_param = user_param;
        player->audio_stream_sink_sync = sync;
-       LOGD("Audio Stream cb Handle value is %p : %p audio_stream_sink_sync : %d\n", player, player->audio_stream_render_cb_ex, player->audio_stream_sink_sync);
+       LOGD("handle: %p, cb: %p, sync: %d", player, player->audio_stream_render_cb, player->audio_stream_sink_sync);
 
        MMPLAYER_FLEAVE();
 
@@ -7861,7 +7897,7 @@ __mmplayer_release_misc(mm_player_t* player)
        player->video_stream_cb_user_param = NULL;
        player->video_stream_prerolled = FALSE;
 
-       player->audio_stream_render_cb_ex = NULL;
+       player->audio_stream_render_cb = NULL;
        player->audio_stream_cb_user_param = NULL;
        player->audio_stream_sink_sync = false;