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

Side by Side Diff: components/html_viewer/media_factory.cc

Issue 1133033003: Eliminate MediaPlayer & MediaPlayerClient abstractions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed review comments Created 5 years, 5 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 "components/html_viewer/media_factory.h" 5 #include "components/html_viewer/media_factory.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 media::InitializeMediaLibrary(); 64 media::InitializeMediaLibrary();
65 } 65 }
66 66
67 MediaFactory::~MediaFactory() { 67 MediaFactory::~MediaFactory() {
68 } 68 }
69 69
70 blink::WebMediaPlayer* MediaFactory::CreateMediaPlayer( 70 blink::WebMediaPlayer* MediaFactory::CreateMediaPlayer(
71 blink::WebLocalFrame* frame, 71 blink::WebLocalFrame* frame,
72 const blink::WebURL& url, 72 const blink::WebURL& url,
73 blink::WebMediaPlayerClient* client, 73 blink::WebMediaPlayerClient* client,
74 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
74 blink::WebContentDecryptionModule* initial_cdm, 75 blink::WebContentDecryptionModule* initial_cdm,
75 mojo::Shell* shell) { 76 mojo::Shell* shell) {
76 #if defined(OS_ANDROID) 77 #if defined(OS_ANDROID)
77 // TODO(xhwang): Get CreateMediaPlayer working on android. 78 // TODO(xhwang): Get CreateMediaPlayer working on android.
78 return nullptr; 79 return nullptr;
79 #else 80 #else
80 scoped_refptr<media::MediaLog> media_log(new media::MediaLog()); 81 scoped_refptr<media::MediaLog> media_log(new media::MediaLog());
81 scoped_ptr<media::RendererFactory> media_renderer_factory; 82 scoped_ptr<media::RendererFactory> media_renderer_factory;
82 83
83 if (enable_mojo_media_renderer_) { 84 if (enable_mojo_media_renderer_) {
84 media_renderer_factory.reset( 85 media_renderer_factory.reset(
85 new media::MojoRendererFactory(GetMediaServiceProvider())); 86 new media::MojoRendererFactory(GetMediaServiceProvider()));
86 } else { 87 } else {
87 media_renderer_factory.reset( 88 media_renderer_factory.reset(
88 new media::DefaultRendererFactory(media_log, 89 new media::DefaultRendererFactory(media_log,
89 nullptr, // No GPU factory. 90 nullptr, // No GPU factory.
90 GetAudioHardwareConfig())); 91 GetAudioHardwareConfig()));
91 } 92 }
92 93
93 media::WebMediaPlayerParams params( 94 media::WebMediaPlayerParams params(
94 media::WebMediaPlayerParams::DeferLoadCB(), CreateAudioRendererSink(), 95 media::WebMediaPlayerParams::DeferLoadCB(), CreateAudioRendererSink(),
95 media_log, GetMediaThreadTaskRunner(), compositor_task_runner_, 96 media_log, GetMediaThreadTaskRunner(), compositor_task_runner_,
96 media::WebMediaPlayerParams::Context3DCB(), GetMediaPermission(), 97 media::WebMediaPlayerParams::Context3DCB(), GetMediaPermission(),
97 initial_cdm); 98 initial_cdm);
98 base::WeakPtr<media::WebMediaPlayerDelegate> delegate; 99 base::WeakPtr<media::WebMediaPlayerDelegate> delegate;
99 100
100 return new media::WebMediaPlayerImpl(frame, client, delegate, 101 return new media::WebMediaPlayerImpl(frame, client, encrypted_client,
101 media_renderer_factory.Pass(), 102 delegate, media_renderer_factory.Pass(),
102 GetCdmFactory(), params); 103 GetCdmFactory(), params);
103 #endif // defined(OS_ANDROID) 104 #endif // defined(OS_ANDROID)
104 } 105 }
105 106
106 blink::WebEncryptedMediaClient* MediaFactory::GetEncryptedMediaClient() { 107 blink::WebEncryptedMediaClient* MediaFactory::GetEncryptedMediaClient() {
107 if (!web_encrypted_media_client_) { 108 if (!web_encrypted_media_client_) {
108 web_encrypted_media_client_.reset(new media::WebEncryptedMediaClientImpl( 109 web_encrypted_media_client_.reset(new media::WebEncryptedMediaClientImpl(
109 base::Bind(&AreSecureCodecsSupported), GetCdmFactory(), 110 base::Bind(&AreSecureCodecsSupported), GetCdmFactory(),
110 GetMediaPermission())); 111 GetMediaPermission()));
111 } 112 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 scoped_refptr<base::SingleThreadTaskRunner> 160 scoped_refptr<base::SingleThreadTaskRunner>
160 MediaFactory::GetMediaThreadTaskRunner() { 161 MediaFactory::GetMediaThreadTaskRunner() {
161 if (!media_thread_.IsRunning()) 162 if (!media_thread_.IsRunning())
162 media_thread_.Start(); 163 media_thread_.Start();
163 164
164 return media_thread_.task_runner(); 165 return media_thread_.task_runner();
165 } 166 }
166 #endif // !defined(OS_ANDROID) 167 #endif // !defined(OS_ANDROID)
167 168
168 } // namespace html_viewer 169 } // namespace html_viewer
OLDNEW
« no previous file with comments | « components/html_viewer/media_factory.h ('k') | content/renderer/media/android/webmediaplayer_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698