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 "mojo/services/html_viewer/webmediaplayer_factory.h" | 5 #include "mojo/services/html_viewer/webmediaplayer_factory.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 WebMediaPlayerFactory::~WebMediaPlayerFactory() { | 74 WebMediaPlayerFactory::~WebMediaPlayerFactory() { |
75 } | 75 } |
76 | 76 |
77 blink::WebMediaPlayer* WebMediaPlayerFactory::CreateMediaPlayer( | 77 blink::WebMediaPlayer* WebMediaPlayerFactory::CreateMediaPlayer( |
78 blink::WebLocalFrame* frame, | 78 blink::WebLocalFrame* frame, |
79 const blink::WebURL& url, | 79 const blink::WebURL& url, |
80 blink::WebMediaPlayerClient* client, | 80 blink::WebMediaPlayerClient* client, |
| 81 media::MediaPermission* media_permission, |
81 blink::WebContentDecryptionModule* initial_cdm, | 82 blink::WebContentDecryptionModule* initial_cdm, |
82 mojo::Shell* shell) { | 83 mojo::Shell* shell) { |
83 #if defined(OS_ANDROID) | 84 #if defined(OS_ANDROID) |
84 return nullptr; | 85 return nullptr; |
85 #else | 86 #else |
86 scoped_refptr<media::MediaLog> media_log(new media::MediaLog()); | 87 scoped_refptr<media::MediaLog> media_log(new media::MediaLog()); |
87 scoped_ptr<media::RendererFactory> media_renderer_factory; | 88 scoped_ptr<media::RendererFactory> media_renderer_factory; |
88 | 89 |
89 if (enable_mojo_media_renderer_) { | 90 if (enable_mojo_media_renderer_) { |
90 ServiceProviderPtr media_renderer_service_provider; | 91 ServiceProviderPtr media_renderer_service_provider; |
91 shell->ConnectToApplication( | 92 shell->ConnectToApplication( |
92 "mojo:media", GetProxy(&media_renderer_service_provider), nullptr); | 93 "mojo:media", GetProxy(&media_renderer_service_provider), nullptr); |
93 media_renderer_factory.reset(new media::MojoRendererFactory(make_scoped_ptr( | 94 media_renderer_factory.reset(new media::MojoRendererFactory(make_scoped_ptr( |
94 new RendererServiceProvider(media_renderer_service_provider.Pass())))); | 95 new RendererServiceProvider(media_renderer_service_provider.Pass())))); |
95 } else { | 96 } else { |
96 media_renderer_factory.reset( | 97 media_renderer_factory.reset( |
97 new media::DefaultRendererFactory(media_log, | 98 new media::DefaultRendererFactory(media_log, |
98 nullptr, // No GPU factory. | 99 nullptr, // No GPU factory. |
99 GetAudioHardwareConfig())); | 100 GetAudioHardwareConfig())); |
100 } | 101 } |
101 | 102 |
102 media::WebMediaPlayerParams params( | 103 media::WebMediaPlayerParams params( |
103 media::WebMediaPlayerParams::DeferLoadCB(), CreateAudioRendererSink(), | 104 media::WebMediaPlayerParams::DeferLoadCB(), CreateAudioRendererSink(), |
104 media_log, GetMediaThreadTaskRunner(), compositor_task_runner_, | 105 media_log, GetMediaThreadTaskRunner(), compositor_task_runner_, |
105 media::WebMediaPlayerParams::Context3DCB(), initial_cdm); | 106 media::WebMediaPlayerParams::Context3DCB(), media_permission, |
| 107 initial_cdm); |
106 base::WeakPtr<media::WebMediaPlayerDelegate> delegate; | 108 base::WeakPtr<media::WebMediaPlayerDelegate> delegate; |
107 | 109 |
108 scoped_ptr<media::CdmFactory> cdm_factory(new media::DefaultCdmFactory()); | 110 scoped_ptr<media::CdmFactory> cdm_factory(new media::DefaultCdmFactory()); |
109 | 111 |
110 return new media::WebMediaPlayerImpl(frame, client, delegate, | 112 return new media::WebMediaPlayerImpl(frame, client, delegate, |
111 media_renderer_factory.Pass(), | 113 media_renderer_factory.Pass(), |
112 cdm_factory.Pass(), params); | 114 cdm_factory.Pass(), params); |
113 #endif | 115 #endif |
114 } | 116 } |
115 | 117 |
(...skipping 11 matching lines...) Expand all Loading... |
127 | 129 |
128 scoped_refptr<base::SingleThreadTaskRunner> | 130 scoped_refptr<base::SingleThreadTaskRunner> |
129 WebMediaPlayerFactory::GetMediaThreadTaskRunner() { | 131 WebMediaPlayerFactory::GetMediaThreadTaskRunner() { |
130 if (!media_thread_.IsRunning()) | 132 if (!media_thread_.IsRunning()) |
131 media_thread_.Start(); | 133 media_thread_.Start(); |
132 | 134 |
133 return media_thread_.message_loop_proxy(); | 135 return media_thread_.message_loop_proxy(); |
134 } | 136 } |
135 | 137 |
136 } // namespace html_viewer | 138 } // namespace html_viewer |
OLD | NEW |