OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |