[0.6.57] add checking result of mem alloc 89/139589/3
authorEunhae Choi <eunhae1.choi@samsung.com>
Wed, 19 Jul 2017 10:54:06 +0000 (19:54 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Tue, 25 Jul 2017 05:42:13 +0000 (14:42 +0900)
add checking result of mem alloc
fix svace issues

Change-Id: If32ada4535bf7b81f17a9caca9b40e934c065df5

packaging/libmm-player.spec
src/include/mm_player.h
src/include/mm_player_priv.h
src/mm_player.c
src/mm_player_priv.c

index 4cb5974..80f2070 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    0.6.56
+Version:    0.6.57
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 7c3944f..d075873 100644 (file)
@@ -777,16 +777,6 @@ typedef enum {
        MM_PLAYER_BUFFERING_MODE_MAX = MM_PLAYER_BUFFERING_MODE_SLINK,
 }MMPlayerBufferingMode;
 
-/**
- * Enumeration of audio channel for video share
- */
-typedef enum
-{
-       MM_PLAYER_AUDIO_CH_MONO_LEFT = 0,
-       MM_PLAYER_AUDIO_CH_MONO_RIGHT,
-       MM_PLAYER_AUDIO_CH_STEREO,
-} MMPlayerAudioChannel;
-
 typedef enum
 {
        MM_PLAYER_FOCUS_CHANGED_COMPLETED = 0,
@@ -1992,17 +1982,6 @@ int mm_player_set_video_share_master_clock(MMHandleType player, long long clock,
  * @remark      None
  */
 int mm_player_get_video_share_master_clock(MMHandleType player, long long *video_time, long long *media_clock, long long *audio_time);
-/**
- * This function is to set audio channel
- *
- * @param       player         [in]    handle of player
- * @param       ch                     [in]    audio channel
- * @return      This function returns zero on success, or negative value with error code.
- *
- * @see
- * @remark      None
- */
-int mm_player_gst_set_audio_channel(MMHandleType player, MMPlayerAudioChannel ch);
 
 /**
  * This function is to get the content angle
index 62a06ba..c168502 100644 (file)
@@ -849,7 +849,6 @@ 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);
 gboolean __mmplayer_post_message(mm_player_t* player, enum MMMessageType msgtype, MMMessageParamType* param);
 
-int _mmplayer_gst_set_audio_channel(MMHandleType hplayer, MMPlayerAudioChannel ch_idx);
 int _mmplayer_change_track_language(MMHandleType hplayer, MMPlayerTrackType type, int index);
 int _mmplayer_sync_subtitle_pipeline(mm_player_t* player);
 int _mmplayer_set_prepare_buffering_time(MMHandleType hplayer, int second);
index f648d67..cbb8778 100644 (file)
@@ -485,19 +485,6 @@ int mm_player_deactivate_section_repeat(MMHandleType player)
        return result;
 }
 
-int mm_player_gst_set_audio_channel(MMHandleType player, MMPlayerAudioChannel ch)
-{
-       int result = MM_ERROR_NONE;
-
-       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-       MMPLAYER_CMD_LOCK( player );
-
-       result = _mmplayer_gst_set_audio_channel(player, ch);
-
-       MMPLAYER_CMD_UNLOCK( player );
-       return result;
-}
-
 int mm_player_set_play_speed(MMHandleType player, float rate, bool streaming)
 {
        int result = MM_ERROR_NONE;
index af55e5f..21e34d3 100644 (file)
@@ -2903,90 +2903,6 @@ static void __mmplayer_handle_text_decode_path(mm_player_t* player, GstElement*
        }
 }
 
-int _mmplayer_gst_set_audio_channel(MMHandleType hplayer, MMPlayerAudioChannel ch_idx)
-{
-       int result = MM_ERROR_NONE;
-
-       mm_player_t* player = (mm_player_t*)hplayer;
-       MMPlayerGstElement* mainbin = NULL;
-       gchar* change_pad_name = NULL;
-       GstPad* sinkpad = NULL;
-       GstCaps* caps = NULL;
-
-       MMPLAYER_FENTER();
-
-       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-
-       LOGD("Change Audio mode to %d\n", ch_idx);
-       player->use_deinterleave = TRUE;
-
-       if ((!player->pipeline) || (!player->pipeline->mainbin)) {
-               LOGD("pre setting : %d\n", ch_idx);
-
-               player->audio_mode.active_pad_index = ch_idx;
-               return result;
-       }
-
-       mainbin = player->pipeline->mainbin;
-
-       if (mainbin[MMPLAYER_M_A_SELECTOR].gst == NULL) {
-               if (player->max_audio_channels < 2) {
-                       LOGD("mono channel track only\n");
-                       return result;
-               }
-
-               LOGW("selector doesn't exist\n");
-               return result;  /* keep playing */
-       }
-
-       LOGD("total_ch_num : %d\n", player->audio_mode.total_track_num);
-
-       if (player->audio_mode.total_track_num < 2) {
-               LOGW("there is no another audio path\n");
-               return result;  /* keep playing */
-       }
-
-       if ((ch_idx < 0) || (ch_idx >= player->audio_mode.total_track_num)) {
-               LOGW("Not a proper ch_idx : %d \n", ch_idx);
-               return result;  /* keep playing */
-       }
-
-       /*To get the new pad from the selector*/
-       change_pad_name = g_strdup_printf("sink%d", ch_idx);
-       if (change_pad_name == NULL) {
-               LOGW("Pad does not exists\n");
-               goto ERROR;     /* keep playing */
-       }
-
-       LOGD("new active pad name: %s\n", change_pad_name);
-
-       sinkpad = gst_element_get_static_pad(mainbin[MMPLAYER_M_A_SELECTOR].gst, change_pad_name);
-       if (sinkpad == NULL)
-               //result = MM_ERROR_PLAYER_INTERNAL;
-               goto ERROR;     /* keep playing */
-
-       LOGD("Set Active Pad - %s:%s\n", GST_DEBUG_PAD_NAME(sinkpad));
-       g_object_set(mainbin[MMPLAYER_M_A_SELECTOR].gst, "active-pad", sinkpad, NULL);
-
-       caps = gst_pad_get_current_caps(sinkpad);
-       MMPLAYER_LOG_GST_CAPS_TYPE(caps);
-
-       __mmplayer_set_audio_attrs(player, caps);
-       player->audio_mode.active_pad_index = ch_idx;
-
-ERROR:
-
-       if (sinkpad)
-               gst_object_unref(sinkpad);
-
-       MMPLAYER_FREEIF(change_pad_name);
-
-       MMPLAYER_FLEAVE();
-       return result;
-}
-
-
-
 static void
 __mmplayer_gst_deinterleave_pad_added(GstElement *elem, GstPad *pad, gpointer data)
 {
@@ -7777,7 +7693,7 @@ static int __gst_get_buffer_position(mm_player_t* player, int format, unsigned l
                position, (guint)(content_size_time/GST_SECOND), content_size_bytes);
 
        mainbin = player->pipeline->mainbin;
-       start_per = ceil(100 *(position*GST_MSECOND) / content_size_time);
+       start_per = (gint)(ceil(100 *(gdouble)(position*GST_MSECOND) / (gdouble)content_size_time));
 
        if (mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst) {
                GstQuery *query = NULL;
@@ -9426,7 +9342,7 @@ _mmplayer_set_runtime_buffering_mode(MMHandleType hplayer, MMPlayerBufferingMode
 
        LOGD("mode %d\n", mode);
 
-       if ((mode < 0) || (mode > MM_PLAYER_BUFFERING_MODE_MAX) ||
+       if ((mode > MM_PLAYER_BUFFERING_MODE_MAX) ||
                ((mode == MM_PLAYER_BUFFERING_MODE_FIXED) && (second <= 0)))
                return MM_ERROR_INVALID_ARGUMENT;
 
@@ -13145,6 +13061,11 @@ __mmplayer_handle_streaming_error(mm_player_t* player, GstMessage * message)
        MMPLAYER_RETURN_VAL_IF_FAIL(message, FALSE);
 
        s = malloc(sizeof(GstStructure));
+       if (s == NULL) {
+               LOGE("failed to alloc data.");
+               return FALSE;
+       }
+
        memcpy(s, gst_message_get_structure(message), sizeof(GstStructure));
 
        if (!gst_structure_get_uint(s, "error_id", &error_id))
@@ -13694,7 +13615,7 @@ __mmplayer_release_signal_connection(mm_player_t* player, MMPlayerSignalType typ
 
        LOGD("release signals type : %d", type);
 
-       if ((type < MM_PLAYER_SIGNAL_TYPE_AUTOPLUG) || (type >= MM_PLAYER_SIGNAL_TYPE_ALL)) {
+       if (type >= MM_PLAYER_SIGNAL_TYPE_ALL) {
                __mmplayer_release_signal_connection(player, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG);
                __mmplayer_release_signal_connection(player, MM_PLAYER_SIGNAL_TYPE_VIDEOBIN);
                __mmplayer_release_signal_connection(player, MM_PLAYER_SIGNAL_TYPE_AUDIOBIN);
@@ -13742,7 +13663,7 @@ int _mmplayer_change_videosink(MMHandleType handle, MMDisplaySurfaceType surface
 
        player = MM_PLAYER_CAST(handle);
 
-       if (surface_type < MM_DISPLAY_SURFACE_OVERLAY || surface_type >= MM_DISPLAY_SURFACE_NUM) {
+       if (surface_type >= MM_DISPLAY_SURFACE_NUM) {
                LOGE("Not support this surface type(%d) for changing vidoesink", surface_type);
                MMPLAYER_FLEAVE();
                return MM_ERROR_INVALID_ARGUMENT;