Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Unified Diff: chromecast/browser/cast_browser_main_parts.cc

Issue 2811293003: [Chromecast] Initialize media_resource_tracker with media_thread. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/browser/cast_browser_main_parts.cc
diff --git a/chromecast/browser/cast_browser_main_parts.cc b/chromecast/browser/cast_browser_main_parts.cc
index b33af2709677eb43d8459d7ebf2962d3237891d0..ccb0fa874aa8c87c1a354ff3640c59041160c6de 100644
--- a/chromecast/browser/cast_browser_main_parts.cc
+++ b/chromecast/browser/cast_browser_main_parts.cc
@@ -317,6 +317,12 @@ CastBrowserMainParts::GetMediaTaskRunner() {
base::Thread::Options options;
options.priority = base::ThreadPriority::REALTIME_AUDIO;
CHECK(media_thread_->StartWithOptions(options));
+ // Start the media_resource_tracker as soon as the media thread is created.
+ // There are services that run on the media thread that depend on it,
+ // and we want to initialize it with the correct task runner before any
+ // tasks that might use it are posted to the media thread.
+ media_resource_tracker_ = new media::MediaResourceTracker(
+ base::ThreadTaskRunnerHandle::Get(), media_thread_->task_runner());
}
return media_thread_->task_runner();
#else
@@ -326,10 +332,7 @@ CastBrowserMainParts::GetMediaTaskRunner() {
#if BUILDFLAG(IS_CAST_USING_CMA_BACKEND)
media::MediaResourceTracker* CastBrowserMainParts::media_resource_tracker() {
- if (!media_resource_tracker_) {
- media_resource_tracker_ = new media::MediaResourceTracker(
- base::ThreadTaskRunnerHandle::Get(), GetMediaTaskRunner());
- }
+ DCHECK(media_thread_);
return media_resource_tracker_;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698