Skip to content

Commit

Permalink
Remove refs to SbPlayerSeek2, SbPlayerGetInfo2, SbPlayerWriteSample2 …
Browse files Browse the repository at this point in the history
…(#3899)

b/355449840
  • Loading branch information
madhurajayaraman committed Aug 8, 2024
1 parent f8e4ec7 commit 2b99b15
Show file tree
Hide file tree
Showing 24 changed files with 2 additions and 386 deletions.
16 changes: 0 additions & 16 deletions cobalt/media/base/sbplayer_bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -526,11 +526,7 @@ void SbPlayerBridge::GetVideoResolution(int* frame_width, int* frame_height) {

DCHECK(SbPlayerIsValid(player_));

#if SB_API_VERSION >= 15
SbPlayerInfo out_player_info;
#else // SB_API_VERSION >= 15
SbPlayerInfo2 out_player_info;
#endif // SB_API_VERSION >= 15
sbplayer_interface_->GetInfo(player_, &out_player_info);

video_stream_info_.frame_width = out_player_info.frame_width;
Expand All @@ -549,11 +545,7 @@ TimeDelta SbPlayerBridge::GetDuration() {

DCHECK(SbPlayerIsValid(player_));

#if SB_API_VERSION >= 15
SbPlayerInfo info;
#else // SB_API_VERSION >= 15
SbPlayerInfo2 info;
#endif // SB_API_VERSION >= 15
sbplayer_interface_->GetInfo(player_, &info);
if (info.duration == SB_PLAYER_NO_DURATION) {
// URL-based player may not have loaded asset yet, so map no duration to 0.
Expand All @@ -571,11 +563,7 @@ TimeDelta SbPlayerBridge::GetStartDate() {

DCHECK(SbPlayerIsValid(player_));

#if SB_API_VERSION >= 15
SbPlayerInfo info;
#else // SB_API_VERSION >= 15
SbPlayerInfo2 info;
#endif // SB_API_VERSION >= 15
sbplayer_interface_->GetInfo(player_, &info);
return TimeDelta::FromMicroseconds(info.start_date);
}
Expand Down Expand Up @@ -989,11 +977,7 @@ void SbPlayerBridge::GetInfo_Locked(uint32* video_frames_decoded,

DCHECK(SbPlayerIsValid(player_));

#if SB_API_VERSION >= 15
SbPlayerInfo info;
#else // SB_API_VERSION >= 15
SbPlayerInfo2 info;
#endif // SB_API_VERSION >= 15
sbplayer_interface_->GetInfo(player_, &info);

if (media_time) {
Expand Down
14 changes: 0 additions & 14 deletions cobalt/media/base/sbplayer_interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,7 @@ void DefaultSbPlayerInterface::Destroy(SbPlayer player) {
void DefaultSbPlayerInterface::Seek(SbPlayer player,
base::TimeDelta seek_to_timestamp,
int ticket) {
#if SB_API_VERSION >= 15
SbPlayerSeek(player, seek_to_timestamp.InMicroseconds(), ticket);
#else // SB_API_VERSION >= 15
SbPlayerSeek2(player, seek_to_timestamp.InMicroseconds(), ticket);
#endif // SB_API_VERSION >= 15
}

bool DefaultSbPlayerInterface::IsEnhancedAudioExtensionEnabled() const {
Expand All @@ -106,13 +102,8 @@ void DefaultSbPlayerInterface::WriteSamples(
SbPlayer player, SbMediaType sample_type,
const SbPlayerSampleInfo* sample_infos, int number_of_sample_infos) {
DCHECK(!IsEnhancedAudioExtensionEnabled());
#if SB_API_VERSION >= 15
SbPlayerWriteSamples(player, sample_type, sample_infos,
number_of_sample_infos);
#else // SB_API_VERSION >= 15
SbPlayerWriteSample2(player, sample_type, sample_infos,
number_of_sample_infos);
#endif // SB_API_VERSION >= 15
}

void DefaultSbPlayerInterface::WriteSamples(
Expand Down Expand Up @@ -149,13 +140,8 @@ void DefaultSbPlayerInterface::SetVolume(SbPlayer player, double volume) {
}

void DefaultSbPlayerInterface::GetInfo(SbPlayer player,
#if SB_API_VERSION >= 15
SbPlayerInfo* out_player_info) {
SbPlayerGetInfo(player, out_player_info);
#else // SB_API_VERSION >= 15
SbPlayerInfo2* out_player_info2) {
SbPlayerGetInfo2(player, out_player_info2);
#endif // SB_API_VERSION >= 15
}

SbDecodeTarget DefaultSbPlayerInterface::GetCurrentFrame(SbPlayer player) {
Expand Down
8 changes: 0 additions & 8 deletions cobalt/media/base/sbplayer_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,7 @@ class SbPlayerInterface {
virtual bool SetPlaybackRate(SbPlayer player, double playback_rate) = 0;
virtual void SetVolume(SbPlayer player, double volume) = 0;

#if SB_API_VERSION >= 15
virtual void GetInfo(SbPlayer player, SbPlayerInfo* out_player_info) = 0;
#else // SB_API_VERSION >= 15
virtual void GetInfo(SbPlayer player, SbPlayerInfo2* out_player_info2) = 0;
#endif // SB_API_VERSION >= 15
virtual SbDecodeTarget GetCurrentFrame(SbPlayer player) = 0;

#if SB_HAS(PLAYER_WITH_URL)
Expand Down Expand Up @@ -129,11 +125,7 @@ class DefaultSbPlayerInterface final : public SbPlayerInterface {
int height) override;
bool SetPlaybackRate(SbPlayer player, double playback_rate) override;
void SetVolume(SbPlayer player, double volume) override;
#if SB_API_VERSION >= 15
void GetInfo(SbPlayer player, SbPlayerInfo* out_player_info) override;
#else // SB_API_VERSION >= 15
void GetInfo(SbPlayer player, SbPlayerInfo2* out_player_info2) override;
#endif // SB_API_VERSION >= 15
SbDecodeTarget GetCurrentFrame(SbPlayer player) override;

#if SB_HAS(PLAYER_WITH_URL)
Expand Down
14 changes: 0 additions & 14 deletions starboard/elf_loader/exported_symbols.cc
Original file line number Diff line number Diff line change
Expand Up @@ -261,31 +261,17 @@ ExportedSymbols::ExportedSymbols() {
#endif // SB_API_VERSION < 16
REGISTER_SYMBOL(SbPlayerCreate);
REGISTER_SYMBOL(SbPlayerDestroy);
#if SB_API_VERSION >= 15
REGISTER_SYMBOL(SbPlayerGetAudioConfiguration);
#endif // SB_API_VERSION >= 15
REGISTER_SYMBOL(SbPlayerGetCurrentFrame);
#if SB_API_VERSION >= 15
REGISTER_SYMBOL(SbPlayerGetInfo);
#else // SB_API_VERSION >= 15
REGISTER_SYMBOL(SbPlayerGetInfo2);
#endif // SB_API_VERSION >= 15
REGISTER_SYMBOL(SbPlayerGetMaximumNumberOfSamplesPerWrite);
REGISTER_SYMBOL(SbPlayerGetPreferredOutputMode);
#if SB_API_VERSION >= 15
REGISTER_SYMBOL(SbPlayerSeek);
#else // SB_API_VERSION >= 15
REGISTER_SYMBOL(SbPlayerSeek2);
#endif // SB_API_VERSION >= 15
REGISTER_SYMBOL(SbPlayerSetBounds);
REGISTER_SYMBOL(SbPlayerSetPlaybackRate);
REGISTER_SYMBOL(SbPlayerSetVolume);
REGISTER_SYMBOL(SbPlayerWriteEndOfStream);
#if SB_API_VERSION >= 15
REGISTER_SYMBOL(SbPlayerWriteSamples);
#else // SB_API_VERSION >= 15
REGISTER_SYMBOL(SbPlayerWriteSample2);
#endif // SB_API_VERSION >= 15
REGISTER_SYMBOL(SbSocketAccept);
REGISTER_SYMBOL(SbSocketBind);
REGISTER_SYMBOL(SbSocketClearLastError);
Expand Down
1 change: 0 additions & 1 deletion starboard/linux/shared/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import("//starboard/shared/enhanced_audio/enhanced_audio.gni")
import("//starboard/shared/starboard/media/media_tests.gni")
import("//starboard/shared/starboard/player/buildfiles.gni")
import("//starboard/shared/starboard/player/player_tests.gni")
Expand Down
6 changes: 0 additions & 6 deletions starboard/linux/shared/system_get_extensions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include "starboard/linux/shared/ifa.h"
#include "starboard/linux/shared/platform_service.h"
#include "starboard/linux/shared/time_zone.h"
#include "starboard/shared/enhanced_audio/enhanced_audio.h"
#include "starboard/shared/ffmpeg/ffmpeg_demuxer.h"
#include "starboard/shared/posix/free_space.h"
#include "starboard/shared/posix/memory_mapped_file.h"
Expand Down Expand Up @@ -71,11 +70,6 @@ const void* SbSystemGetExtension(const char* name) {
if (strcmp(name, kCobaltExtensionFreeSpaceName) == 0) {
return starboard::shared::posix::GetFreeSpaceApi();
}
#if SB_API_VERSION < 15
if (strcmp(name, kCobaltExtensionEnhancedAudioName) == 0) {
return starboard::shared::enhanced_audio::GetEnhancedAudioApi();
}
#endif // SB_API_VERSION < 15
if (strcmp(name, kCobaltExtensionDemuxerApi) == 0) {
auto command_line =
starboard::shared::starboard::Application::Get()->GetCommandLine();
Expand Down
31 changes: 1 addition & 30 deletions starboard/nplb/media_set_audio_write_duration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,8 @@ class SbMediaSetAudioWriteDurationTest
}

// Check if we're about to input too far beyond the current playback time.
#if SB_API_VERSION >= 15
SbPlayerInfo info;
SbPlayerGetInfo(pending_decoder_status_->player, &info);
#else // SB_API_VERSION >= 15
SbPlayerInfo2 info;
SbPlayerGetInfo2(pending_decoder_status_->player, &info);
#endif // SB_API_VERSION >= 15
if ((last_input_timestamp_ - info.current_media_timestamp) > kDuration) {
// Postpone writing samples.
return;
Expand Down Expand Up @@ -190,30 +185,18 @@ TEST_P(SbMediaSetAudioWriteDurationTest, WriteLimitedInput) {
WaitForPlayerState(kSbPlayerStateInitialized);

// Seek to preroll.
#if SB_API_VERSION >= 15
SbPlayerSeek(player, first_input_timestamp_, /* ticket */ 1);
#else // SB_API_VERSION >= 15
SbPlayerSeek2(player, first_input_timestamp_, /* ticket */ 1);
#endif // SB_API_VERSION >= 15

WaitForPlayerState(kSbPlayerStatePresenting);

// Wait until the playback time is > 0.
const int64_t kMaxWaitTime = 5'000'000; // 5 seconds
int64_t start_of_wait = CurrentMonotonicTime();
#if SB_API_VERSION >= 15
SbPlayerInfo info = {};
#else // SB_API_VERSION >= 15
SbPlayerInfo2 info = {};
#endif // SB_API_VERSION >= 15
while (CurrentMonotonicTime() - start_of_wait < kMaxWaitTime &&
info.current_media_timestamp == 0) {
usleep(500'000);
#if SB_API_VERSION >= 15
SbPlayerGetInfo(player, &info);
#else // SB_API_VERSION >= 15
SbPlayerGetInfo2(player, &info);
#endif // SB_API_VERSION >= 15
}

EXPECT_GT(info.current_media_timestamp, 0);
Expand All @@ -232,32 +215,20 @@ TEST_P(SbMediaSetAudioWriteDurationTest, WriteContinuedLimitedInput) {
WaitForPlayerState(kSbPlayerStateInitialized);

// Seek to preroll.
#if SB_API_VERSION >= 15
SbPlayerSeek(player, first_input_timestamp_, /* ticket */ 1);
#else // SB_API_VERSION >= 15
SbPlayerSeek2(player, first_input_timestamp_, /* ticket */ 1);
#endif // SB_API_VERSION >= 15
WaitForPlayerState(kSbPlayerStatePresenting);

// Wait for the player to play far enough. It may not play all the way to
// the end, but it should leave off no more than |kDuration|.
int64_t min_ending_playback_time = total_duration_ - kDuration;
int64_t start_of_wait = CurrentMonotonicTime();
const int64_t kMaxWaitTime = total_duration_ + 5'000'000LL;
#if SB_API_VERSION >= 15
SbPlayerInfo info;
SbPlayerGetInfo(player, &info);
#else // SB_API_VERSION >= 15
SbPlayerInfo2 info;
SbPlayerGetInfo2(player, &info);
#endif // SB_API_VERSION >= 15

while (info.current_media_timestamp < min_ending_playback_time &&
(CurrentMonotonicTime() - start_of_wait) < kMaxWaitTime) {
#if SB_API_VERSION >= 15
SbPlayerGetInfo(player, &info);
#else // SB_API_VERSION >= 15
SbPlayerGetInfo2(player, &info);
#endif // SB_API_VERSION >= 15
usleep(kSmallWaitInterval);
TryToWritePendingSample();
}
Expand Down
9 changes: 0 additions & 9 deletions starboard/nplb/player_test_fixture.cc
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,7 @@ void SbPlayerTestFixture::Seek(const int64_t time) {
audio_end_of_stream_written_ = false;
video_end_of_stream_written_ = false;

#if SB_API_VERSION >= 15
SbPlayerSeek(player_, time, ++ticket_);
#else // SB_API_VERSION >= 15
SbPlayerSeek2(player_, time, ++ticket_);
#endif // SB_API_VERSION >= 15
}

void SbPlayerTestFixture::Write(const GroupedSamples& grouped_samples) {
Expand Down Expand Up @@ -349,13 +345,8 @@ void SbPlayerTestFixture::WaitForPlayerEndOfStream() {
}

int64_t SbPlayerTestFixture::GetCurrentMediaTime() const {
#if SB_API_VERSION >= 15
SbPlayerInfo info = {};
SbPlayerGetInfo(player_, &info);
#else // SB_API_VERSION >= 15
SbPlayerInfo2 info = {};
SbPlayerGetInfo2(player_, &info);
#endif // SB_API_VERSION >= 15
return info.current_media_timestamp;
}

Expand Down
5 changes: 0 additions & 5 deletions starboard/nplb/player_test_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,8 @@ void CallSbPlayerWriteSamples(
discarded_durations_from_back[i];
}
}
#if SB_API_VERSION >= 15
SbPlayerWriteSamples(player, sample_type, sample_infos.data(),
number_of_samples_to_write);
#else // SB_API_VERSION >= 15
SbPlayerWriteSample2(player, sample_type, sample_infos.data(),
number_of_samples_to_write);
#endif // SB_API_VERSION >= 15
}

bool IsOutputModeSupported(SbPlayerOutputMode output_mode,
Expand Down
23 changes: 0 additions & 23 deletions starboard/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,7 @@ typedef struct SbPlayerSampleInfo {
} SbPlayerSampleInfo;

// Information about the current media playback state.
#if SB_API_VERSION >= 15
typedef struct SbPlayerInfo {
#else // SB_API_VERSION >= 15
typedef struct SbPlayerInfo2 {
#endif // SB_API_VERSION >= 15
// The position of the playback head, as precisely as possible, in
// microseconds.
int64_t current_media_timestamp;
Expand Down Expand Up @@ -226,11 +222,7 @@ typedef struct SbPlayerInfo2 {
// is played in a slower than normal speed. Negative speeds are not
// supported.
double playback_rate;
#if SB_API_VERSION >= 15
} SbPlayerInfo;
#else // SB_API_VERSION >= 15
} SbPlayerInfo2;
#endif // SB_API_VERSION >= 15

// An opaque handle to an implementation-private structure representing a
// player.
Expand Down Expand Up @@ -474,15 +466,9 @@ SB_EXPORT void SbPlayerDestroy(SbPlayer player);
// when SbPlayerSeek was called. To be very specific, once SbPlayerSeek has
// been called with ticket X, a client should ignore all
// |SbPlayerDecoderStatusFunc| calls that do not pass in ticket X.
#if SB_API_VERSION >= 15
SB_EXPORT void SbPlayerSeek(SbPlayer player,
int64_t seek_to_timestamp,
int ticket);
#else // SB_API_VERSION >= 15
SB_EXPORT void SbPlayerSeek2(SbPlayer player,
int64_t seek_to_timestamp,
int ticket);
#endif // SB_API_VERSION >= 15

// Writes samples of the given media type to |player|'s input stream. The
// lifetime of |sample_infos|, and the members of its elements like |buffer|,
Expand Down Expand Up @@ -510,11 +496,7 @@ SB_EXPORT void SbPlayerSeek2(SbPlayer player,
// |number_of_sample_infos|: Specify the number of samples contained inside
// |sample_infos|. It has to be at least one, and at most the return value
// of SbPlayerGetMaximumNumberOfSamplesPerWrite().
#if SB_API_VERSION >= 15
SB_EXPORT void SbPlayerWriteSamples(SbPlayer player,
#else // SB_API_VERSION >= 15
SB_EXPORT void SbPlayerWriteSample2(SbPlayer player,
#endif // SB_API_VERSION >= 15
SbMediaType sample_type,
const SbPlayerSampleInfo* sample_infos,
int number_of_sample_infos);
Expand Down Expand Up @@ -610,12 +592,7 @@ SB_EXPORT void SbPlayerSetVolume(SbPlayer player, double volume);
// |kSbPlayerInvalid|.
//
// |out_player_info|: The information retrieved for the player.
#if SB_API_VERSION >= 15
SB_EXPORT void SbPlayerGetInfo(SbPlayer player, SbPlayerInfo* out_player_info);
#else // SB_API_VERSION >= 15
SB_EXPORT void SbPlayerGetInfo2(SbPlayer player,
SbPlayerInfo2* out_player_info2);
#endif // SB_API_VERSION >= 15

// Given a player created with the kSbPlayerOutputModeDecodeToTexture
// output mode, it will return a SbDecodeTarget representing the current frame
Expand Down
Loading

0 comments on commit 2b99b15

Please sign in to comment.