Updated API according to the changed stream prioritization concept 89/78489/8
authorIevgen Vagin <i.vagin@samsung.com>
Wed, 6 Jul 2016 09:13:32 +0000 (12:13 +0300)
committerIevgen Vagin <i.vagin@samsung.com>
Fri, 8 Jul 2016 08:16:15 +0000 (11:16 +0300)
+ fixed some build warnings

Change-Id: Id9f666aadb4b5b815f17926f468bb83e0acfbdba
Signed-off-by: Ievgen Vagin <i.vagin@samsung.com>
include/internal/soundpool.h
include/sound_pool.h
include/sound_pool_type.h
src/priority.c
src/sound_pool.c
src/soundpool.c
src/source.c
src/stream.c
test/proxy/src/proxy.c

index 9b015d3..de9c9cf 100644 (file)
@@ -43,7 +43,6 @@ typedef struct sound_pool_s {
        GHashTable *sources;
        GHashTable *streams;
 
-       guint max_streams;
        guint max_stream_index;
        sound_pool_state_e state;
 
@@ -59,7 +58,7 @@ typedef struct sound_pool_s {
 /* Max amount of sound pools which could be created. */
 #define SOUND_POOL_MAX_POOLS_AMOUNT 32U
 
-sound_pool_error_e _sound_pool_create(size_t max_streams, sound_pool_t **pool);
+sound_pool_error_e _sound_pool_create(sound_pool_t **pool);
 
 sound_pool_error_e _sound_pool_destroy(sound_pool_t *pool);
 
index b862f0d..5144cff 100644 (file)
@@ -66,8 +66,8 @@ typedef void (*sound_pool_state_change_cb) (sound_pool_h pool,
  * @param [in]  prev_state  Previous stream state
  * @param [in]  cur_state   Current stream state
  * @param [in]  data        The user data passed from the code where
- *                          @ref sound_pool_stream_set_state_change_callback() was
- *                          called.
+ *                          @ref sound_pool_stream_set_state_change_callback()
+ *                          was called.
  *
  * @pre Create sound pool handler by calling @ref sound_pool_create()
  * @pre Load source to pool by calling @ref sound_pool_load_source_from_file()
@@ -95,11 +95,10 @@ typedef void (*sound_pool_stream_state_change_cb) (sound_pool_h pool,
  *          @ref sound_pool_activate() function.
  *
  * @since_tizen 3.0
- * @param [in]   max_streams    Maximum number of active streams
- * @param [out]  pool           The handle to the pool that will be created
+ * @param [out] pool    The handle to the pool that will be created
  * @return @c 0 on success, otherwise a negative error value
  * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER
- *         Invalid parameter (@a pool is NULL or @a max_streams is 0)
+ *         Invalid parameter (@a pool is NULL)
  * @retval #SOUND_POOL_ERROR_OUT_OF_MEMORY
  *         Not enough memory to create sound pool
  * @retval #SOUND_POOL_ERROR_INVALID_OPERATION
@@ -107,7 +106,7 @@ typedef void (*sound_pool_stream_state_change_cb) (sound_pool_h pool,
  *
  * @see sound_pool_destroy()
  */
-sound_pool_error_e sound_pool_create(unsigned max_streams, sound_pool_h *pool);
+sound_pool_error_e sound_pool_create(sound_pool_h *pool);
 
 /**
  * @brief Destroys sound pool and cleans allocated memory.
@@ -151,8 +150,8 @@ sound_pool_error_e sound_pool_destroy(sound_pool_h pool);
  * @see sound_pool_destroy()
  * @see sound_pool_unload_source()
  */
-sound_pool_error_e sound_pool_load_source_from_file(sound_pool_h pool, const char *file_name,
-               const char *tag);
+sound_pool_error_e sound_pool_load_source_from_file(sound_pool_h pool,
+               const char *file_name, const char *tag);
 
 /**
  * @brief Unloads source from @a pool.
@@ -199,6 +198,9 @@ sound_pool_error_e sound_pool_get_state(sound_pool_h pool,
 
 /**
  * @brief Changes current @a state of @a pool to SOUND_POOL_STATE_ACTIVE.
+ * @remarks When activation is performed, all suspended streams with highest
+ *          priority in the pool will resume their playback. Paused streams will
+ *          remain their state.
  *
  * @since_tizen 3.0
  * @param [in]  pool     The handle to the sound pool
@@ -219,6 +221,9 @@ sound_pool_error_e sound_pool_activate(sound_pool_h pool);
 
 /**
  * @brief Changes current @a state of @a pool to SOUND_POOL_STATE_INACTIVE.
+ * @remarks When deactivation is performed, all playing streams in the pool will
+ *          be suspended (change state to SOUND_POOL_STREAM_STATE_SUSPENDED).
+ *          Paused streams will remain their state.
  *
  * @since_tizen 3.0
  * @param [in]  pool     The handle to the sound pool
@@ -271,7 +276,8 @@ sound_pool_error_e sound_pool_set_state_change_callback(sound_pool_h pool,
  *         (@a pool is NULL or corrupted)
  *
  * @pre Create sound @a pool handler by calling @ref sound_pool_create()
- * @pre Set state change callback by calling @ref sound_pool_set_state_change_callback()
+ * @pre Set state change callback by calling
+ *      @ref sound_pool_set_state_change_callback()
  *
  * @see sound_pool_create()
  * @see sound_pool_set_state_change_callback()
@@ -283,10 +289,7 @@ sound_pool_error_e sound_pool_unset_state_change_callback(sound_pool_h pool);
  * @details Creates stream with @a id that can be used to change parameters and
  *          get additional information.
  *          Sets stream state to SOUND_POOL_STREAM_STATE_PLAYING
- * @remarks In case maximum active streams number after calling
- *          @ref sound_pool_stream_play() was exceeded the stream
- *          with lowest @a priority will be stopped.
- *          Resultant stream volume will depend on global pool volume.
+ * @remarks Resultant stream volume will depend on global pool volume.
  *
  * @since_tizen 3.0
  * @param [in]  pool        The handle to the sound pool
@@ -294,7 +297,9 @@ sound_pool_error_e sound_pool_unset_state_change_callback(sound_pool_h pool);
  * @param [in]  loop        Number of times stream will be repeated
  *                          (pass 0 if stream should be repeated continuously)
  * @param [in]  volume      Stream volume in 0.0~1.0 range
- * @param [in]  priority    Stream priority (0 = lowest priority)
+ * @param [in]  priority    Stream priority (0 = lowest priority). Check
+ *                          @ref sound_pool_stream_set_priority() documentation
+ *                          for details on prioritization rules.
  * @param [in]  callback    The callback that will be called after stream state
  *                          will be changed, or NULL if this callback call
  *                          isn't needed. If @a callback is set, then it will
@@ -324,8 +329,8 @@ sound_pool_error_e sound_pool_unset_state_change_callback(sound_pool_h pool);
  * @see sound_pool_set_volume
  * @see sound_pool_get_volume
  */
-sound_pool_error_e sound_pool_stream_play(sound_pool_h pool, const char *tag, unsigned loop,
-               float volume, unsigned priority,
+sound_pool_error_e sound_pool_stream_play(sound_pool_h pool, const char *tag,
+               unsigned loop, float volume, unsigned priority,
                sound_pool_stream_state_change_cb callback, void *user_data,
                unsigned *id);
 
@@ -499,7 +504,8 @@ sound_pool_error_e sound_pool_stream_get_state(sound_pool_h pool, unsigned id,
  * @see sound_pool_load_source_from_file()
  * @see sound_pool_stream_play()
  */
-sound_pool_error_e sound_pool_stream_set_loop(sound_pool_h pool, unsigned id, unsigned loop);
+sound_pool_error_e sound_pool_stream_set_loop(sound_pool_h pool, unsigned id,
+               unsigned loop);
 
 /**
  * @brief Gets stream @a loop parameter by stream @a id.
@@ -525,7 +531,8 @@ sound_pool_error_e sound_pool_stream_set_loop(sound_pool_h pool, unsigned id, un
  * @see sound_pool_load_source_from_file()
  * @see sound_pool_stream_play()
  */
-sound_pool_error_e sound_pool_stream_get_loop(sound_pool_h pool, unsigned id, unsigned *loop);
+sound_pool_error_e sound_pool_stream_get_loop(sound_pool_h pool, unsigned id,
+               unsigned *loop);
 
 /**
  * @brief Sets stream volume parameters by stream @a id.
@@ -582,6 +589,26 @@ sound_pool_error_e sound_pool_stream_get_volume(sound_pool_h pool, unsigned id,
 
 /**
  * @brief Sets stream priority parameter by stream @a id.
+ * @remarks Only streams with highest priority in the active Sound Pool can be
+ *          played. If at least one stream with highest priority gets
+ *          #SOUND_POOL_STREAM_STATE_PLAYING state, then all has been playing
+ *          streams with lower priorities will be transfered to the
+ *          #SOUND_POOL_STREAM_STATE_SUSPENDED state. If there is no more
+ *          playing streams in some priority group (group of streams with the
+ *          same priority), then all suspended previously streams in the group
+ *          with one level lower priority will be resumed. For example, if we
+ *          have N suspended streams in 'LOW' group, M suspended streams in
+ *          'MEDIUM' group and K playing streams in 'HIGH' group then the
+ *          following rules are valid: When all K streams in HIGH priority group
+ *          will be finished, paused, or stopped and Sound Pool is in active
+ *          state, only then M streams from MEDIUM priority group will be
+ *          resumed. When all M+K streams from HIGH and MEDIUM priority groups
+ *          will be finished, paused or stopped and Sound Pool is in active
+ *          state, only then N streams from LOW priority group will be resumed.
+ *          Transfering at least one stream from higher priority group will lead
+ *          to suspending of all the streams from lower priorities group(s).
+ *          Priorities don't make any effect in inactive Sound Pools. But after
+ *          pool activation, all mentioned rules will be applied.
  *
  * @since_tizen 3.0
  * @param [in]  pool        The handle to the sound pool
@@ -609,9 +636,11 @@ sound_pool_error_e sound_pool_stream_set_priority(sound_pool_h pool, unsigned id
  * @brief Gets stream priority parameter by stream @a id.
  *
  * @since_tizen 3.0
- * @param [in]  pool        The handle to the sound pool
- * @param [in]  id          Unique stream identifier
- * @param [in]  priority    Stream priority (0 = lowest priority)
+ * @param [in]   pool        The handle to the sound pool
+ * @param [in]   id          Unique stream identifier
+ * @param [out]  priority    Stream priority (0 = lowest priority). Check
+ *                           @ref sound_pool_stream_set_priority() documentation
+ *                           for details on prioritization rules.
  * @return @c 0 on success, otherwise a negative error value
  * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
  *         (@a pool is NULL or corrupted, or @a priority is NULL)
@@ -658,8 +687,8 @@ sound_pool_error_e sound_pool_stream_get_priority(sound_pool_h pool, unsigned id
  * @see sound_pool_stream_play()
  * @see sound_pool_stream_state_change_cb
  */
-sound_pool_error_e sound_pool_stream_set_state_change_callback(sound_pool_h pool, unsigned id,
-               sound_pool_stream_state_change_cb callback, void *user_data);
+sound_pool_error_e sound_pool_stream_set_state_change_callback(sound_pool_h pool,
+               unsigned id, sound_pool_stream_state_change_cb callback, void *user_data);
 
 /**
  * @brief Unsets callback for handling stream state change events.
index d2cd0d2..540e8b3 100644 (file)
@@ -39,8 +39,7 @@ extern "C" {
  *
  * @since_tizen 3.0
  */
-typedef enum
-{
+typedef enum {
        SOUND_POOL_ERROR_NONE
                        = TIZEN_ERROR_NONE,                /**< Successful */
        SOUND_POOL_ERROR_NOT_SUPPORTED
index d8ff7c1..0f5a7f2 100644 (file)
  */
 
 #include "internal/priority.h"
+#include "internal/stream_cb_manager.h"
 
-static gint __stream_stream_proirity_cmp(gconstpointer a, gconstpointer b);
+static gint __sound_stream_priority_cmp(gconstpointer a, gconstpointer b);
 
-static gint __stream_stream_proirity_cmp(gconstpointer a, gconstpointer b)
+static gint __sound_stream_priority_cmp(gconstpointer a, gconstpointer b)
 {
        SP_DEBUG_FENTER();
        SP_RETVM_IF(!a, 0, "Firs pointer is NULL.");
@@ -133,8 +134,7 @@ sound_pool_error_e _sound_stream_priority_check(stream_priority_manager_t *mgr,
        SP_RETVM_IF(-1 == position, SOUND_POOL_ERROR_INVALID_PARAMETER,
                        "Can't find stream in priority queue[%s]", stream->parent_source->tag_name);
 
-       if (position < mgr->pool->max_streams)
-               *out = TRUE;
+       *out = TRUE;
 
        SP_DEBUG_FLEAVE();
        return SOUND_POOL_ERROR_NONE;
@@ -154,12 +154,11 @@ void _sound_stream_priority_update_playback(stream_priority_manager_t *mgr)
        }
 
        mgr->priority_queue = g_list_sort(mgr->priority_queue,
-                       __stream_stream_proirity_cmp);
+                       __sound_stream_priority_cmp);
 
        GList *iter = mgr->priority_queue;
        for (; iter != NULL; iter = iter->next) {
                sound_stream_t *stream = (sound_stream_t *)iter->data;
-
                if (SOUND_POOL_ERROR_NONE != _sound_stream_priority_check(mgr, stream,
                                &can_run))
                        continue;
index 15a179f..54c802e 100644 (file)
 
 static unsigned int sound_pool_amount = 0;
 
-sound_pool_error_e sound_pool_create(unsigned max_streams, sound_pool_h *pool)
+sound_pool_error_e sound_pool_create(sound_pool_h *pool)
 {
        SP_DEBUG_FENTER();
-       SP_RETVM_IF(max_streams == 0, SOUND_POOL_ERROR_INVALID_PARAMETER,
-                               "Max streams count should be greater then 0.");
        SP_RETVM_IF(SOUND_POOL_MAX_POOLS_AMOUNT < (sound_pool_amount + 1),
                        SOUND_POOL_ERROR_INVALID_OPERATION,
                        "Max pools count should be no more than %d.",
@@ -44,7 +42,7 @@ sound_pool_error_e sound_pool_create(unsigned max_streams, sound_pool_h *pool)
        SP_INST_CHECK(pool, SOUND_POOL_ERROR_INVALID_PARAMETER);
 
        sound_pool_t *_pool = NULL;
-       sound_pool_error_e ret = _sound_pool_create(max_streams, &_pool);
+       sound_pool_error_e ret = _sound_pool_create(&_pool);
        SP_RETVM_IF(ret != SOUND_POOL_ERROR_NONE, ret,
                        "Error while creating sound pool instance.");
        SP_INST_CHECK(pool, SOUND_POOL_ERROR_INVALID_OPERATION);
index faa6fcc..e62ae59 100644 (file)
@@ -29,7 +29,6 @@
 
 #define DEFAULT_VOLUME_VALUE 1.0f
 
-static ALCdevice *device = NULL;
 static void __stream_activate_iter(gpointer key, gpointer value,
                gpointer user_data);
 static void __stream_deactivate_iter(gpointer key, gpointer value,
@@ -73,11 +72,10 @@ static void __stream_deactivate_iter(gpointer key, gpointer value,
        SP_DEBUG_FLEAVE();
 }
 
-sound_pool_error_e _sound_pool_create(size_t max_streams, sound_pool_t **pool)
+sound_pool_error_e _sound_pool_create(sound_pool_t **pool)
 {
        SP_DEBUG_FENTER();
-       SP_RETVM_IF(max_streams == 0, SOUND_POOL_ERROR_INVALID_PARAMETER,
-                       "Max streams count should be greater than 0.");
+       SP_INST_CHECK(pool, SOUND_POOL_ERROR_INVALID_PARAMETER);
 
        sound_pool_t *_pool = NULL;
        SP_RETVM_IF(!(_pool = g_try_malloc0(sizeof(*_pool))),
@@ -111,7 +109,6 @@ sound_pool_error_e _sound_pool_create(size_t max_streams, sound_pool_t **pool)
                                "table in sound pool", cfail);
        }
 
-       _pool->max_streams = max_streams;
        _pool->volume = DEFAULT_VOLUME_VALUE;
        _pool->max_stream_index = 0;
        _pool->state = SOUND_POOL_STATE_INACTIVE;
index c67c2a2..09631b3 100644 (file)
@@ -74,7 +74,6 @@ static int __sound_pool_remove_source(sound_pool_t *pool, sound_source_t *src)
                g_hash_table_iter_init(&iter, pool->streams);
                while (g_hash_table_iter_next(&iter, &key, &value)) {
                        guint size_before = g_hash_table_size(pool->streams);
-                       gchar *tag = (gchar*)key;
                        sound_stream_t *stream = (sound_stream_t*)value;
                        if (src == stream->parent_source)
                                _sound_stream_destroy((sound_stream_t*)value);
index d2bb663..aace90f 100644 (file)
@@ -102,7 +102,8 @@ static void __al_source_state_cb(ALuint source, ALenum state, ALvoid *data)
        SP_DEBUG_FLEAVE();
 }
 
-static sound_pool_error_e __sound_pool_add_stream(sound_pool_t *pool, sound_stream_t *stream)
+static sound_pool_error_e __sound_pool_add_stream(sound_pool_t *pool,
+               sound_stream_t *stream)
 {
        SP_DEBUG_FENTER();
        SP_INST_CHECK(pool, SOUND_POOL_ERROR_INVALID_PARAMETER);
@@ -122,7 +123,8 @@ static sound_pool_error_e __sound_pool_add_stream(sound_pool_t *pool, sound_stre
                        SOUND_POOL_ERROR_INVALID_OPERATION, "Error occurred when adding "
                        "the stream [%u] to the sound pool", stream->id);
 
-       sound_pool_error_e ret = _sound_stream_priority_add_stream(pool->mgr_priority, stream);
+       sound_pool_error_e ret =
+                       _sound_stream_priority_add_stream(pool->mgr_priority, stream);
        SP_RETVM_IF(SOUND_POOL_ERROR_NONE != ret, ret, "Error occurred when adding "
                        "the stream [%u] to the priority queue.", stream->id);
 
@@ -454,7 +456,8 @@ sound_pool_error_e _sound_stream_get_state(sound_stream_t *stream,
        return SOUND_POOL_ERROR_NONE;
 }
 
-sound_pool_error_e _sound_stream_set_priority(sound_stream_t *stream, unsigned rank)
+sound_pool_error_e _sound_stream_set_priority(sound_stream_t *stream,
+               unsigned rank)
 {
        SP_DEBUG_FENTER();
        SP_INST_CHECK(stream, SOUND_POOL_ERROR_INVALID_PARAMETER);
@@ -483,7 +486,8 @@ sound_pool_error_e _sound_stream_set_priority(sound_stream_t *stream, unsigned r
        return SOUND_POOL_ERROR_NONE;
 }
 
-sound_pool_error_e _sound_stream_get_priority(sound_stream_t *stream, unsigned *rank)
+sound_pool_error_e _sound_stream_get_priority(sound_stream_t *stream,
+               unsigned *rank)
 {
        SP_DEBUG_FENTER();
        SP_INST_CHECK(stream, SOUND_POOL_ERROR_INVALID_PARAMETER);
index deaa36b..c2837b4 100644 (file)
@@ -22,7 +22,8 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-#define DEFAULT_MAX_STREAMS_PER_POOL_CNT 25
+#define DEFAULT_MAX_STREAMS_PER_POOL_CNT 25U
+#define DEFAULT_STREAM_PRIORITY_RANK 255U
 #define MICROSECS_PER_MILLISEC 1000
 
 #define MAX_POOL_CNT 100
@@ -35,13 +36,14 @@ static char *scripts[MAX_POOL_CNT] = { NULL };
 
 #define MAX_STREAM_CNT 1000
 /* Messages to be used for callbacks output (for pool state changing) */
-static char *stream_messages[MAX_POOL_CNT][MAX_STREAM_CNT] = { NULL };
+static char *stream_messages[MAX_POOL_CNT][MAX_STREAM_CNT] = {{ NULL }};
 /* Messages to be used for callbacks output (for stream state changing) */
-static char *stream_scripts[MAX_POOL_CNT][MAX_STREAM_CNT] = { NULL };
+static char *stream_scripts[MAX_POOL_CNT][MAX_STREAM_CNT] = {{ NULL }};
 
+static const char *__stringify_sound_pool_error(sound_pool_error_e error);
 static int __proxy_sound_pool_execute_script(const char *pars);
 
-const char *__stringify_sound_pool_error(sound_pool_error_e error)
+static const char *__stringify_sound_pool_error(sound_pool_error_e error)
 {
        switch (error) {
        case SOUND_POOL_ERROR_NONE:
@@ -71,6 +73,9 @@ const char *__stringify_sound_pool_error(sound_pool_error_e error)
        case SOUND_POOL_ERROR_PERMISSION_DENIED:
                return "SOUND_POOL_ERROR_PERMISSION_DENIED";
                break;
+       case SOUND_POOL_ERROR_NO_SUCH_FILE:
+               return "SOUND_POOL_ERROR_NO_SUCH_FILE";
+               break;
        default:
                return "";
                break;
@@ -243,11 +248,12 @@ static int __print_cmd_help_msg()
                        "identifiers.\n");
 
        printf(CMD_SET_STREAM_PRIORITY "\n");
-       printf("\t- use this command to set priority parameter of the stream.\n");
+       printf("\t- use this command to set priority parameter of the stream. "
+                       "0 is the lowest priority.\n");
 
        printf(CMD_GET_STREAM_PRIORITY "\n");
        printf("\t- shows priority rank of the stream in the pool with specified "
-                       "identifiers.\n");
+                       "identifiers. 0 is the lowest priority.\n");
 
        printf(CMD_GET_STREAM_STATE "\n");
        printf("\t- shows state of the stream in the pool with specified "
@@ -282,22 +288,17 @@ static int __print_cmd_help_msg()
 }
 
 /* CMD_CREATE_POOL */
-static int __proxy_sound_pool_create(const char *pars)
+static int __proxy_sound_pool_create()
 {
        _logger_log_info(CMD_CREATE_POOL " command was called");
-
-       unsigned int max_streams = DEFAULT_MAX_STREAMS_PER_POOL_CNT;
-       if (pars != NULL)
-               sscanf(pars, " %u", &max_streams);
-
        _logger_log_info("Creating the pool...");
 
        sound_pool_h pool = NULL;
-       int ret = sound_pool_create(max_streams, &pool);
+       int ret = sound_pool_create(&pool);
 
        if (ret == SOUND_POOL_ERROR_NONE) {
-               _logger_log_info("sound_pool_create(%u, pool) returned %s value",
-                               max_streams, __stringify_sound_pool_error(ret));
+               _logger_log_info("sound_pool_create(pool) returned %s value",
+                               __stringify_sound_pool_error(ret));
 
                size_t idx = 0;
                while (idx < MAX_POOL_CNT) {
@@ -330,8 +331,8 @@ static int __proxy_sound_pool_create(const char *pars)
                else
                        _logger_log_info("Identifier of the pool has been created is %zu", idx);
        } else {
-               _logger_log_err("sound_pool_create(%u, pool) returned %s value",
-                               max_streams, __stringify_sound_pool_error(ret));
+               _logger_log_err("sound_pool_create(pool) returned %s value",
+                               __stringify_sound_pool_error(ret));
        }
 
        return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
@@ -826,15 +827,16 @@ static int __proxy_sound_pool_play_stream(const char *pars)
        size_t idx = 0;
        int loop = 0;
        float volume = 1.0f;
-       int rank = 0;
+       unsigned rank = DEFAULT_STREAM_PRIORITY_RANK;
 
        char tag[MAX_PATH_LEN] = {'\0'};
 
-       if ((pars == NULL) || sscanf(pars, " %zu %"MAX_PATH_LEN_STR"[^ ] %i %f %i",
+       if ((pars == NULL) || sscanf(pars, " %zu %"MAX_PATH_LEN_STR"[^ ] %i %f %u",
                                             &idx, tag, &loop, &volume, &rank) < 2) {
                _printf(CMD_COLOR_RED, "You have to specify at least pool identifier and "
                                "source tag to be played in stream! Format: " CMD_PLAY_STREAM
-                               " <pool id> <source tag> <loop> <volume> <priority rank>... \n");
+                               " <pool id> <source tag> <loop> <volume> <priority rank>... "
+                               "0 'priority rank' value corresponds to the lowest priority.\n");
                return FAIL;
        }
 
@@ -851,18 +853,18 @@ static int __proxy_sound_pool_play_stream(const char *pars)
        _logger_log_info("Playing stream based on source with '%s' tag from the pool "
                        "with %zu identifier...", tag, idx);
 
-       int stream_idx = 0;
+       unsigned stream_idx = 0;
        int ret = sound_pool_stream_play(pools[idx], tag, loop, volume, rank, NULL,
                        NULL, &stream_idx);
 
        if (ret == SOUND_POOL_ERROR_NONE) {
-               _logger_log_info("sound_pool_play_stream(pool, \"%s\", %i, %f, %i,"
+               _logger_log_info("sound_pool_play_stream(pool, \"%s\", %i, %f, %u,"
                                " NULL, NULL, &stream_idx) returned %s value. "
                                "Generated identifier is %i", tag, loop, volume, rank,
                                __stringify_sound_pool_error(ret), stream_idx);
                _printf(CMD_COLOR_GREEN, "Generated stream identifier is %i\n", stream_idx);
        } else {
-               _logger_log_err("sound_pool_play_stream(pool, \"%s\", %i, %f, %i,"
+               _logger_log_err("sound_pool_play_stream(pool, \"%s\", %i, %f, %u,"
                                " NULL, NULL, &stream_idx) returned %s value",
                                tag, loop, volume, rank, __stringify_sound_pool_error(ret));
        }
@@ -1150,10 +1152,10 @@ static int __proxy_sound_pool_stream_set_priority(const char *pars)
 {
        size_t idx = 0;
        size_t stream_idx = 0;
-       int rank_val = 0;
+       unsigned rank = 0;
 
        if ((pars == NULL)
-                       || (sscanf(pars, " %zu %zu %i", &idx, &stream_idx, &rank_val) < 3)) {
+                       || (sscanf(pars, " %zu %zu %u", &idx, &stream_idx, &rank) < 3)) {
                _printf(CMD_COLOR_RED, "You have to specify all following parameters: "
                                "pool identifier, stream identifier, and priority rank! Format: "
                                CMD_SET_STREAM_PRIORITY " <pool id> <stream id> <rank>\n");
@@ -1169,21 +1171,21 @@ static int __proxy_sound_pool_stream_set_priority(const char *pars)
        if (pools[idx] == NULL)
                _logger_log_warn("Pool with specified identifier is NULL");
 
-       if (rank_val < 0)
+       if (rank < 0)
                _logger_log_warn("Priority rank should to be greater or equal 0, but "
-                               "it's value is %i", rank_val);
+                               "it's value is %i", rank);
 
        _logger_log_info(CMD_SET_STREAM_PRIORITY " command was called");
 
-       int ret = sound_pool_stream_set_priority(pools[idx], stream_idx, rank_val);
+       int ret = sound_pool_stream_set_priority(pools[idx], stream_idx, rank);
 
        if (ret == SOUND_POOL_ERROR_NONE)
-               _logger_log_info("sound_pool_stream_set_priority(pool, %zu, %i) "
-                               "returned %s value", stream_idx, rank_val,
+               _logger_log_info("sound_pool_stream_set_priority(pool, %zu, %u) "
+                               "returned %s value", stream_idx, rank,
                                __stringify_sound_pool_error(ret));
        else
-               _logger_log_err("sound_pool_stream_set_priority(pool, %zu, %i) "
-                               "returned %s value", stream_idx, rank_val,
+               _logger_log_err("sound_pool_stream_set_priority(pool, %zu, %u) "
+                               "returned %s value", stream_idx, rank,
                                __stringify_sound_pool_error(ret));
 
        return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
@@ -1218,12 +1220,12 @@ static int __proxy_sound_pool_stream_get_priority(const char *pars)
        int ret = sound_pool_stream_get_priority(pools[idx], stream_idx, &rank);
 
        if (ret == SOUND_POOL_ERROR_NONE)
-               _logger_log_info("sound_pool_stream_get_priority(pool, %zu, rank) "
-                               "returned %s value, rank value is %i", stream_idx,
+               _logger_log_info("sound_pool_stream_get_priority(pool, %u, rank) "
+                               "returned %s value, rank value is %u", stream_idx,
                                __stringify_sound_pool_error(ret), rank);
        else
-               _logger_log_err("sound_pool_stream_get_priority(pool, %zu, rank) "
-                               "returned %s value, rank value is %i", stream_idx,
+               _logger_log_err("sound_pool_stream_get_priority(pool, %u, rank) "
+                               "returned %s value, rank value is %u", stream_idx,
                                __stringify_sound_pool_error(ret), rank);
 
        return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
@@ -1502,7 +1504,7 @@ static int __proxy_sound_pool_execute_script(const char *pars)
 
 /* Number of parameters supported by each command */
 static int cmd_pars[MAX_COMMAND_LINE_LEN] = { /* CMD_EXIT */ 0,
-               /* CMD_HELP */ 0, /* CMD_CREATE_POOL */ 1, /* CMD_DESTROY_POOL */ 1,
+               /* CMD_HELP */ 0, /* CMD_CREATE_POOL */ 0, /* CMD_DESTROY_POOL */ 1,
                /* CMD_ACTIVATE_POOL */ 1, /* CMD_DEACTIVATE_POOL */ 1,
                /* CMD_GET_POOL_STATE */ 1, /* CMD_SET_POOL_VOLUME */ 2,
                /* CMD_GET_POOL_VOLUME */ 2, /* CMD_SET_POOL_CB_MSG */ 2,
@@ -1562,7 +1564,7 @@ int _exec_cmd(const char *cmd_line)
        while((cmd_line + trim_len)[0] == ' ')
                trim_len++;
 
-       char *cmd = cmd_line + trim_len;
+       const char *cmd = cmd_line + trim_len;
 
        /* Macro for checking command correctness */
 #   define CHECK_CMD(ccmd, line) \