Skip to content

Commit

Permalink
[android] Filter SbPlayerWriteSampleTest.PartialAudio on audio passth…
Browse files Browse the repository at this point in the history
…rough (#3090)

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

b/336339832
  • Loading branch information
borongc committed May 4, 2024
1 parent a78ed10 commit b30ba78
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 b30ba78

Please sign in to comment.