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 "media/mojo/services/mojo_renderer_service.h" | 5 #include "media/mojo/services/mojo_renderer_service.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "media/base/media_keys.h" | 10 #include "media/base/media_keys.h" |
11 #include "media/base/renderer.h" | 11 #include "media/base/renderer.h" |
12 #include "media/mojo/services/demuxer_stream_provider_shim.h" | 12 #include "media/mojo/services/demuxer_stream_provider_shim.h" |
13 #include "media/mojo/services/mojo_cdm_service_context.h" | 13 #include "media/mojo/services/mojo_cdm_service_context.h" |
14 #include "ui/gfx/geometry/mojo/geometry_type_converters.h" | |
15 | 14 |
16 namespace media { | 15 namespace media { |
17 | 16 |
18 // Time interval to update media time. | 17 // Time interval to update media time. |
19 const int kTimeUpdateIntervalMs = 50; | 18 const int kTimeUpdateIntervalMs = 50; |
20 | 19 |
21 MojoRendererService::MojoRendererService( | 20 MojoRendererService::MojoRendererService( |
22 base::WeakPtr<MojoCdmServiceContext> mojo_cdm_service_context, | 21 base::WeakPtr<MojoCdmServiceContext> mojo_cdm_service_context, |
23 std::unique_ptr<media::Renderer> renderer, | 22 std::unique_ptr<media::Renderer> renderer, |
24 mojo::InterfaceRequest<mojom::Renderer> request) | 23 mojo::InterfaceRequest<mojom::Renderer> request) |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 DVLOG(2) << __FUNCTION__ << "(" << state << ")"; | 123 DVLOG(2) << __FUNCTION__ << "(" << state << ")"; |
125 client_->OnBufferingStateChange(static_cast<mojom::BufferingState>(state)); | 124 client_->OnBufferingStateChange(static_cast<mojom::BufferingState>(state)); |
126 } | 125 } |
127 | 126 |
128 void MojoRendererService::OnWaitingForDecryptionKey() { | 127 void MojoRendererService::OnWaitingForDecryptionKey() { |
129 // TODO(alokp): Plumb the event to mojom::RendererClient. crbug/585287 | 128 // TODO(alokp): Plumb the event to mojom::RendererClient. crbug/585287 |
130 } | 129 } |
131 | 130 |
132 void MojoRendererService::OnVideoNaturalSizeChange(const gfx::Size& size) { | 131 void MojoRendererService::OnVideoNaturalSizeChange(const gfx::Size& size) { |
133 DVLOG(2) << __FUNCTION__ << "(" << size.ToString() << ")"; | 132 DVLOG(2) << __FUNCTION__ << "(" << size.ToString() << ")"; |
134 client_->OnVideoNaturalSizeChange(mojo::Size::From(size)); | 133 client_->OnVideoNaturalSizeChange(size); |
135 } | 134 } |
136 | 135 |
137 void MojoRendererService::OnVideoOpacityChange(bool opaque) { | 136 void MojoRendererService::OnVideoOpacityChange(bool opaque) { |
138 DVLOG(2) << __FUNCTION__ << "(" << opaque << ")"; | 137 DVLOG(2) << __FUNCTION__ << "(" << opaque << ")"; |
139 client_->OnVideoOpacityChange(opaque); | 138 client_->OnVideoOpacityChange(opaque); |
140 } | 139 } |
141 | 140 |
142 void MojoRendererService::OnStreamReady( | 141 void MojoRendererService::OnStreamReady( |
143 const mojo::Callback<void(bool)>& callback) { | 142 const mojo::Callback<void(bool)>& callback) { |
144 DCHECK_EQ(state_, STATE_INITIALIZING); | 143 DCHECK_EQ(state_, STATE_INITIALIZING); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 bool success) { | 201 bool success) { |
203 DVLOG(1) << __FUNCTION__ << "(" << success << ")"; | 202 DVLOG(1) << __FUNCTION__ << "(" << success << ")"; |
204 | 203 |
205 if (success) | 204 if (success) |
206 cdm_ = cdm; | 205 cdm_ = cdm; |
207 | 206 |
208 callback.Run(success); | 207 callback.Run(success); |
209 } | 208 } |
210 | 209 |
211 } // namespace media | 210 } // namespace media |
OLD | NEW |