From: prince Date: Thu, 21 Mar 2013 11:35:07 +0000 (+0530) Subject: [Multisense] Adding check for MM Sound API return value X-Git-Tag: 2.1b_release~1^2^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=95cecd56d395b99e7bf7febed6f7e10dcf623d22;p=platform%2Fcore%2Fuifw%2Fedje-multisense-plugin.git [Multisense] Adding check for MM Sound API return value Change-Id: If33f7136a1c70e3a1f4e9c51f4b6e1b118004aad --- diff --git a/src/tizen_sound_player/tizen_sound_player.c b/src/tizen_sound_player/tizen_sound_player.c index d4bf12e..a1c59fe 100644 --- a/src/tizen_sound_player/tizen_sound_player.c +++ b/src/tizen_sound_player/tizen_sound_player.c @@ -60,8 +60,10 @@ remix_player_reset_device (RemixEnv *env, RemixBase *base) if (player_data->handle) { - mm_sound_pcm_play_stop(player_data->handle); - mm_sound_pcm_play_close(player_data->handle); + if (mm_sound_pcm_play_stop(player_data->handle) < 0) + remix_set_error (env, REMIX_ERROR_SYSTEM); + else + mm_sound_pcm_play_close(player_data->handle); player_data->handle = NULL; } player_data->old_buffer_size = player_data->buffer_size; @@ -188,8 +190,11 @@ remix_player_destroy (RemixEnv *env, RemixBase *base) if (player_data->handle) { - mm_sound_pcm_play_stop(player_data->handle); - mm_sound_pcm_play_close(player_data->handle); + if (mm_sound_pcm_play_stop(player_data->handle) < 0) + remix_set_error (env, REMIX_ERROR_SYSTEM); + else + mm_sound_pcm_play_close(player_data->handle); + player_data->handle = NULL; } if (player_data->timeout) ecore_timer_del(player_data->timeout); if (player_data->playbuffer) free(player_data->playbuffer); @@ -218,7 +223,7 @@ remix_player_ready (RemixEnv *env, RemixBase *base) static RemixBase * remix_player_prepare (RemixEnv *env, RemixBase *base) { - remix_player_reset_device (env, base); +// remix_player_reset_device (env, base); return base; } @@ -239,7 +244,8 @@ remix_player_playbuffer (RemixEnv *env, RemixPlayerData *player, RemixPCM *data, *(player->playbuffer + i) = (PLAYER_PCM) value; } - ret = mm_sound_pcm_play_write(player->handle, + if (player->handle) + ret = mm_sound_pcm_play_write(player->handle, player->playbuffer, length); if (ret < 0) @@ -337,8 +343,14 @@ _remix_mm_handle_close(void *data) if (!player_data) return ECORE_CALLBACK_CANCEL; if (!player_data->handle) return ECORE_CALLBACK_CANCEL; - mm_sound_pcm_play_stop(player_data->handle); - mm_sound_pcm_play_close(player_data->handle); + if (mm_sound_pcm_play_stop(player_data->handle) < 0) + { + player_data->handle = NULL; + player_data->timeout = NULL; + return ECORE_CALLBACK_CANCEL; + } + else + mm_sound_pcm_play_close(player_data->handle); player_data->handle = NULL; player_data->timeout = NULL;