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

Side by Side Diff: chromecast/browser/cast_content_browser_client.cc

Issue 2363303002: [WIP] Proxy RtcVideoDecoder calls to a media::VideoDecoder.
Patch Set: Now working with remote ffmpeg decoder Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromecast/browser/cast_content_browser_client.h" 5 #include "chromecast/browser/cast_content_browser_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 #include "components/crash/content/browser/crash_dump_manager_android.h" 70 #include "components/crash/content/browser/crash_dump_manager_android.h"
71 #else 71 #else
72 #include "chromecast/browser/media/cast_browser_cdm_factory.h" 72 #include "chromecast/browser/media/cast_browser_cdm_factory.h"
73 #endif // defined(OS_ANDROID) 73 #endif // defined(OS_ANDROID)
74 74
75 namespace chromecast { 75 namespace chromecast {
76 namespace shell { 76 namespace shell {
77 77
78 namespace { 78 namespace {
79 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) 79 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS)
80
81 static std::unique_ptr<media::CastMojoMediaClient> CreateCastMojoMediaClient(
82 CastContentBrowserClient* browser_client) {
83 return base::MakeUnique<media::CastMojoMediaClient>(
84 base::Bind(&CastContentBrowserClient::CreateMediaPipelineBackend,
85 base::Unretained(browser_client)),
86 base::Bind(&CastContentBrowserClient::CreateCdmFactory,
87 base::Unretained(browser_client)),
88 browser_client->GetVideoResolutionPolicy(),
89 browser_client->media_resource_tracker());
90 }
91
80 static std::unique_ptr<::shell::Service> CreateMojoMediaApplication( 92 static std::unique_ptr<::shell::Service> CreateMojoMediaApplication(
81 CastContentBrowserClient* browser_client, 93 CastContentBrowserClient* browser_client,
82 const base::Closure& quit_closure) { 94 const base::Closure& quit_closure) {
83 std::unique_ptr<media::CastMojoMediaClient> mojo_media_client( 95 return std::unique_ptr<::shell::Service>(new ::media::MojoMediaApplication(
84 new media::CastMojoMediaClient( 96 CreateCastMojoMediaClient(browser_client), quit_closure));
85 base::Bind(&CastContentBrowserClient::CreateMediaPipelineBackend, 97 }
86 base::Unretained(browser_client)), 98
87 base::Bind(&CastContentBrowserClient::CreateCdmFactory, 99 static void CreateVideoDecoder(::media::MojoMediaClient* mojo_media_client,
88 base::Unretained(browser_client)), 100 ::media::mojom::VideoDecoderRequest request) {
89 browser_client->GetVideoResolutionPolicy(), 101 DCHECK(mojo_media_client);
90 browser_client->media_resource_tracker())); 102 mojo::MakeStrongBinding<::media::mojom::VideoDecoder>(
91 return std::unique_ptr<::shell::Service>( 103 base::MakeUnique<::media::MojoVideoDecoderService>(mojo_media_client),
92 new ::media::MojoMediaApplication(std::move(mojo_media_client), 104 std::move(request));
93 quit_closure));
94 } 105 }
95 #endif // defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) 106 #endif // defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS)
96
97 } // namespace 107 } // namespace
98 108
99 CastContentBrowserClient::CastContentBrowserClient() 109 CastContentBrowserClient::CastContentBrowserClient()
100 : cast_browser_main_parts_(nullptr), 110 : cast_browser_main_parts_(nullptr),
101 url_request_context_factory_(new URLRequestContextFactory()) {} 111 url_request_context_factory_(new URLRequestContextFactory()),
112 cast_mojo_media_client_(CreateCastMojoMediaClient(this)) {}
102 113
103 CastContentBrowserClient::~CastContentBrowserClient() { 114 CastContentBrowserClient::~CastContentBrowserClient() {
104 content::BrowserThread::DeleteSoon( 115 content::BrowserThread::DeleteSoon(
105 content::BrowserThread::IO, 116 content::BrowserThread::IO,
106 FROM_HERE, 117 FROM_HERE,
107 url_request_context_factory_.release()); 118 url_request_context_factory_.release());
108 } 119 }
109 120
110 void CastContentBrowserClient::AppendExtraCommandLineSwitches( 121 void CastContentBrowserClient::AppendExtraCommandLineSwitches(
111 base::CommandLine* command_line) { 122 base::CommandLine* command_line) {
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 return false; 426 return false;
416 } 427 }
417 428
418 void CastContentBrowserClient::ExposeInterfacesToRenderer( 429 void CastContentBrowserClient::ExposeInterfacesToRenderer(
419 ::shell::InterfaceRegistry* registry, 430 ::shell::InterfaceRegistry* registry,
420 content::RenderProcessHost* render_process_host) { 431 content::RenderProcessHost* render_process_host) {
421 registry->AddInterface( 432 registry->AddInterface(
422 base::Bind(&media::MediaCapsImpl::AddBinding, 433 base::Bind(&media::MediaCapsImpl::AddBinding,
423 base::Unretained(cast_browser_main_parts_->media_caps())), 434 base::Unretained(cast_browser_main_parts_->media_caps())),
424 base::ThreadTaskRunnerHandle::Get()); 435 base::ThreadTaskRunnerHandle::Get());
436 registry->AddInterface()
425 } 437 }
426 438
427 void CastContentBrowserClient::RegisterInProcessMojoApplications( 439 void CastContentBrowserClient::RegisterInProcessMojoApplications(
428 StaticMojoApplicationMap* apps) { 440 StaticMojoApplicationMap* apps) {
429 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) 441 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS)
430 content::MojoApplicationInfo app_info; 442 content::MojoApplicationInfo app_info;
431 app_info.application_factory = 443 app_info.application_factory =
432 base::Bind(&CreateMojoMediaApplication, base::Unretained(this)); 444 base::Bind(&CreateMojoMediaApplication, base::Unretained(this));
433 app_info.application_task_runner = GetMediaTaskRunner(); 445 app_info.application_task_runner = GetMediaTaskRunner();
434 apps->insert(std::make_pair("mojo:media", app_info)); 446 apps->insert(std::make_pair("mojo:media", app_info));
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 process_type, dumps_path, false /* upload */); 561 process_type, dumps_path, false /* upload */);
550 // StartUploaderThread() even though upload is diferred. 562 // StartUploaderThread() even though upload is diferred.
551 // Breakpad-related memory is freed in the uploader thread. 563 // Breakpad-related memory is freed in the uploader thread.
552 crash_handler->StartUploaderThread(); 564 crash_handler->StartUploaderThread();
553 return crash_handler; 565 return crash_handler;
554 } 566 }
555 #endif // !defined(OS_ANDROID) 567 #endif // !defined(OS_ANDROID)
556 568
557 } // namespace shell 569 } // namespace shell
558 } // namespace chromecast 570 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/browser/cast_content_browser_client.h ('k') | components/policy/core/common/schema_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698