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

Side by Side Diff: mojo/services/html_viewer/webmediaplayer_factory.cc

Issue 814143004: Encrypted Media: Add DefaultCdmFactory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase only Created 6 years 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
« no previous file with comments | « media/media.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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"
11 #include "media/audio/audio_manager.h" 11 #include "media/audio/audio_manager.h"
12 #include "media/audio/audio_manager_base.h" 12 #include "media/audio/audio_manager_base.h"
13 #include "media/audio/audio_output_stream_sink.h" 13 #include "media/audio/audio_output_stream_sink.h"
14 #include "media/base/audio_hardware_config.h" 14 #include "media/base/audio_hardware_config.h"
15 #include "media/base/media.h" 15 #include "media/base/media.h"
16 #include "media/base/media_log.h" 16 #include "media/base/media_log.h"
17 #include "media/blink/webmediaplayer_impl.h" 17 #include "media/blink/webmediaplayer_impl.h"
18 #include "media/blink/webmediaplayer_params.h" 18 #include "media/blink/webmediaplayer_params.h"
19 #include "media/cdm/default_cdm_factory.h"
19 #include "media/filters/default_renderer_factory.h" 20 #include "media/filters/default_renderer_factory.h"
20 #include "media/filters/gpu_video_accelerator_factories.h" 21 #include "media/filters/gpu_video_accelerator_factories.h"
21 #include "media/mojo/interfaces/media_renderer.mojom.h" 22 #include "media/mojo/interfaces/media_renderer.mojom.h"
22 #include "media/mojo/services/mojo_renderer_factory.h" 23 #include "media/mojo/services/mojo_renderer_factory.h"
23 #include "mojo/public/cpp/application/connect.h" 24 #include "mojo/public/cpp/application/connect.h"
24 #include "mojo/public/interfaces/application/shell.mojom.h" 25 #include "mojo/public/interfaces/application/shell.mojom.h"
25 26
26 using mojo::ServiceProviderPtr; 27 using mojo::ServiceProviderPtr;
27 28
28 namespace html_viewer { 29 namespace html_viewer {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 new media::DefaultRendererFactory(media_log, 96 new media::DefaultRendererFactory(media_log,
96 nullptr, // No GPU factory. 97 nullptr, // No GPU factory.
97 GetAudioHardwareConfig())); 98 GetAudioHardwareConfig()));
98 } 99 }
99 100
100 media::WebMediaPlayerParams params( 101 media::WebMediaPlayerParams params(
101 media::WebMediaPlayerParams::DeferLoadCB(), CreateAudioRendererSink(), 102 media::WebMediaPlayerParams::DeferLoadCB(), CreateAudioRendererSink(),
102 media_log, GetMediaThreadTaskRunner(), compositor_task_runner_, nullptr); 103 media_log, GetMediaThreadTaskRunner(), compositor_task_runner_, nullptr);
103 base::WeakPtr<media::WebMediaPlayerDelegate> delegate; 104 base::WeakPtr<media::WebMediaPlayerDelegate> delegate;
104 105
105 // TODO(xhwang): Provide a media based CdmFactory implementation. 106 scoped_ptr<media::CdmFactory> cdm_factory(new media::DefaultCdmFactory());
106 return new media::WebMediaPlayerImpl( 107
107 frame, client, delegate, media_renderer_factory.Pass(), nullptr, params); 108 return new media::WebMediaPlayerImpl(frame, client, delegate,
109 media_renderer_factory.Pass(),
110 cdm_factory.Pass(), params);
108 #endif 111 #endif
109 } 112 }
110 113
111 const media::AudioHardwareConfig& 114 const media::AudioHardwareConfig&
112 WebMediaPlayerFactory::GetAudioHardwareConfig() { 115 WebMediaPlayerFactory::GetAudioHardwareConfig() {
113 return audio_hardware_config_; 116 return audio_hardware_config_;
114 } 117 }
115 118
116 scoped_refptr<media::AudioRendererSink> 119 scoped_refptr<media::AudioRendererSink>
117 WebMediaPlayerFactory::CreateAudioRendererSink() { 120 WebMediaPlayerFactory::CreateAudioRendererSink() {
118 // TODO(dalecurtis): Replace this with an interface to an actual mojo service; 121 // TODO(dalecurtis): Replace this with an interface to an actual mojo service;
119 // the AudioOutputStreamSink will not work in sandboxed processes. 122 // the AudioOutputStreamSink will not work in sandboxed processes.
120 return new media::AudioOutputStreamSink(); 123 return new media::AudioOutputStreamSink();
121 } 124 }
122 125
123 scoped_refptr<base::SingleThreadTaskRunner> 126 scoped_refptr<base::SingleThreadTaskRunner>
124 WebMediaPlayerFactory::GetMediaThreadTaskRunner() { 127 WebMediaPlayerFactory::GetMediaThreadTaskRunner() {
125 if (!media_thread_.IsRunning()) 128 if (!media_thread_.IsRunning())
126 media_thread_.Start(); 129 media_thread_.Start();
127 130
128 return media_thread_.message_loop_proxy(); 131 return media_thread_.message_loop_proxy();
129 } 132 }
130 133
131 } // namespace html_viewer 134 } // namespace html_viewer
OLDNEW
« no previous file with comments | « media/media.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698