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 #ifndef MEDIA_MOJO_SERVICES_MOJO_RENDERER_SERVICE_H_ | 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_RENDERER_SERVICE_H_ |
6 #define MEDIA_MOJO_SERVICES_MOJO_RENDERER_SERVICE_H_ | 6 #define MEDIA_MOJO_SERVICES_MOJO_RENDERER_SERVICE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 STATE_ERROR | 78 STATE_ERROR |
79 }; | 79 }; |
80 | 80 |
81 MojoRendererService( | 81 MojoRendererService( |
82 base::WeakPtr<MojoCdmServiceContext> mojo_cdm_service_context, | 82 base::WeakPtr<MojoCdmServiceContext> mojo_cdm_service_context, |
83 scoped_refptr<AudioRendererSink> audio_sink, | 83 scoped_refptr<AudioRendererSink> audio_sink, |
84 std::unique_ptr<VideoRendererSink> video_sink, | 84 std::unique_ptr<VideoRendererSink> video_sink, |
85 std::unique_ptr<media::Renderer> renderer, | 85 std::unique_ptr<media::Renderer> renderer, |
86 InitiateSurfaceRequestCB initiate_surface_request_cb); | 86 InitiateSurfaceRequestCB initiate_surface_request_cb); |
87 | 87 |
| 88 void set_bad_message_cb(base::Closure bad_message_cb) { |
| 89 bad_message_cb_ = bad_message_cb; |
| 90 } |
| 91 |
88 // RendererClient implementation. | 92 // RendererClient implementation. |
89 void OnError(PipelineStatus status) final; | 93 void OnError(PipelineStatus status) final; |
90 void OnEnded() final; | 94 void OnEnded() final; |
91 void OnStatisticsUpdate(const PipelineStatistics& stats) final; | 95 void OnStatisticsUpdate(const PipelineStatistics& stats) final; |
92 void OnBufferingStateChange(BufferingState state) final; | 96 void OnBufferingStateChange(BufferingState state) final; |
93 void OnWaitingForDecryptionKey() final; | 97 void OnWaitingForDecryptionKey() final; |
94 void OnVideoNaturalSizeChange(const gfx::Size& size) final; | 98 void OnVideoNaturalSizeChange(const gfx::Size& size) final; |
95 void OnVideoOpacityChange(bool opaque) final; | 99 void OnVideoOpacityChange(bool opaque) final; |
96 void OnDurationChange(base::TimeDelta duration) final; | 100 void OnDurationChange(base::TimeDelta duration) final; |
97 | 101 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // Note: Destroy |renderer_| first to avoid access violation into other | 147 // Note: Destroy |renderer_| first to avoid access violation into other |
144 // members, e.g. |stream_provider_|, |cdm_|, |audio_sink_|, and | 148 // members, e.g. |stream_provider_|, |cdm_|, |audio_sink_|, and |
145 // |video_sink_|. | 149 // |video_sink_|. |
146 // Must use "media::" because "Renderer" is ambiguous. | 150 // Must use "media::" because "Renderer" is ambiguous. |
147 std::unique_ptr<media::Renderer> renderer_; | 151 std::unique_ptr<media::Renderer> renderer_; |
148 | 152 |
149 // Registers a new request in the ScopedSurfaceRequestManager. | 153 // Registers a new request in the ScopedSurfaceRequestManager. |
150 // Returns the token to be used to fulfill the request. | 154 // Returns the token to be used to fulfill the request. |
151 InitiateSurfaceRequestCB initiate_surface_request_cb_; | 155 InitiateSurfaceRequestCB initiate_surface_request_cb_; |
152 | 156 |
153 // WeakPtr to the binding that owns |this|. | 157 // Callback to be called when an invalid or unexpected message is received. |
154 // Used to forcefully close the connection (which also safely destroy |this|). | 158 // TODO(tguilbert): Revisit how to do InitiateScopedSurfaceRequest() so that |
155 mojo::StrongBindingPtr<mojom::Renderer> binding_; | 159 // we can eliminate this callback. See http://crbug.com/669606 |
| 160 base::Closure bad_message_cb_; |
156 | 161 |
157 base::WeakPtr<MojoRendererService> weak_this_; | 162 base::WeakPtr<MojoRendererService> weak_this_; |
158 base::WeakPtrFactory<MojoRendererService> weak_factory_; | 163 base::WeakPtrFactory<MojoRendererService> weak_factory_; |
159 | 164 |
160 DISALLOW_COPY_AND_ASSIGN(MojoRendererService); | 165 DISALLOW_COPY_AND_ASSIGN(MojoRendererService); |
161 }; | 166 }; |
162 | 167 |
163 } // namespace media | 168 } // namespace media |
164 | 169 |
165 #endif // MEDIA_MOJO_SERVICES_MOJO_RENDERER_SERVICE_H_ | 170 #endif // MEDIA_MOJO_SERVICES_MOJO_RENDERER_SERVICE_H_ |
OLD | NEW |