Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add switch to disable progressive support #4564

Merged
merged 4 commits into from
Dec 18, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add h5vcc switch
osagie98 committed Dec 12, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 789eeac3ca52b38ec794c18a61977022dbb137df
7 changes: 6 additions & 1 deletion cobalt/media/media_module.cc
Original file line number Diff line number Diff line change
@@ -254,6 +254,11 @@ bool MediaModule::SetConfiguration(const std::string& name, int32 value) {
return true;
}
}
} else if (name == "DisableProgressivePlayback") {
disable_progressive_playback_ = value;
LOG(INFO) << "Progressive playback is " << (value ? "disabled" : "enabled")
<< ".";
return true;
}

return false;
@@ -275,7 +280,7 @@ std::unique_ptr<WebMediaPlayer> MediaModule::CreateWebMediaPlayer(
#if SB_API_VERSION >= 15
audio_write_duration_local_, audio_write_duration_remote_,
#endif // SB_API_VERSION >= 15
&media_log_));
disable_progressive_playback_, &media_log_));
}

void MediaModule::Suspend() {
2 changes: 2 additions & 0 deletions cobalt/media/media_module.h
Original file line number Diff line number Diff line change
@@ -141,6 +141,8 @@ class MediaModule : public WebMediaPlayerFactory,
#endif // SB_API_VERSION >= 15

DecoderBufferAllocator decoder_buffer_allocator_;

bool disable_progressive_playback_ = false;
};

} // namespace media
14 changes: 9 additions & 5 deletions cobalt/media/player/web_media_player_impl.cc
Original file line number Diff line number Diff line change
@@ -117,7 +117,7 @@ WebMediaPlayerImpl::WebMediaPlayerImpl(
base::TimeDelta audio_write_duration_local,
base::TimeDelta audio_write_duration_remote,
#endif // SB_API_VERSION >= 15
::media::MediaLog* const media_log)
bool disable_progressive_playback, ::media::MediaLog* const media_log)
: pipeline_thread_("media_pipeline"),
network_state_(WebMediaPlayer::kNetworkStateEmpty),
ready_state_(WebMediaPlayer::kReadyStateHaveNothing),
@@ -128,6 +128,7 @@ WebMediaPlayerImpl::WebMediaPlayerImpl(
max_audio_samples_per_write_(max_audio_samples_per_write),
force_punch_out_by_default_(force_punch_out_by_default),
proxy_(new WebMediaPlayerProxy(task_runner_, this)),
disable_progressive_playback_(disable_progressive_playback),
media_log_(media_log),
is_local_source_(false),
suppress_destruction_errors_(false),
@@ -274,10 +275,13 @@ void WebMediaPlayerImpl::LoadProgressive(
UMA_HISTOGRAM_ENUMERATION("Media.URLScheme", URLScheme(url), kMaxURLScheme);
auto command_line =
starboard::shared::starboard::Application::Get()->GetCommandLine();
if (command_line->HasSwitch("disable_progressive_playback")) {
LOG(INFO) << "Disabled progressive playback support from command line";
SetNetworkError(WebMediaPlayer::kNetworkStateFormatError,
"Disabled progressive playback support from command line");
if (disable_progressive_playback_ ||
command_line->HasSwitch("disable_progressive_playback")) {
LOG(INFO)
<< "Disabled progressive playback support via command line or H5vcc";
SetNetworkError(
WebMediaPlayer::kNetworkStateFormatError,
"Disabled progressive playback support via command line or H5vcc");
return;
}

3 changes: 3 additions & 0 deletions cobalt/media/player/web_media_player_impl.h
Original file line number Diff line number Diff line change
@@ -116,6 +116,7 @@ class WebMediaPlayerImpl : public WebMediaPlayer,
base::TimeDelta audio_write_duration_local,
base::TimeDelta audio_write_duration_remote,
#endif // SB_API_VERSION >= 15
bool disable_progressive_playback,
::media::MediaLog* const media_log);
~WebMediaPlayerImpl() override;

@@ -329,6 +330,8 @@ class WebMediaPlayerImpl : public WebMediaPlayer,

bool is_resuming_from_background_mode_ = false;

const bool disable_progressive_playback_;

DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl);
};