From 7ca866855fcee09bd8615ae80b0c904b92109b06 Mon Sep 17 00:00:00 2001 From: Xiaoming Shi Date: Mon, 14 Oct 2024 14:58:56 -0700 Subject: [PATCH] (WIP) [media] Reduce implementation in global namespace b/327287075 --- starboard/android/shared/player_create.cc | 3 +- .../shared/starboard/media/media_util.cc | 88 -------------- starboard/shared/starboard/media/media_util.h | 92 +++++++++++++-- .../shared/starboard/player/player_create.cc | 3 +- .../starboard/player/player_internal.cc | 76 ++++++------ .../shared/starboard/player/player_internal.h | 111 ++++++++++++------ 6 files changed, 199 insertions(+), 174 deletions(-) diff --git a/starboard/android/shared/player_create.cc b/starboard/android/shared/player_create.cc index 78b4ba46f252..aa6198b547c1 100644 --- a/starboard/android/shared/player_create.cc +++ b/starboard/android/shared/player_create.cc @@ -30,6 +30,7 @@ #include "starboard/string.h" using starboard::shared::starboard::player::PlayerWorker; +using starboard::shared::starboard::player::SbPlayerPrivateImpl; using starboard::shared::starboard::player::filter:: FilterBasedPlayerWorkerHandler; @@ -211,7 +212,7 @@ SbPlayer SbPlayerCreate(SbWindow window, new FilterBasedPlayerWorkerHandler(creation_param, provider)); handler->SetMaxVideoInputSize( starboard::android::shared::GetMaxVideoInputSizeForCurrentThread()); - SbPlayer player = SbPlayerPrivate::CreateInstance( + SbPlayer player = SbPlayerPrivateImpl::CreateInstance( audio_codec, video_codec, sample_deallocate_func, decoder_status_func, player_status_func, player_error_func, context, std::move(handler)); diff --git a/starboard/shared/starboard/media/media_util.cc b/starboard/shared/starboard/media/media_util.cc index e0541d47dc08..64821a13fd71 100644 --- a/starboard/shared/starboard/media/media_util.cc +++ b/starboard/shared/starboard/media/media_util.cc @@ -470,91 +470,3 @@ int64_t AudioFramesToDuration(int frames, int samples_per_second) { } // namespace starboard } // namespace shared } // namespace starboard - -bool operator==(const SbMediaColorMetadata& metadata_1, - const SbMediaColorMetadata& metadata_2) { - return memcmp(&metadata_1, &metadata_2, sizeof(SbMediaColorMetadata)) == 0; -} - -bool operator==(const SbMediaVideoSampleInfo& sample_info_1, - const SbMediaVideoSampleInfo& sample_info_2) { -#if SB_API_VERSION >= 15 - const SbMediaVideoStreamInfo& stream_info_1 = sample_info_1.stream_info; - const SbMediaVideoStreamInfo& stream_info_2 = sample_info_2.stream_info; -#else // SB_API_VERSION >= 15 - const SbMediaVideoStreamInfo& stream_info_1 = sample_info_1; - const SbMediaVideoStreamInfo& stream_info_2 = sample_info_2; -#endif // SB_API_VERSION >= 15 - - if (stream_info_1.codec != stream_info_2.codec) { - return false; - } - if (stream_info_1.codec == kSbMediaVideoCodecNone) { - return true; - } - - if (strcmp(stream_info_1.mime, stream_info_2.mime) != 0) { - return false; - } - if (strcmp(stream_info_1.max_video_capabilities, - stream_info_2.max_video_capabilities) != 0) { - return false; - } - - if (sample_info_1.is_key_frame != sample_info_2.is_key_frame) { - return false; - } - if (stream_info_1.frame_width != stream_info_2.frame_width) { - return false; - } - if (stream_info_1.frame_height != stream_info_2.frame_height) { - return false; - } - return stream_info_1.color_metadata == stream_info_2.color_metadata; -} - -#if SB_API_VERSION >= 15 - -bool operator==(const SbMediaVideoStreamInfo& stream_info_1, - const SbMediaVideoStreamInfo& stream_info_2) { - if (stream_info_1.codec != stream_info_2.codec) { - return false; - } - if (stream_info_1.codec == kSbMediaVideoCodecNone) { - return true; - } - - if (strcmp(stream_info_1.mime, stream_info_2.mime) != 0) { - return false; - } - if (strcmp(stream_info_1.max_video_capabilities, - stream_info_2.max_video_capabilities) != 0) { - return false; - } - if (stream_info_1.frame_width != stream_info_2.frame_width) { - return false; - } - if (stream_info_1.frame_height != stream_info_2.frame_height) { - return false; - } - return stream_info_1.color_metadata == stream_info_2.color_metadata; -} - -#endif // SB_API_VERSION >= 15 - -bool operator!=(const SbMediaColorMetadata& metadata_1, - const SbMediaColorMetadata& metadata_2) { - return !(metadata_1 == metadata_2); -} - -bool operator!=(const SbMediaVideoSampleInfo& sample_info_1, - const SbMediaVideoSampleInfo& sample_info_2) { - return !(sample_info_1 == sample_info_2); -} - -#if SB_API_VERSION >= 15 -bool operator!=(const SbMediaVideoStreamInfo& stream_info_1, - const SbMediaVideoStreamInfo& stream_info_2) { - return !(stream_info_1 == stream_info_2); -} -#endif // SB_API_VERSION >= 15 diff --git a/starboard/shared/starboard/media/media_util.h b/starboard/shared/starboard/media/media_util.h index 030a53fd084c..20700edc67b8 100644 --- a/starboard/shared/starboard/media/media_util.h +++ b/starboard/shared/starboard/media/media_util.h @@ -15,6 +15,8 @@ #ifndef STARBOARD_SHARED_STARBOARD_MEDIA_MEDIA_UTIL_H_ #define STARBOARD_SHARED_STARBOARD_MEDIA_MEDIA_UTIL_H_ +#include + #include #include #include @@ -173,24 +175,90 @@ int64_t AudioFramesToDuration(int frames, int samples_per_second); } // namespace shared } // namespace starboard -bool operator==(const SbMediaColorMetadata& metadata_1, - const SbMediaColorMetadata& metadata_2); -bool operator==(const SbMediaVideoSampleInfo& sample_info_1, - const SbMediaVideoSampleInfo& sample_info_2); +inline bool operator==(const SbMediaColorMetadata& metadata_1, + const SbMediaColorMetadata& metadata_2) { + return memcmp(&metadata_1, &metadata_2, sizeof(SbMediaColorMetadata)) == 0; +} + +inline bool operator==(const SbMediaVideoSampleInfo& sample_info_1, + const SbMediaVideoSampleInfo& sample_info_2) { +#if SB_API_VERSION >= 15 + const SbMediaVideoStreamInfo& stream_info_1 = sample_info_1.stream_info; + const SbMediaVideoStreamInfo& stream_info_2 = sample_info_2.stream_info; +#else // SB_API_VERSION >= 15 + const SbMediaVideoStreamInfo& stream_info_1 = sample_info_1; + const SbMediaVideoStreamInfo& stream_info_2 = sample_info_2; +#endif // SB_API_VERSION >= 15 + + if (stream_info_1.codec != stream_info_2.codec) { + return false; + } + if (stream_info_1.codec == kSbMediaVideoCodecNone) { + return true; + } + + if (strcmp(stream_info_1.mime, stream_info_2.mime) != 0) { + return false; + } + if (strcmp(stream_info_1.max_video_capabilities, + stream_info_2.max_video_capabilities) != 0) { + return false; + } + + if (sample_info_1.is_key_frame != sample_info_2.is_key_frame) { + return false; + } + if (stream_info_1.frame_width != stream_info_2.frame_width) { + return false; + } + if (stream_info_1.frame_height != stream_info_2.frame_height) { + return false; + } + return stream_info_1.color_metadata == stream_info_2.color_metadata; +} #if SB_API_VERSION >= 15 -bool operator==(const SbMediaVideoStreamInfo& stream_info_1, - const SbMediaVideoStreamInfo& stream_info_2); +inline bool operator==(const SbMediaVideoStreamInfo& stream_info_1, + const SbMediaVideoStreamInfo& stream_info_2) { + if (stream_info_1.codec != stream_info_2.codec) { + return false; + } + if (stream_info_1.codec == kSbMediaVideoCodecNone) { + return true; + } + + if (strcmp(stream_info_1.mime, stream_info_2.mime) != 0) { + return false; + } + if (strcmp(stream_info_1.max_video_capabilities, + stream_info_2.max_video_capabilities) != 0) { + return false; + } + if (stream_info_1.frame_width != stream_info_2.frame_width) { + return false; + } + if (stream_info_1.frame_height != stream_info_2.frame_height) { + return false; + } + return stream_info_1.color_metadata == stream_info_2.color_metadata; +} #endif // SB_API_VERSION >= 15 -bool operator!=(const SbMediaColorMetadata& metadata_1, - const SbMediaColorMetadata& metadata_2); -bool operator!=(const SbMediaVideoSampleInfo& sample_info_1, - const SbMediaVideoSampleInfo& sample_info_2); +inline bool operator!=(const SbMediaColorMetadata& metadata_1, + const SbMediaColorMetadata& metadata_2) { + return !(metadata_1 == metadata_2); +} + +inline bool operator!=(const SbMediaVideoSampleInfo& sample_info_1, + const SbMediaVideoSampleInfo& sample_info_2) { + return !(sample_info_1 == sample_info_2); +} #if SB_API_VERSION >= 15 -bool operator!=(const SbMediaVideoStreamInfo& stream_info_1, - const SbMediaVideoStreamInfo& stream_info_2); +inline bool operator!=(const SbMediaVideoStreamInfo& stream_info_1, + const SbMediaVideoStreamInfo& stream_info_2) { + return !(stream_info_1 == stream_info_2); +} #endif // SB_API_VERSION >= 15 #endif // STARBOARD_SHARED_STARBOARD_MEDIA_MEDIA_UTIL_H_ diff --git a/starboard/shared/starboard/player/player_create.cc b/starboard/shared/starboard/player/player_create.cc index 291854b22581..cb7240edfc99 100644 --- a/starboard/shared/starboard/player/player_create.cc +++ b/starboard/shared/starboard/player/player_create.cc @@ -38,6 +38,7 @@ using ::starboard::shared::media_session:: UpdateActiveSessionPlatformPlaybackState; using ::starboard::shared::starboard::media::MimeType; using ::starboard::shared::starboard::player::PlayerWorker; +using ::starboard::shared::starboard::player::SbPlayerPrivateImpl; using ::starboard::shared::starboard::player::filter:: FilterBasedPlayerWorkerHandler; @@ -215,7 +216,7 @@ SbPlayer SbPlayerCreate(SbWindow window, std::unique_ptr handler( new FilterBasedPlayerWorkerHandler(creation_param, provider)); - SbPlayer player = SbPlayerPrivate::CreateInstance( + SbPlayer player = SbPlayerPrivateImpl::CreateInstance( audio_codec, video_codec, sample_deallocate_func, decoder_status_func, player_status_func, player_error_func, context, std::move(handler)); diff --git a/starboard/shared/starboard/player/player_internal.cc b/starboard/shared/starboard/player/player_internal.cc index 225d4a8d96ae..22ff1cce3326 100644 --- a/starboard/shared/starboard/player/player_internal.cc +++ b/starboard/shared/starboard/player/player_internal.cc @@ -26,6 +26,7 @@ #include SB_PLAYER_DMP_WRITER_INCLUDE_PATH #endif // SB_PLAYER_ENABLE_VIDEO_DUMPER +namespace starboard::shared::starboard::player { namespace { using std::placeholders::_1; @@ -36,15 +37,15 @@ using std::placeholders::_4; int64_t CalculateMediaTime(int64_t media_time, int64_t media_time_update_time, double playback_rate) { - int64_t elapsed = starboard::CurrentMonotonicTime() - media_time_update_time; + int64_t elapsed = CurrentMonotonicTime() - media_time_update_time; return media_time + static_cast(elapsed * playback_rate); } } // namespace -int SbPlayerPrivate::number_of_players_ = 0; +int SbPlayerPrivateImpl::number_of_players_ = 0; -SbPlayerPrivate::SbPlayerPrivate( +SbPlayerPrivateImpl::SbPlayerPrivateImpl( SbMediaAudioCodec audio_codec, SbMediaVideoCodec video_codec, SbPlayerDeallocateSampleFunc sample_deallocate_func, @@ -55,20 +56,20 @@ SbPlayerPrivate::SbPlayerPrivate( std::unique_ptr player_worker_handler) : sample_deallocate_func_(sample_deallocate_func), context_(context), - media_time_updated_at_(starboard::CurrentMonotonicTime()) { + media_time_updated_at_(CurrentMonotonicTime()) { worker_ = std::unique_ptr(PlayerWorker::CreateInstance( audio_codec, video_codec, std::move(player_worker_handler), - std::bind(&SbPlayerPrivate::UpdateMediaInfo, this, _1, _2, _3, _4), + std::bind(&SbPlayerPrivateImpl::UpdateMediaInfo, this, _1, _2, _3, _4), decoder_status_func, player_status_func, player_error_func, this, context)); ++number_of_players_; - SB_DLOG(INFO) << "Creating SbPlayerPrivate. There are " << number_of_players_ - << " players."; + SB_DLOG(INFO) << "Creating SbPlayerPrivateImpl. There are " + << number_of_players_ << " players."; } // static -SbPlayerPrivate* SbPlayerPrivate::CreateInstance( +SbPlayerPrivate* SbPlayerPrivateImpl::CreateInstance( SbMediaAudioCodec audio_codec, SbMediaVideoCodec video_codec, SbPlayerDeallocateSampleFunc sample_deallocate_func, @@ -77,7 +78,7 @@ SbPlayerPrivate* SbPlayerPrivate::CreateInstance( SbPlayerErrorFunc player_error_func, void* context, std::unique_ptr player_worker_handler) { - SbPlayerPrivate* ret = new SbPlayerPrivate( + SbPlayerPrivateImpl* ret = new SbPlayerPrivateImpl( audio_codec, video_codec, sample_deallocate_func, decoder_status_func, player_status_func, player_error_func, context, std::move(player_worker_handler)); @@ -89,12 +90,12 @@ SbPlayerPrivate* SbPlayerPrivate::CreateInstance( return nullptr; } -void SbPlayerPrivate::Seek(int64_t seek_to_time, int ticket) { +void SbPlayerPrivateImpl::Seek(int64_t seek_to_time, int ticket) { { - starboard::ScopedLock lock(mutex_); + ScopedLock lock(mutex_); SB_DCHECK(ticket_ != ticket); media_time_ = seek_to_time; - media_time_updated_at_ = starboard::CurrentMonotonicTime(); + media_time_updated_at_ = CurrentMonotonicTime(); is_progressing_ = false; ticket_ = ticket; } @@ -102,28 +103,28 @@ void SbPlayerPrivate::Seek(int64_t seek_to_time, int ticket) { worker_->Seek(seek_to_time, ticket); } -void SbPlayerPrivate::WriteEndOfStream(SbMediaType stream_type) { +void SbPlayerPrivateImpl::WriteEndOfStream(SbMediaType stream_type) { worker_->WriteEndOfStream(stream_type); } -void SbPlayerPrivate::SetBounds(int z_index, - int x, - int y, - int width, - int height) { +void SbPlayerPrivateImpl::SetBounds(int z_index, + int x, + int y, + int width, + int height) { PlayerWorker::Bounds bounds = {z_index, x, y, width, height}; worker_->SetBounds(bounds); // TODO: Wait until a frame is rendered with the updated bounds. } #if SB_API_VERSION >= 15 -void SbPlayerPrivate::GetInfo(SbPlayerInfo* out_player_info) { +void SbPlayerPrivateImpl::GetInfo(SbPlayerInfo* out_player_info) { #else // SB_API_VERSION >= 15 -void SbPlayerPrivate::GetInfo(SbPlayerInfo2* out_player_info) { +void SbPlayerPrivateImpl::GetInfo(SbPlayerInfo2* out_player_info) { #endif // SB_API_VERSION >= 15 SB_DCHECK(out_player_info != NULL); - starboard::ScopedLock lock(mutex_); + ScopedLock lock(mutex_); out_player_info->duration = SB_PLAYER_NO_DURATION; if (is_paused_ || !is_progressing_) { out_player_info->current_media_timestamp = media_time_; @@ -142,49 +143,49 @@ void SbPlayerPrivate::GetInfo(SbPlayerInfo2* out_player_info) { out_player_info->playback_rate = playback_rate_; } -void SbPlayerPrivate::SetPause(bool pause) { +void SbPlayerPrivateImpl::SetPause(bool pause) { is_paused_ = pause; worker_->SetPause(pause); } -void SbPlayerPrivate::SetPlaybackRate(double playback_rate) { +void SbPlayerPrivateImpl::SetPlaybackRate(double playback_rate) { playback_rate_ = playback_rate; worker_->SetPlaybackRate(playback_rate); } -void SbPlayerPrivate::SetVolume(double volume) { +void SbPlayerPrivateImpl::SetVolume(double volume) { volume_ = volume; worker_->SetVolume(volume_); } -void SbPlayerPrivate::UpdateMediaInfo(int64_t media_time, - int dropped_video_frames, - int ticket, - bool is_progressing) { - starboard::ScopedLock lock(mutex_); +void SbPlayerPrivateImpl::UpdateMediaInfo(int64_t media_time, + int dropped_video_frames, + int ticket, + bool is_progressing) { + ScopedLock lock(mutex_); if (ticket_ != ticket) { return; } media_time_ = media_time; is_progressing_ = is_progressing; - media_time_updated_at_ = starboard::CurrentMonotonicTime(); + media_time_updated_at_ = CurrentMonotonicTime(); dropped_video_frames_ = dropped_video_frames; } -SbDecodeTarget SbPlayerPrivate::GetCurrentDecodeTarget() { +SbDecodeTarget SbPlayerPrivateImpl::GetCurrentDecodeTarget() { return worker_->GetCurrentDecodeTarget(); } -bool SbPlayerPrivate::GetAudioConfiguration( +bool SbPlayerPrivateImpl::GetAudioConfiguration( int index, SbMediaAudioConfiguration* out_audio_configuration) { SB_DCHECK(index >= 0); SB_DCHECK(out_audio_configuration); - starboard::ScopedLock lock(audio_configurations_mutex_); + ScopedLock lock(audio_configurations_mutex_); if (audio_configurations_.empty()) { #if !defined(COBALT_BUILD_TYPE_GOLD) - int64_t start = starboard::CurrentMonotonicTime(); + int64_t start = CurrentMonotonicTime(); #endif // !defined(COBALT_BUILD_TYPE_GOLD) for (int i = 0; i < 32; ++i) { SbMediaAudioConfiguration audio_configuration; @@ -206,14 +207,13 @@ bool SbPlayerPrivate::GetAudioConfiguration( } } #if !defined(COBALT_BUILD_TYPE_GOLD) - int64_t elapsed = starboard::CurrentMonotonicTime() - start; + int64_t elapsed = CurrentMonotonicTime() - start; SB_LOG(INFO) << "GetAudioConfiguration(): Updating audio configurations takes " << elapsed << " microseconds."; for (auto&& audio_configuration : audio_configurations_) { SB_LOG(INFO) << "Found audio configuration " - << starboard::GetMediaAudioConnectorName( - audio_configuration.connector) + << GetMediaAudioConnectorName(audio_configuration.connector) << ", channels " << audio_configuration.number_of_channels; } #endif // !defined(COBALT_BUILD_TYPE_GOLD) @@ -226,3 +226,5 @@ bool SbPlayerPrivate::GetAudioConfiguration( return false; } + +} // namespace starboard::shared::starboard::player diff --git a/starboard/shared/starboard/player/player_internal.h b/starboard/shared/starboard/player/player_internal.h index 05d64a11886a..69e4acf9c1e6 100644 --- a/starboard/shared/starboard/player/player_internal.h +++ b/starboard/shared/starboard/player/player_internal.h @@ -34,8 +34,39 @@ struct SbPlayerPrivate { public: - typedef starboard::shared::starboard::media::AudioSampleInfo AudioSampleInfo; - typedef starboard::shared::starboard::player::PlayerWorker PlayerWorker; + virtual ~SbPlayerPrivate() {} + + virtual void Seek(int64_t seek_to_time, int ticket) = 0; + virtual void WriteSamples(const SbPlayerSampleInfo* sample_infos, + int number_of_sample_infos) = 0; + virtual void WriteSamples( + const CobaltExtensionEnhancedAudioPlayerSampleInfo* sample_infos, + int number_of_sample_infos) = 0; + + virtual void WriteEndOfStream(SbMediaType stream_type) = 0; + virtual void SetBounds(int z_index, int x, int y, int width, int height) = 0; + +#if SB_API_VERSION >= 15 + virtual void GetInfo(SbPlayerInfo* out_player_info) = 0; +#else // SB_API_VERSION >= 15 + virtual void GetInfo(SbPlayerInfo2* out_player_info) = 0; +#endif // SB_API_VERSION >= 15 + virtual void SetPause(bool pause) = 0; + virtual void SetPlaybackRate(double playback_rate) = 0; + virtual void SetVolume(double volume) = 0; + + virtual SbDecodeTarget GetCurrentDecodeTarget() = 0; + virtual bool GetAudioConfiguration( + int index, + SbMediaAudioConfiguration* out_audio_configuration) = 0; +}; + +namespace starboard::shared::starboard::player { + +class SbPlayerPrivateImpl : public SbPlayerPrivate { + public: + typedef ::starboard::shared::starboard::media::AudioSampleInfo + AudioSampleInfo; static SbPlayerPrivate* CreateInstance( SbMediaAudioCodec audio_codec, @@ -47,45 +78,56 @@ struct SbPlayerPrivate { void* context, std::unique_ptr player_worker_handler); - void Seek(int64_t seek_to_time, int ticket); - template - void WriteSamples(const PlayerSampleInfo* sample_infos, - int number_of_sample_infos); - void WriteEndOfStream(SbMediaType stream_type); - void SetBounds(int z_index, int x, int y, int width, int height); + void Seek(int64_t seek_to_time, int ticket) override; + void WriteSamples( + const CobaltExtensionEnhancedAudioPlayerSampleInfo* sample_infos, + int number_of_sample_infos) override { + return WriteSamplesInternal(sample_infos, number_of_sample_infos); + } + void WriteSamples(const SbPlayerSampleInfo* sample_infos, + int number_of_sample_infos) override { + return WriteSamplesInternal(sample_infos, number_of_sample_infos); + } + void WriteEndOfStream(SbMediaType stream_type) override; + void SetBounds(int z_index, int x, int y, int width, int height) override; #if SB_API_VERSION >= 15 - void GetInfo(SbPlayerInfo* out_player_info); + void GetInfo(SbPlayerInfo* out_player_info) override; #else // SB_API_VERSION >= 15 - void GetInfo(SbPlayerInfo2* out_player_info); + void GetInfo(SbPlayerInfo2* out_player_info) override; #endif // SB_API_VERSION >= 15 - void SetPause(bool pause); - void SetPlaybackRate(double playback_rate); - void SetVolume(double volume); + void SetPause(bool pause) override; + void SetPlaybackRate(double playback_rate) override; + void SetVolume(double volume) override; - SbDecodeTarget GetCurrentDecodeTarget(); + SbDecodeTarget GetCurrentDecodeTarget() override; bool GetAudioConfiguration( int index, - SbMediaAudioConfiguration* out_audio_configuration); + SbMediaAudioConfiguration* out_audio_configuration) override; - ~SbPlayerPrivate() { + ~SbPlayerPrivateImpl() override { --number_of_players_; SB_DLOG(INFO) << "Destroying SbPlayerPrivate. There are " << number_of_players_ << " players."; } private: - SbPlayerPrivate(SbMediaAudioCodec audio_codec, - SbMediaVideoCodec video_codec, - SbPlayerDeallocateSampleFunc sample_deallocate_func, - SbPlayerDecoderStatusFunc decoder_status_func, - SbPlayerStatusFunc player_status_func, - SbPlayerErrorFunc player_error_func, - void* context, - std::unique_ptr player_worker_handler); - - SbPlayerPrivate(const SbPlayerPrivate&) = delete; - SbPlayerPrivate& operator=(const SbPlayerPrivate&) = delete; + SbPlayerPrivateImpl( + SbMediaAudioCodec audio_codec, + SbMediaVideoCodec video_codec, + SbPlayerDeallocateSampleFunc sample_deallocate_func, + SbPlayerDecoderStatusFunc decoder_status_func, + SbPlayerStatusFunc player_status_func, + SbPlayerErrorFunc player_error_func, + void* context, + std::unique_ptr player_worker_handler); + + SbPlayerPrivateImpl(const SbPlayerPrivateImpl&) = delete; + SbPlayerPrivateImpl& operator=(const SbPlayerPrivateImpl&) = delete; + + template + void WriteSamplesInternal(const PlayerSampleInfo* sample_infos, + int number_of_sample_infos); void UpdateMediaInfo(int64_t media_time, int dropped_video_frames, @@ -95,7 +137,7 @@ struct SbPlayerPrivate { SbPlayerDeallocateSampleFunc sample_deallocate_func_; void* context_; - starboard::Mutex mutex_; + Mutex mutex_; int ticket_ = SB_PLAYER_INITIAL_TICKET; int64_t media_time_ = 0; // microseconds int64_t media_time_updated_at_; // microseconds @@ -112,18 +154,15 @@ struct SbPlayerPrivate { std::unique_ptr worker_; - starboard::Mutex audio_configurations_mutex_; + Mutex audio_configurations_mutex_; std::vector audio_configurations_; static int number_of_players_; }; template -void SbPlayerPrivate::WriteSamples(const SampleInfo* sample_infos, - int number_of_sample_infos) { - using starboard::shared::starboard::player::InputBuffer; - using starboard::shared::starboard::player::InputBuffers; - +void SbPlayerPrivateImpl::WriteSamplesInternal(const SampleInfo* sample_infos, + int number_of_sample_infos) { SB_DCHECK(sample_infos); SB_DCHECK(number_of_sample_infos > 0); @@ -133,7 +172,7 @@ void SbPlayerPrivate::WriteSamples(const SampleInfo* sample_infos, input_buffers.push_back(new InputBuffer(sample_deallocate_func_, this, context_, sample_infos[i])); #if SB_PLAYER_ENABLE_VIDEO_DUMPER - using ::starboard::shared::starboard::player::video_dmp::VideoDmpWriter; + using video_dmp::VideoDmpWriter; VideoDmpWriter::OnPlayerWriteSample(this, input_buffers.back()); #endif // SB_PLAYER_ENABLE_VIDEO_DUMPER } @@ -148,4 +187,6 @@ void SbPlayerPrivate::WriteSamples(const SampleInfo* sample_infos, worker_->WriteSamples(std::move(input_buffers)); } +} // namespace starboard::shared::starboard::player + #endif // STARBOARD_SHARED_STARBOARD_PLAYER_PLAYER_INTERNAL_H_