OLD | NEW |
| (Empty) |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "media/remoting/remoting_renderer_factory.h" | |
6 | |
7 #include "base/logging.h" | |
8 #include "base/memory/ptr_util.h" | |
9 #include "media/remoting/remote_renderer_impl.h" | |
10 | |
11 namespace media { | |
12 | |
13 RemotingRendererFactory::RemotingRendererFactory( | |
14 std::unique_ptr<RendererFactory> default_renderer_factory, | |
15 std::unique_ptr<RemotingRendererController> remoting_renderer_controller) | |
16 : default_renderer_factory_(std::move(default_renderer_factory)), | |
17 remoting_renderer_controller_(std::move(remoting_renderer_controller)) {} | |
18 | |
19 RemotingRendererFactory::~RemotingRendererFactory() {} | |
20 | |
21 std::unique_ptr<Renderer> RemotingRendererFactory::CreateRenderer( | |
22 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, | |
23 const scoped_refptr<base::TaskRunner>& worker_task_runner, | |
24 AudioRendererSink* audio_renderer_sink, | |
25 VideoRendererSink* video_renderer_sink, | |
26 const RequestSurfaceCB& request_surface_cb) { | |
27 if (remoting_renderer_controller_ && | |
28 remoting_renderer_controller_->remote_rendering_started()) { | |
29 VLOG(1) << "Create Remoting renderer."; | |
30 return base::WrapUnique(new RemoteRendererImpl( | |
31 media_task_runner, remoting_renderer_controller_->GetWeakPtr(), | |
32 video_renderer_sink)); | |
33 } else { | |
34 VLOG(1) << "Create Local playback renderer."; | |
35 return default_renderer_factory_->CreateRenderer( | |
36 media_task_runner, worker_task_runner, audio_renderer_sink, | |
37 video_renderer_sink, request_surface_cb); | |
38 } | |
39 } | |
40 | |
41 } // namespace media | |
OLD | NEW |