player: change pre condition of setting min/max size in case of push stream 67/58767/1 accepted/tizen/ivi/20160218.023224 accepted/tizen/mobile/20160204.021421 accepted/tizen/tv/20160204.021754 accepted/tizen/wearable/20160204.022922 submit/tizen/20160203.102822 submit/tizen/20160203.111334 submit/tizen_ivi/20160217.000000 submit/tizen_ivi/20160217.000002
authorEunhae Choi <eunhae1.choi@samsung.com>
Wed, 3 Feb 2016 08:19:37 +0000 (17:19 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Wed, 3 Feb 2016 08:19:37 +0000 (17:19 +0900)
Change-Id: I54662e01948dc106d7212701de7ebeb3a85ab148

include/mobile/player.h
src/player.c

index bbdefccb9f5317217fd3505411e69895eaa4e324..e16024b4f6c30695dfb6d2b337924dc6b11bccd8 100644 (file)
@@ -1037,7 +1037,7 @@ int player_unset_media_stream_seek_cb(player_h player, player_stream_type_e type
  * @retval #PLAYER_ERROR_NONE Successful
  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
- * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare().
+ * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. (since 3.0)
  * @see player_get_media_stream_buffer_max_size()
  * @see player_media_stream_buffer_status_cb()
  */
@@ -1056,7 +1056,7 @@ int player_set_media_stream_buffer_max_size(player_h player, player_stream_type_
  * @retval #PLAYER_ERROR_NONE Successful
  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
- * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare().
+ * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
  * @see player_set_media_stream_buffer_max_size()
  * @see player_media_stream_buffer_status_cb()
  */
@@ -1075,7 +1075,7 @@ int player_get_media_stream_buffer_max_size(player_h player, player_stream_type_
  * @retval #PLAYER_ERROR_NONE Successful
  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
- * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare().
+ * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. (since 3.0)
  * @see player_get_media_stream_buffer_min_threshold()
  * @see player_media_stream_buffer_status_cb()
  */
@@ -1094,7 +1094,7 @@ int player_set_media_stream_buffer_min_threshold(player_h player, player_stream_
  * @retval #PLAYER_ERROR_NONE Successful
  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
- * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare().
+ * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
  * @see player_set_media_stream_buffer_min_threshold()
  * @see player_media_stream_buffer_status_cb()
  */
index eab7b16ec96b509f98901a9c86607f3f80ea0506..b5c311040ca71ddd24f17ac971aafb8f0da80fdb 100644 (file)
@@ -2850,7 +2850,10 @@ int player_set_media_stream_buffer_max_size(player_h player, player_stream_type_
        int ret;
        PLAYER_INSTANCE_CHECK(player);
        player_s *handle = (player_s *)player;
-       PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
+       if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) {
+               LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
+               return PLAYER_ERROR_INVALID_STATE;
+       }
 
        ret = mm_player_set_media_stream_buffer_max_size(handle->mm_handle, type, max_size);
 
@@ -2881,7 +2884,10 @@ int player_set_media_stream_buffer_min_threshold(player_h player, player_stream_
        int ret;
        PLAYER_INSTANCE_CHECK(player);
        player_s *handle = (player_s *)player;
-       PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
+       if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) {
+               LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
+               return PLAYER_ERROR_INVALID_STATE;
+       }
 
        ret = mm_player_set_media_stream_buffer_min_percent(handle->mm_handle, type, percent);