From 353dc8e9d2645bc2e2f21d8eba633670504b03ec Mon Sep 17 00:00:00 2001 From: Eunhae Choi Date: Fri, 26 May 2017 15:08:05 +0900 Subject: [PATCH] [0.2.53] add null checking of user_data Change-Id: I6682b8a67613ec4d5263cef1fd03a30865ce29be --- legacy/src/legacy_player_internal.c | 23 ++++++++++++++--------- packaging/mmsvc-player.spec | 2 +- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/legacy/src/legacy_player_internal.c b/legacy/src/legacy_player_internal.c index 388cb19..570b8a5 100644 --- a/legacy/src/legacy_player_internal.c +++ b/legacy/src/legacy_player_internal.c @@ -46,12 +46,12 @@ bool __audio_stream_callback_ex(MMPlayerAudioStreamDataType *stream, void *user_ if (!__player_state_validate(handle, PLAYER_STATE_READY)) { LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state); - return TRUE; + return true; } if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME]) ((player_audio_pcm_extraction_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME])((player_audio_raw_data_s *)stream, handle->user_data[MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME]); - return TRUE; + return true; } int legacy_player_set_pcm_extraction_mode(player_h player, bool sync, player_audio_pcm_extraction_cb callback, void *user_data) @@ -128,12 +128,17 @@ static bool __media_stream_buffer_status_callback_ex(player_stream_type_e type, player_s *handle = (player_s *)user_data; muse_player_event_e event_type; + if (!handle) { + LOGE("user_data param is null"); + return false; + } + if (type == PLAYER_STREAM_TYPE_AUDIO) event_type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO; else if (type == PLAYER_STREAM_TYPE_VIDEO) event_type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO; else - return FALSE; + return false; LOGE("[%s] event type %d, status %d, bytes %llu", __FUNCTION__, event_type, status, bytes); @@ -144,12 +149,12 @@ static bool __media_stream_buffer_status_callback_ex(player_stream_type_e type, } else { LOGE("[%s][type:%d] buffer status cb was not set.", __FUNCTION__, type); LEGACY_PLAYER_USER_CB_UNLOCK(handle, event_type); - return FALSE; + return false; } LEGACY_PLAYER_USER_CB_UNLOCK(handle, event_type); - return TRUE; + return true; } @@ -281,7 +286,7 @@ int legacy_player_set_gapless(player_h player, bool gapless) player_s *handle = (player_s *)player; int value = 0; - if (gapless == TRUE) + if (gapless == true) value = 1; int ret = mm_player_set_attribute(handle->mm_handle, NULL, MM_PLAYER_GAPLESS_MODE, value, (char *)NULL); @@ -304,9 +309,9 @@ int legacy_player_is_gapless(player_h player, bool *gapless) return __player_convert_error_code(ret, (char *)__FUNCTION__); } else { if (value == 1) - *gapless = TRUE; + *gapless = true; else - *gapless = FALSE; + *gapless = false; return PLAYER_ERROR_NONE; } @@ -319,7 +324,7 @@ int legacy_player_enable_media_packet_video_frame_decoded_cb(player_h player, bo PLAYER_CHECK_CONDITION(handle->display_type == PLAYER_DISPLAY_TYPE_OVERLAY, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); int value = 0; - if (enable == TRUE) + if (enable == true) value = 1; int ret = mm_player_set_attribute(handle->mm_handle, NULL, MM_PLAYER_ENABLE_VIDEO_DECODED_CB, value, (char *)NULL); diff --git a/packaging/mmsvc-player.spec b/packaging/mmsvc-player.spec index b71e3ac..1d75d30 100644 --- a/packaging/mmsvc-player.spec +++ b/packaging/mmsvc-player.spec @@ -1,6 +1,6 @@ Name: mmsvc-player Summary: A Media Player module for muse server -Version: 0.2.52 +Version: 0.2.53 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 -- 2.34.1