From 6f4c4f4135d5fa1c72caf920ddea40c21c077103 Mon Sep 17 00:00:00 2001 From: prince Date: Fri, 18 Jan 2013 20:02:23 +0530 Subject: [Tizen Multisense] Tizen Snd Player Buffer size must be int value as per MM API convention. Change-Id: Icb7ac37356e34787287e3f788f8c55578c3626ac --- src/tizen_sound_player/tizen_sound_player.c | 36 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/src/tizen_sound_player/tizen_sound_player.c b/src/tizen_sound_player/tizen_sound_player.c index 673b53e..11ea947 100644 --- a/src/tizen_sound_player/tizen_sound_player.c +++ b/src/tizen_sound_player/tizen_sound_player.c @@ -44,7 +44,8 @@ struct _RemixPlayerData { Ecore_Timer *timeout; int snd_on; int tch_snd_on; - unsigned int buffer_size; + int buffer_size; + int old_buffer_size; int stereo; int frequency; }; @@ -55,7 +56,6 @@ static RemixBase *remix_player_optimise (RemixEnv *env, RemixBase *base); static RemixBase * remix_player_reset_device (RemixEnv *env, RemixBase *base) { - int old_buffer_size; RemixPlayerData *player_data = remix_base_get_instance_data(env, base); if (player_data->handle) @@ -64,23 +64,23 @@ remix_player_reset_device (RemixEnv *env, RemixBase *base) mm_sound_pcm_play_close(player_data->handle); player_data->handle = NULL; } - old_buffer_size = player_data->buffer_size; + player_data->old_buffer_size = player_data->buffer_size; player_data->buffer_size = mm_sound_pcm_play_open_no_session(&player_data->handle, player_data->frequency, player_data->channel, DEFAULT_FORMAT, VOLUME_TYPE_SYSTEM); - if(mm_sound_pcm_play_start(player_data->handle) < 0) + if (mm_sound_pcm_play_start(player_data->handle) < 0) { remix_set_error (env, REMIX_ERROR_SYSTEM); return RemixNone; } - if( old_buffer_size < player_data->buffer_size) + if (player_data->old_buffer_size < player_data->buffer_size) { - if( player_data->playbuffer ) free(player_data->playbuffer); + if ( player_data->playbuffer ) free(player_data->playbuffer); player_data->playbuffer = calloc(sizeof(PLAYER_PCM), player_data->buffer_size); - if(!player_data->playbuffer) + if (!player_data->playbuffer) { remix_set_error (env, REMIX_ERROR_SYSTEM); return RemixNone; @@ -186,13 +186,13 @@ remix_player_destroy (RemixEnv *env, RemixBase *base) _vconf_noti_key_changed_cb) < 0) WRN("\nFail to unregister VCONFKEY_SYSMAN_EARJACK key callback"); - if(player_data->handle) + if (player_data->handle) { mm_sound_pcm_play_stop(player_data->handle); mm_sound_pcm_play_close(player_data->handle); } if (player_data->timeout) ecore_timer_del(player_data->timeout); - if(player_data->playbuffer) free(player_data->playbuffer); + if (player_data->playbuffer) free(player_data->playbuffer); free (player_data); return 0; } @@ -242,7 +242,7 @@ remix_player_playbuffer (RemixEnv *env, RemixPlayerData *player, RemixPCM *data, ret = mm_sound_pcm_play_write(player->handle, player->playbuffer, length); - if(ret < 0) + if (ret < 0) ERR("Write Fail\n"); return length; @@ -348,7 +348,6 @@ _remix_mm_handle_close(void *data) static int remix_player_flush (RemixEnv *env, RemixBase *base) { - int old_buffer_size; RemixPlayerData *player_data = remix_base_get_instance_data(env, base); if (player_data->timeout) ecore_timer_del(player_data->timeout); @@ -357,30 +356,29 @@ remix_player_flush (RemixEnv *env, RemixBase *base) if (player_data->handle) return 0; - old_buffer_size = player_data->buffer_size; + player_data->old_buffer_size = player_data->buffer_size; player_data->buffer_size = mm_sound_pcm_play_open_no_session(&player_data->handle, player_data->frequency, player_data->channel, DEFAULT_FORMAT, VOLUME_TYPE_SYSTEM); - if(mm_sound_pcm_play_start(player_data->handle) < 0) + if (mm_sound_pcm_play_start(player_data->handle) < 0) { remix_set_error (env, REMIX_ERROR_SYSTEM); return -1; } -//player_data->buffer_size is unsigned int, so it cannot be value under 0 -/* if(player_data->buffer_size < 0) + + if (player_data->buffer_size < 0) { remix_set_error (env, REMIX_ERROR_SYSTEM); return -1; } -*/ - if( old_buffer_size < player_data->buffer_size) + if (player_data->old_buffer_size < player_data->buffer_size) { - if( player_data->playbuffer ) free(player_data->playbuffer); + if (player_data->playbuffer) free(player_data->playbuffer); player_data->playbuffer = calloc(sizeof(PLAYER_PCM), player_data->buffer_size); - if(!player_data->playbuffer) + if (!player_data->playbuffer) { remix_set_error (env, REMIX_ERROR_SYSTEM); return -1; -- cgit v1.2.3