Skip to content

Commit

Permalink
Cherry pick PR #3090: [android] Filter SbPlayerWriteSampleTest.Partia…
Browse files Browse the repository at this point in the history
…lAudio on audio passthrough (#3165)

Refer to the original PR: #3090

Filter ac3/eac3 audio files as audio passthrough doesn't support partial
audio.

b/336339832

Co-authored-by: Bo-Rong Chen <[email protected]>
  • Loading branch information
cobalt-github-releaser-bot and borongc authored May 4, 2024
1 parent 0c15b27 commit 6282cc1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions starboard/nplb/player_test_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -408,5 +408,17 @@ bool IsPartialAudioSupported() {
#endif // SB_API_VERSION >= 15
}

bool IsAudioPassthroughUsed(const SbPlayerTestConfig& config) {
const char* audio_dmp_filename = config.audio_filename;
SbMediaAudioCodec audio_codec = kSbMediaAudioCodecNone;
if (audio_dmp_filename && strlen(audio_dmp_filename) > 0) {
VideoDmpReader audio_dmp_reader(audio_dmp_filename,
VideoDmpReader::kEnableReadOnDemand);
audio_codec = audio_dmp_reader.audio_codec();
}
return audio_codec == kSbMediaAudioCodecAc3 ||
audio_codec == kSbMediaAudioCodecEac3;
}

} // namespace nplb
} // namespace starboard
2 changes: 2 additions & 0 deletions starboard/nplb/player_test_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ bool IsOutputModeSupported(SbPlayerOutputMode output_mode,

bool IsPartialAudioSupported();

bool IsAudioPassthroughUsed(const SbPlayerTestConfig& config);

} // namespace nplb
} // namespace starboard

Expand Down
10 changes: 10 additions & 0 deletions starboard/nplb/player_write_sample_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ TEST_P(SbPlayerWriteSampleTest, PartialAudio) {
<< "The platform doesn't support partial audio. Skip the tests.";
return;
}
if (IsAudioPassthroughUsed(GetParam())) {
SB_LOG(INFO) << "The audio passthrough doesn't support partial audio. Skip "
"the tests.";
return;
}

SbPlayerTestFixture player_fixture(GetParam(),
&fake_graphics_context_provider_);
Expand Down Expand Up @@ -237,6 +242,11 @@ TEST_P(SbPlayerWriteSampleTest, DiscardAllAudio) {
<< "The platform doesn't support partial audio. Skip the tests.";
return;
}
if (IsAudioPassthroughUsed(GetParam())) {
SB_LOG(INFO) << "The audio passthrough doesn't support partial audio. Skip "
"the tests.";
return;
}

SbPlayerTestFixture player_fixture(GetParam(),
&fake_graphics_context_provider_);
Expand Down

0 comments on commit 6282cc1

Please sign in to comment.