[ACR-1347] Modify the parameter value range of buffering function 21/198621/18
authorEunhae Choi <eunhae1.choi@samsung.com>
Mon, 28 Jan 2019 06:40:15 +0000 (15:40 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Thu, 21 Feb 2019 10:31:39 +0000 (19:31 +0900)
- Allow '-1' value to keep previous setting.
- Add missed error code : PLAYER_ERROR_INVALID_OPERATION
- Modify API reference

Change-Id: I03beabed7d10ee0de810f1555dd0159180c69bee

include/player.h
src/player.c

index 81beb3f4278ff23a1300c66fb5978c756f29a974..38e742650db343d6d5a11aacaa0b0f2a63eb2b82 100644 (file)
@@ -2349,17 +2349,40 @@ int player_get_video_roi_area(player_h player, double *x_scale, double *y_scale,
  * @brief Sets the streaming buffering time.
  * @since_tizen 4.0
  * @param[in] player        The handle to the media player
- * @param[in] prebuffer_ms  The time duration of buffering data that must be prerolled to start playback
+ * @param[in] prebuffer_ms  The time duration of buffering data that must be prerolled to start playback. \n
+ *                          At least 1000 milliseconds is recommended to ensure the normal buffering operation except 0 or -1. \n
+ *                           0 : use platform default value which could be different depending on the streaming type and network status (default) \n
+ *                          -1 : use current value (since 5.5) \n
  * @param[in] rebuffer_ms   The time duration of buffering data that must be prerolled to resume playback
- *                          if player is paused for buffering internally.
+ *                          if player is paused for buffering internally. \n
+ *                          At least 1000 milliseconds is recommended to ensure the normal buffering operation except 0 or -1. \n
+ *                           0 : use platform default value which could be different depending on the streaming type and network status (default) \n
+ *                          -1 : use current value (since 5.5)\n
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #PLAYER_ERROR_NONE Successful
  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #PLAYER_ERROR_INVALID_STATE Invalid state
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation (since 5.5)
  * @if WEARABLE @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature @endif
  * @pre The player state must be #PLAYER_STATE_IDLE.
  * @see player_get_streaming_buffering_time()
+ * @par Example
+ * @code
+   #include <player.h>
+   bool set_buffering_time(player_h p)
+   {
+       int err = PLAYER_ERROR_NONE;
+
+       // sets the prebuffer_ms to 5000 milliseconds but does not change the rebuffer_ms
+       err =  player_set_streaming_buffering_time(p, 5000, -1);
+       if (err != PLAYER_ERROR_NONE) {
+          printf("Fail to set buffering time = %x\n", err);
+          return false;
+       }
+       return true;
+   }
+ * @endcode
  */
 int player_set_streaming_buffering_time(player_h player, int prebuffer_ms, int rebuffer_ms);
 
@@ -2369,7 +2392,10 @@ int player_set_streaming_buffering_time(player_h player, int prebuffer_ms, int r
  * @param[in]  player        The handle to the media player
  * @param[out] prebuffer_ms  The time duration of buffering data that must be prerolled to start playback
  * @param[out] rebuffer_ms   The time duration of buffering data that must be prerolled to resume playback
- *                           if player enters pause state for buffering.
+ *                           if player is paused for buffering internally. \n
+ *                           @c 0 means platform default value which could be different depending on the streaming type and network status.
+ *                           If the player state is #PLAYER_STATE_PLAYING or #PLAYER_STATE_PAUSED,
+ *                           this function will return correct time value instead of @c 0. (since 5.5)
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #PLAYER_ERROR_NONE Successful
index 5f3169face448705890c768ea8e62143a324e9d7..7edc01885b87b262f715be22cce59f81ab889250 100644 (file)
@@ -4763,9 +4763,10 @@ int player_is_audio_only(player_h player, bool *paudio_only)
 
 int player_set_streaming_buffering_time(player_h player, int prebuffer_ms, int rebuffer_ms)
 {
+#define MIN_BUFFER_TIME -1
        int ret = PLAYER_ERROR_NONE;
        PLAYER_INSTANCE_CHECK(player);
-       PLAYER_CHECK_CONDITION(prebuffer_ms >= 0 && rebuffer_ms >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
+       PLAYER_CHECK_CONDITION(prebuffer_ms >= MIN_BUFFER_TIME && rebuffer_ms >= MIN_BUFFER_TIME, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
 
        player_cli_s *pc = (player_cli_s *)player;
        muse_player_api_e api = MUSE_PLAYER_API_SET_STREAMING_BUFFERING_TIME;