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

Side by Side Diff: media/mojo/services/default_mojo_media_client.cc

Issue 2299703005: Rename TestMojoMediaClient -> DefaultMojoMediaClient. (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « media/mojo/services/default_mojo_media_client.h ('k') | media/mojo/services/main.cc » ('j') | 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 "media/mojo/services/default_mojo_media_client.h" 5 #include "media/mojo/services/default_mojo_media_client.h"
6 6
7 #include "base/memory/ptr_util.h"
8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h"
10 #include "base/threading/thread_task_runner_handle.h"
11 #include "media/audio/audio_device_description.h"
12 #include "media/audio/audio_manager.h"
13 #include "media/audio/audio_output_stream_sink.h"
7 #include "media/base/cdm_factory.h" 14 #include "media/base/cdm_factory.h"
15 #include "media/base/media.h"
16 #include "media/base/media_log.h"
17 #include "media/base/null_video_sink.h"
18 #include "media/base/renderer_factory.h"
19 #include "media/cdm/default_cdm_factory.h"
20 #include "media/renderers/default_renderer_factory.h"
21 #include "media/renderers/gpu_video_accelerator_factories.h"
8 22
9 namespace media { 23 namespace media {
10 24
11 DefaultMojoMediaClient::DefaultMojoMediaClient() {} 25 DefaultMojoMediaClient::DefaultMojoMediaClient() {}
12 26
13 DefaultMojoMediaClient::~DefaultMojoMediaClient() {} 27 DefaultMojoMediaClient::~DefaultMojoMediaClient() {
28 DVLOG(1) << __FUNCTION__;
29 // AudioManager destructor requires MessageLoop.
30 // Destroy it before the message loop goes away.
31 audio_manager_.reset();
32 // Flush the message loop to ensure that the audio manager is destroyed.
33 base::RunLoop().RunUntilIdle();
34 }
14 35
15 void DefaultMojoMediaClient::Initialize() { 36 void DefaultMojoMediaClient::Initialize() {
16 // TODO(jrummell): Do one-time initialization work here. 37 InitializeMediaLibrary();
38 // TODO(dalecurtis): We should find a single owner per process for the audio
39 // manager or make it a lazy instance. It's not safe to call Get()/Create()
40 // across multiple threads...
41 AudioManager* audio_manager = AudioManager::Get();
42 if (!audio_manager) {
43 audio_manager_ = media::AudioManager::CreateForTesting(
44 base::ThreadTaskRunnerHandle::Get());
45 audio_manager = audio_manager_.get();
46 // Flush the message loop to ensure that the audio manager is initialized.
47 base::RunLoop().RunUntilIdle();
48 }
49 }
50
51 scoped_refptr<AudioRendererSink>
52 DefaultMojoMediaClient::CreateAudioRendererSink(
53 const std::string& /* audio_device_id */) {
54 return new AudioOutputStreamSink();
55 }
56
57 std::unique_ptr<VideoRendererSink>
58 DefaultMojoMediaClient::CreateVideoRendererSink(
59 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) {
60 return base::MakeUnique<NullVideoSink>(
61 false, base::TimeDelta::FromSecondsD(1.0 / 60),
62 NullVideoSink::NewFrameCB(), task_runner);
63 }
64
65 std::unique_ptr<RendererFactory> DefaultMojoMediaClient::CreateRendererFactory(
66 const scoped_refptr<MediaLog>& media_log) {
67 return base::MakeUnique<DefaultRendererFactory>(
68 std::move(media_log), nullptr,
69 DefaultRendererFactory::GetGpuFactoriesCB());
17 } 70 }
18 71
19 std::unique_ptr<CdmFactory> DefaultMojoMediaClient::CreateCdmFactory( 72 std::unique_ptr<CdmFactory> DefaultMojoMediaClient::CreateCdmFactory(
20 shell::mojom::InterfaceProvider* /* interface_provider */) { 73 shell::mojom::InterfaceProvider* /* interface_provider */) {
21 DVLOG(1) << __FUNCTION__; 74 DVLOG(1) << __FUNCTION__;
22 // TODO(jrummell): Return a CdmFactory that can create CdmAdapter here. 75 return base::MakeUnique<DefaultCdmFactory>();
23 return nullptr;
24 } 76 }
25 77
26 } // namespace media 78 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/services/default_mojo_media_client.h ('k') | media/mojo/services/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698