Skip to content

Commit

Permalink
Cherry pick PR #3584: [android] Fix failing WriteSingleBatch tests (#…
Browse files Browse the repository at this point in the history
…3590)

Refer to the original PR: #3584

This PR (#3325) changes
SbPlayerGetMaximumNumberOfSamplesPerWrite() to 256 on ATV as Cobalt
supports multiple samples per write to SbPlayer (b/227837774), but
current testing files for SbPlayerWriteSampleTest.WriteSingleBatch tests
are not long enough for the modification.

1. Set upper bounds for WriteSingleBatch tests (15 audio samples per
write, 60 video samples per write) when
SbPlayerGetMaximumNumberOfSamplesPerWrite() > 1.
2. We should revisit the upper bounds when the requirement is changed
(b/347728473).

b/347097484

Test-On-Device: true

Co-authored-by: Bo-Rong Chen <[email protected]>
  • Loading branch information
cobalt-github-releaser-bot and borongc authored Jun 18, 2024
1 parent f950afa commit 3f0a8ec
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
3 changes: 0 additions & 3 deletions starboard/android/shared/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@

# TODO: b/280432564 Make this test work on lab devices consistently.
'SbAudioSinkTest.ContinuousAppend',

## TODO: b/347097484 This test failed/crashed with SbPlayerGetMaximumNumberOfSamplesPerWrite() of 256.
'SbPlayerWriteSampleTests/SbPlayerWriteSampleTest.WriteSingleBatch/*',
],
}
# pylint: enable=line-too-long
Expand Down
19 changes: 15 additions & 4 deletions starboard/nplb/player_write_sample_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ TEST_P(SbPlayerWriteSampleTest, NoInput) {
}

TEST_P(SbPlayerWriteSampleTest, WriteSingleBatch) {
// TODO: b/347728473 When the platform supports multiple
// samples per write to SbPlayer, the following numbers are
// sufficient to allow SbPlayer to play 60fps video.
// Revisit the maximum numbers if the requirement is changed.
const int kMaxAudioSamplesPerWrite = 15;
const int kMaxVideoSamplesPerWrite = 60;

SbPlayerTestFixture player_fixture(GetParam(),
&fake_graphics_context_provider_);
if (HasFatalFailure()) {
Expand All @@ -73,14 +80,18 @@ TEST_P(SbPlayerWriteSampleTest, WriteSingleBatch) {

GroupedSamples samples;
if (player_fixture.HasAudio()) {
int samples_to_write = SbPlayerGetMaximumNumberOfSamplesPerWrite(
player_fixture.GetPlayer(), kSbMediaTypeAudio);
int samples_to_write =
std::min(SbPlayerGetMaximumNumberOfSamplesPerWrite(
player_fixture.GetPlayer(), kSbMediaTypeAudio),
kMaxAudioSamplesPerWrite);
samples.AddAudioSamples(0, samples_to_write);
samples.AddAudioEOS();
}
if (player_fixture.HasVideo()) {
int samples_to_write = SbPlayerGetMaximumNumberOfSamplesPerWrite(
player_fixture.GetPlayer(), kSbMediaTypeVideo);
int samples_to_write =
std::min(SbPlayerGetMaximumNumberOfSamplesPerWrite(
player_fixture.GetPlayer(), kSbMediaTypeVideo),
kMaxVideoSamplesPerWrite);
samples.AddVideoSamples(0, samples_to_write);
samples.AddVideoEOS();
}
Expand Down

0 comments on commit 3f0a8ec

Please sign in to comment.