summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tizen_sound_player/tizen_sound_player.c28
1 files changed, 20 insertions, 8 deletions
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;