From e1f253889f76cbf46ff65125852254c1082abc06 Mon Sep 17 00:00:00 2001 From: review-bot Date: Mon, 28 Aug 2023 15:55:05 +0900 Subject: [PATCH] [Reform] Apply Coding Style --- include/esplusplayer/esplusplayer.h | 62 +++++++++++++----------- include/esplusplayer_capi/esplusplayer_capi.h | 48 +++++++++++------- src/esplusplayer/src/esplusplayer_capi.cpp | 8 +-- src/plusplayer-core/src/trackrendereradapter.cpp | 11 ++--- ut/include/esplusplayer/tclist.h | 37 +++++++------- ut/src/esplusplayer/ut_low_latency_pcm.cpp | 34 ++++++++----- 6 files changed, 114 insertions(+), 86 deletions(-) diff --git a/include/esplusplayer/esplusplayer.h b/include/esplusplayer/esplusplayer.h index c7b9ebb..b08dc1a 100644 --- a/include/esplusplayer/esplusplayer.h +++ b/include/esplusplayer/esplusplayer.h @@ -196,11 +196,13 @@ enum PlayerVideoCodecType { */ enum PlayerVideoScanType { /** - * @description progressive, mfd or dvde will be allocated for H.264 2K in normal mode. + * @description progressive, mfd or dvde will be allocated for H.264 2K in + * normal mode. */ kPlayerVideoScanTypeProgressive, /** - * @description interlaced, only mfd has been allocated for H.264 2K in normal mode. + * @description interlaced, only mfd has been allocated for H.264 2K in normal + * mode. */ kPlayerVideoScanTypeInterlaced, }; @@ -262,7 +264,7 @@ class EsPlusPlayer : private boost::noncopyable { * @return @c True on success, otherwise @c False * @see Close() */ -// LCOV_EXCL_START + // LCOV_EXCL_START virtual bool Open() { return false; } /** * @brief Release all the player resources @@ -741,7 +743,7 @@ class EsPlusPlayer : private boost::noncopyable { virtual EsState GetState() { return EsState::kNone; } /** * @brief Get the current playing time of the associated media. - * @param [out] time : current playing time default in milliseconds, + * @param [out] time : current playing time default in milliseconds, * can be set by @SetTimeUnitType * @pre The player must be one of #EsState::kPlaying or * #EsState::kPaused @@ -1248,24 +1250,26 @@ class EsPlusPlayer : private boost::noncopyable { } /** - * @brief Set the time unit type, ms or us. - * @param [in] type : The type of time unit, defalut is ms. - * @pre The player state must be set to #EsState::kIdle. - * @post None - * @return @c True on success, otherwise @c False - * @exception None - */ + * @brief Set the time unit type, ms or us. + * @param [in] type : The type of time unit, defalut is ms. + * @pre The player state must be set to #EsState::kIdle. + * @post None + * @return @c True on success, otherwise @c False + * @exception None + */ virtual bool SetTimeUnitType(const PlayerTimeUnitType type) { return false; } /** * @brief Set the rotate angle of video stream * @param [in] rotation : Rotate type. - * @pre The player state can be all of #EsState except #EsState::kNone + * @pre The player state can be all of #EsState except #EsState::kNone * @post None - * @return @c True on success, otherwise @c False - * @exception None + * @return @c True on success, otherwise @c False + * @exception None */ - virtual bool SetVideoStreamRotationInfo(const VideoRotation& rotation) { return false; } + virtual bool SetVideoStreamRotationInfo(const VideoRotation& rotation) { + return false; + } /** * @brief Get the rotate angle of video stream @@ -1273,22 +1277,26 @@ class EsPlusPlayer : private boost::noncopyable { * @pre The player state can be all of #EsState except #EsState::kNone * @post None * @return @c True on success, otherwise @c False - * @exception None + * @exception None */ - virtual bool GetVideoStreamRotationInfo(VideoRotation* rotation) { return false; } + virtual bool GetVideoStreamRotationInfo(VideoRotation* rotation) { + return false; + } /** - * @brief Set buffer level of simple mix out - * @param [in] level : buffer level of simple mix out - * @pre The player state must be set to #EsState::kIdle. - * @post None - * @return @c True on success, otherwise @c False - * @exception None - */ - virtual bool SetSimpleMixOutBufferLevel(const PlayerSimpleMixOutBufferLevel level) { return false; } - -// LCOV_EXCL_STOP + * @brief Set buffer level of simple mix out + * @param [in] level : buffer level of simple mix out + * @pre The player state must be set to #EsState::kIdle. + * @post None + * @return @c True on success, otherwise @c False + * @exception None + */ + virtual bool SetSimpleMixOutBufferLevel( + const PlayerSimpleMixOutBufferLevel level) { + return false; + } + // LCOV_EXCL_STOP protected: EsPlusPlayer() noexcept {}; diff --git a/include/esplusplayer_capi/esplusplayer_capi.h b/include/esplusplayer_capi/esplusplayer_capi.h index 4e421f4..6d8114d 100644 --- a/include/esplusplayer_capi/esplusplayer_capi.h +++ b/include/esplusplayer_capi/esplusplayer_capi.h @@ -3109,14 +3109,16 @@ int esplusplayer_set_audio_high_latency_threshold( * @brief Provided api for getting the maximum number of frames. * @param [in] handle : esplusplayer handle. * @param [out] frame_count : maximum frame count. - * @return @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type - * values will be returned. + * @return @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * esplusplayer_error_type values will be returned. * @retval #ESPLUSPLAYER_ERROR_TYPE_NONE Successful * @retval #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter - * @retval #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @retval #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation + * failed * @code * esplusplayer_open(esplayer); - * esplusplayer_set_low_latency_mode(esplayer, ESPLUSPLAYER_LOW_LATENCY_MODE_ENABLE_GAME_MODE); + * esplusplayer_set_low_latency_mode(esplayer, + * ESPLUSPLAYER_LOW_LATENCY_MODE_ENABLE_GAME_MODE); * esplusplayer_audio_stream_info audio_stream; * audio_stream.mime_type = ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_S16LE; * audio_stream.sample_rate = 48000; @@ -3125,7 +3127,8 @@ int esplusplayer_set_audio_high_latency_threshold( * prepare esplayer done * // ... your codes ... * uint64_t frame_count = 0; - * esplusplayer_get_low_latency_pcm_buffer_size(esplayer, &frame_count) + * esplusplayer_get_low_latency_pcm_buffer_size(esplayer, + * &frame_count) * // ... your codes ... * esplusplayer_stop(esplayer); * @endcode @@ -3137,20 +3140,23 @@ int esplusplayer_set_audio_high_latency_threshold( * @see esplusplayer_get_low_latency_pcm_current_buffer_level() \n * esplusplayer_get_low_latency_pcm_underrun_count() */ -int esplusplayer_get_low_latency_pcm_buffer_size(esplusplayer_handle handle, uint64_t* frame_count); +int esplusplayer_get_low_latency_pcm_buffer_size(esplusplayer_handle handle, + uint64_t* frame_count); /** * @brief Provided api for getting the number of currently queued frames. * @param [in] handle : esplusplayer handle. * @param [out] frame_count : queued frame count. - * @return @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type - * values will be returned. + * @return @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * esplusplayer_error_type values will be returned. * @retval #ESPLUSPLAYER_ERROR_TYPE_NONE Successful * @retval #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter - * @retval #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @retval #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation + * failed * @code * esplusplayer_open(esplayer); - * esplusplayer_set_low_latency_mode(esplayer, ESPLUSPLAYER_LOW_LATENCY_MODE_ENABLE_GAME_MODE); + * esplusplayer_set_low_latency_mode(esplayer, + * ESPLUSPLAYER_LOW_LATENCY_MODE_ENABLE_GAME_MODE); * esplusplayer_audio_stream_info audio_stream; * audio_stream.mime_type = ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_S16LE; * audio_stream.sample_rate = 48000; @@ -3159,7 +3165,8 @@ int esplusplayer_get_low_latency_pcm_buffer_size(esplusplayer_handle handle, uin * prepare esplayer done * // ... your codes ... * uint64_t frame_count = 0; - * esplusplayer_get_low_latency_pcm_current_buffer_level(esplayer, &frame_count) + * esplusplayer_get_low_latency_pcm_current_buffer_level(esplayer, + * &frame_count) * // ... your codes ... * esplusplayer_stop(esplayer); * @endcode @@ -3171,20 +3178,23 @@ int esplusplayer_get_low_latency_pcm_buffer_size(esplusplayer_handle handle, uin * @see esplusplayer_get_low_latency_pcm_buffer_size() \n * esplusplayer_get_low_latency_pcm_underrun_count() */ -int esplusplayer_get_low_latency_pcm_current_buffer_level(esplusplayer_handle handle, uint64_t* frame_count); +int esplusplayer_get_low_latency_pcm_current_buffer_level( + esplusplayer_handle handle, uint64_t* frame_count); /** * @brief Provided api for getting the underrun counts in audio out. * @param [in] handle : esplusplayer handle. * @param [out] underrun_count : underrun counts in audio out. - * @return @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type - * values will be returned. + * @return @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * esplusplayer_error_type values will be returned. * @retval #ESPLUSPLAYER_ERROR_TYPE_NONE Successful * @retval #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter - * @retval #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @retval #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation + * failed * @code * esplusplayer_open(esplayer); - * esplusplayer_set_low_latency_mode(esplayer, ESPLUSPLAYER_LOW_LATENCY_MODE_ENABLE_GAME_MODE); + * esplusplayer_set_low_latency_mode(esplayer, + * ESPLUSPLAYER_LOW_LATENCY_MODE_ENABLE_GAME_MODE); * esplusplayer_audio_stream_info audio_stream; * audio_stream.mime_type = ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_S16LE; * audio_stream.sample_rate = 48000; @@ -3193,7 +3203,8 @@ int esplusplayer_get_low_latency_pcm_current_buffer_level(esplusplayer_handle ha * prepare esplayer done * // ... your codes ... * uint64_t underrun_count = 0; - * esplusplayer_get_low_latency_pcm_underrun_count(esplayer, &underrun_count) + * esplusplayer_get_low_latency_pcm_underrun_count(esplayer, + * &underrun_count) * // ... your codes ... * esplusplayer_stop(esplayer); * @endcode @@ -3205,7 +3216,8 @@ int esplusplayer_get_low_latency_pcm_current_buffer_level(esplusplayer_handle ha * @see esplusplayer_get_low_latency_pcm_buffer_size() \n * esplusplayer_get_low_latency_pcm_current_buffer_level() */ -int esplusplayer_get_low_latency_pcm_underrun_count(esplusplayer_handle handle, uint64_t* underrun_count); +int esplusplayer_get_low_latency_pcm_underrun_count(esplusplayer_handle handle, + uint64_t* underrun_count); /** * @brief Initialize easing info to esplayer. diff --git a/src/esplusplayer/src/esplusplayer_capi.cpp b/src/esplusplayer/src/esplusplayer_capi.cpp index cf8b3ab..b4f4a5c 100755 --- a/src/esplusplayer/src/esplusplayer_capi.cpp +++ b/src/esplusplayer/src/esplusplayer_capi.cpp @@ -2224,8 +2224,8 @@ int esplusplayer_set_audio_high_latency_threshold( return convert_return_type_(ret); } -int esplusplayer_get_low_latency_pcm_buffer_size( - esplusplayer_handle handle, uint64_t* frame_count) { +int esplusplayer_get_low_latency_pcm_buffer_size(esplusplayer_handle handle, + uint64_t* frame_count) { LOG_ENTER_P(cast_(handle)) if (is_null_(handle)) return ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER; @@ -2242,8 +2242,8 @@ int esplusplayer_get_low_latency_pcm_current_buffer_level( return convert_return_type_(ret); } -int esplusplayer_get_low_latency_pcm_underrun_count( - esplusplayer_handle handle, uint64_t* underrun_count) { +int esplusplayer_get_low_latency_pcm_underrun_count(esplusplayer_handle handle, + uint64_t* underrun_count) { LOG_ENTER_P(cast_(handle)) if (is_null_(handle)) return ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER; diff --git a/src/plusplayer-core/src/trackrendereradapter.cpp b/src/plusplayer-core/src/trackrendereradapter.cpp index 690e4fc..f782b94 100644 --- a/src/plusplayer-core/src/trackrendereradapter.cpp +++ b/src/plusplayer-core/src/trackrendereradapter.cpp @@ -836,8 +836,7 @@ bool TrackRendererAdapter::SetAudioHighLatencyThreshold( return true; } -bool TrackRendererAdapter::GetLowLatencyPcmBufferSize( - uint64_t* frame_count) { +bool TrackRendererAdapter::GetLowLatencyPcmBufferSize(uint64_t* frame_count) { if (trackrenderer_get_low_latency_pcm_buffer_size(handle_, frame_count) == kFailed) { return false; @@ -847,8 +846,8 @@ bool TrackRendererAdapter::GetLowLatencyPcmBufferSize( bool TrackRendererAdapter::GetLowLatencyPcmCurrentBufferLevel( uint64_t* frame_count) { - if (trackrenderer_get_low_latency_pcm_current_buffer_level(handle_, frame_count) == - kFailed) { + if (trackrenderer_get_low_latency_pcm_current_buffer_level( + handle_, frame_count) == kFailed) { return false; } return true; @@ -856,8 +855,8 @@ bool TrackRendererAdapter::GetLowLatencyPcmCurrentBufferLevel( bool TrackRendererAdapter::GetLowLatencyPcmUnderrunCount( uint64_t* underrun_count) { - if (trackrenderer_get_low_latency_pcm_underrun_count(handle_, underrun_count) == - kFailed) { + if (trackrenderer_get_low_latency_pcm_underrun_count( + handle_, underrun_count) == kFailed) { return false; } return true; diff --git a/ut/include/esplusplayer/tclist.h b/ut/include/esplusplayer/tclist.h index 3202423..dae24be 100644 --- a/ut/include/esplusplayer/tclist.h +++ b/ut/include/esplusplayer/tclist.h @@ -9,35 +9,36 @@ #include namespace es_tc { - static const std::string es_h264_aac = "es_h264_aac/"; - static const std::string es_hevc_ac3 = "es_hevc_ac3/"; - static const std::string es_vp9_opus = "es_vp9_opus/"; - static const std::string es_h264_640_360_aac = "es_h264_640_360_aac/"; - static const std::string es_pcm_6ch = "es_pcm_6ch/"; - static const std::string es_pcm_2ch = "es_pcm_2ch/"; - static std::vector tc_list = { +static const std::string es_h264_aac = "es_h264_aac/"; +static const std::string es_hevc_ac3 = "es_hevc_ac3/"; +static const std::string es_vp9_opus = "es_vp9_opus/"; +static const std::string es_h264_640_360_aac = "es_h264_640_360_aac/"; +static const std::string es_pcm_6ch = "es_pcm_6ch/"; +static const std::string es_pcm_2ch = "es_pcm_2ch/"; +static std::vector tc_list = { es_h264_aac, - //es_hevc_ac3, + // es_hevc_ac3, es_vp9_opus, - }; - static std::vector inapp_multiview_tc_list = { +}; +static std::vector inapp_multiview_tc_list = { es_h264_640_360_aac, - }; - static std::vector pcm_tc_list = { +}; +static std::vector pcm_tc_list = { es_pcm_6ch, es_pcm_2ch, - }; -} +}; +} // namespace es_tc class ContentsRoot { -public: + public: static ContentsRoot& Instance(); - virtual ~ContentsRoot() {}; + virtual ~ContentsRoot(){}; bool IsMounted(); bool MountTcDirectory(); void UnMountTcDirectory(); - std::string GetRoot() {return root_abs_path;}; -private: + std::string GetRoot() { return root_abs_path; }; + + private: explicit ContentsRoot(); bool UseUsb(); std::string root_abs_path; diff --git a/ut/src/esplusplayer/ut_low_latency_pcm.cpp b/ut/src/esplusplayer/ut_low_latency_pcm.cpp index 4361e16..1db50df 100644 --- a/ut/src/esplusplayer/ut_low_latency_pcm.cpp +++ b/ut/src/esplusplayer/ut_low_latency_pcm.cpp @@ -48,8 +48,7 @@ class EsPcmTest : public ::testing::TestWithParam { std::cout << "uri_: " << uri_ << std::endl; audio_reader_ = new EsStreamReader(uri_ + "audio/", ESPLUSPLAYER_STREAM_TYPE_AUDIO); - callback_ = - new EsPlayerEventCallback(esplayer_, nullptr, audio_reader_); + callback_ = new EsPlayerEventCallback(esplayer_, nullptr, audio_reader_); callback_->SetCallback(); std::cout << "SetUp()" << std::endl; @@ -96,7 +95,8 @@ void SetAppInfo(esplusplayer_handle esplayer) { ESPLUSPLAYER_ERROR_TYPE_NONE); } -TEST_P(EsPcmTest, vdapi_basic_esplusplayer_get_low_latency_pcm_buffer_size_p_1) { +TEST_P(EsPcmTest, + vdapi_basic_esplusplayer_get_low_latency_pcm_buffer_size_p_1) { ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE); SetAppInfo(esplayer_); ASSERT_EQ(esplusplayer_set_low_latency_mode( @@ -108,19 +108,22 @@ TEST_P(EsPcmTest, vdapi_basic_esplusplayer_get_low_latency_pcm_buffer_size_p_1) callback_->WaitForPrepareDone(); uint64_t frame_count = 0; - ASSERT_EQ(esplusplayer_get_low_latency_pcm_buffer_size(esplayer_, &frame_count), - ESPLUSPLAYER_ERROR_TYPE_NONE); + ASSERT_EQ( + esplusplayer_get_low_latency_pcm_buffer_size(esplayer_, &frame_count), + ESPLUSPLAYER_ERROR_TYPE_NONE); std::cout << "frame count : " << frame_count << std::endl; std::this_thread::sleep_for(std::chrono::seconds(3)); ASSERT_EQ(esplusplayer_start(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE); std::this_thread::sleep_for(std::chrono::seconds(2)); - ASSERT_EQ(esplusplayer_get_low_latency_pcm_buffer_size(esplayer_, &frame_count), - ESPLUSPLAYER_ERROR_TYPE_NONE); + ASSERT_EQ( + esplusplayer_get_low_latency_pcm_buffer_size(esplayer_, &frame_count), + ESPLUSPLAYER_ERROR_TYPE_NONE); std::cout << "frame count : " << frame_count << std::endl; std::this_thread::sleep_for(std::chrono::seconds(7)); } -TEST_P(EsPcmTest, vdapi_basic_esplusplayer_get_low_latency_pcm_current_buffer_level_p_1) { +TEST_P(EsPcmTest, + vdapi_basic_esplusplayer_get_low_latency_pcm_current_buffer_level_p_1) { ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE); SetAppInfo(esplayer_); ASSERT_EQ(esplusplayer_set_low_latency_mode( @@ -132,19 +135,22 @@ TEST_P(EsPcmTest, vdapi_basic_esplusplayer_get_low_latency_pcm_current_buffer_le callback_->WaitForPrepareDone(); uint64_t frame_count = 0; - ASSERT_EQ(esplusplayer_get_low_latency_pcm_current_buffer_level(esplayer_, &frame_count), + ASSERT_EQ(esplusplayer_get_low_latency_pcm_current_buffer_level(esplayer_, + &frame_count), ESPLUSPLAYER_ERROR_TYPE_NONE); std::cout << "frame count : " << frame_count << std::endl; std::this_thread::sleep_for(std::chrono::seconds(3)); ASSERT_EQ(esplusplayer_start(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE); std::this_thread::sleep_for(std::chrono::seconds(2)); - ASSERT_EQ(esplusplayer_get_low_latency_pcm_current_buffer_level(esplayer_, &frame_count), + ASSERT_EQ(esplusplayer_get_low_latency_pcm_current_buffer_level(esplayer_, + &frame_count), ESPLUSPLAYER_ERROR_TYPE_NONE); std::cout << "frame count : " << frame_count << std::endl; std::this_thread::sleep_for(std::chrono::seconds(7)); } -TEST_P(EsPcmTest, vdapi_basic_esplusplayer_get_low_latency_pcm_underrun_count_p_1) { +TEST_P(EsPcmTest, + vdapi_basic_esplusplayer_get_low_latency_pcm_underrun_count_p_1) { ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE); SetAppInfo(esplayer_); ASSERT_EQ(esplusplayer_set_low_latency_mode( @@ -156,13 +162,15 @@ TEST_P(EsPcmTest, vdapi_basic_esplusplayer_get_low_latency_pcm_underrun_count_p_ callback_->WaitForPrepareDone(); uint64_t underrun_count = 0; - ASSERT_EQ(esplusplayer_get_low_latency_pcm_underrun_count(esplayer_, &underrun_count), + ASSERT_EQ(esplusplayer_get_low_latency_pcm_underrun_count(esplayer_, + &underrun_count), ESPLUSPLAYER_ERROR_TYPE_NONE); std::cout << "underrun count : " << underrun_count << std::endl; std::this_thread::sleep_for(std::chrono::seconds(3)); ASSERT_EQ(esplusplayer_start(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE); std::this_thread::sleep_for(std::chrono::seconds(2)); - ASSERT_EQ(esplusplayer_get_low_latency_pcm_underrun_count(esplayer_, &underrun_count), + ASSERT_EQ(esplusplayer_get_low_latency_pcm_underrun_count(esplayer_, + &underrun_count), ESPLUSPLAYER_ERROR_TYPE_NONE); std::cout << "underrun count : " << underrun_count << std::endl; std::this_thread::sleep_for(std::chrono::seconds(7)); -- 2.7.4