| 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_CLIENTS_MOJO_RENDERER_IMPL_H_ | 5 #ifndef MEDIA_MOJO_CLIENTS_MOJO_RENDERER_IMPL_H_ |
| 6 #define MEDIA_MOJO_CLIENTS_MOJO_RENDERER_IMPL_H_ | 6 #define MEDIA_MOJO_CLIENTS_MOJO_RENDERER_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 void OnVideoOpacityChange(bool opaque) override; | 66 void OnVideoOpacityChange(bool opaque) override; |
| 67 | 67 |
| 68 // Binds |remote_renderer_| to the mojo message pipe. Can be called multiple | 68 // Binds |remote_renderer_| to the mojo message pipe. Can be called multiple |
| 69 // times. If an error occurs during connection, OnConnectionError will be | 69 // times. If an error occurs during connection, OnConnectionError will be |
| 70 // called asynchronously. | 70 // called asynchronously. |
| 71 void BindRemoteRendererIfNeeded(); | 71 void BindRemoteRendererIfNeeded(); |
| 72 | 72 |
| 73 // Callback for connection error on |remote_renderer_|. | 73 // Callback for connection error on |remote_renderer_|. |
| 74 void OnConnectionError(); | 74 void OnConnectionError(); |
| 75 | 75 |
| 76 // Called when |remote_renderer_| has finished initializing. | 76 // Callbacks for |remote_renderer_| methods. |
| 77 void OnInitialized(bool success); | 77 void OnInitialized(media::RendererClient* client, bool success); |
| 78 void OnFlushed(); |
| 79 void OnCdmAttached(bool success); |
| 80 |
| 81 void CancelPendingCallbacks(); |
| 78 | 82 |
| 79 // |task_runner| on which all methods are invoked, except for GetMediaTime(), | 83 // |task_runner| on which all methods are invoked, except for GetMediaTime(), |
| 80 // which can be called on any thread. | 84 // which can be called on any thread. |
| 81 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 85 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 82 | 86 |
| 83 // Overlay factory used to create overlays for video frames rendered | 87 // Overlay factory used to create overlays for video frames rendered |
| 84 // by the remote renderer. | 88 // by the remote renderer. |
| 85 std::unique_ptr<VideoOverlayFactory> video_overlay_factory_; | 89 std::unique_ptr<VideoOverlayFactory> video_overlay_factory_; |
| 86 | 90 |
| 87 // Video frame overlays are rendered onto this sink. | 91 // Video frame overlays are rendered onto this sink. |
| 88 // Rendering of a new overlay is only needed when video natural size changes. | 92 // Rendering of a new overlay is only needed when video natural size changes. |
| 89 VideoRendererSink* video_renderer_sink_; | 93 VideoRendererSink* video_renderer_sink_ = nullptr; |
| 90 | 94 |
| 91 // Provider of audio/video DemuxerStreams. Must be valid throughout the | 95 // Provider of audio/video DemuxerStreams. Must be valid throughout the |
| 92 // lifetime of |this|. | 96 // lifetime of |this|. |
| 93 DemuxerStreamProvider* demuxer_stream_provider_; | 97 DemuxerStreamProvider* demuxer_stream_provider_ = nullptr; |
| 94 | 98 |
| 95 // Client of |this| renderer passed in Initialize. | 99 // Client of |this| renderer passed in Initialize. |
| 96 media::RendererClient* client_; | 100 media::RendererClient* client_ = nullptr; |
| 97 | 101 |
| 98 // This class is constructed on one thread and used exclusively on another | 102 // This class is constructed on one thread and used exclusively on another |
| 99 // thread. This member is used to safely pass the RendererPtr from one thread | 103 // thread. This member is used to safely pass the RendererPtr from one thread |
| 100 // to another. It is set in the constructor and is consumed in Initialize(). | 104 // to another. It is set in the constructor and is consumed in Initialize(). |
| 101 mojom::RendererPtrInfo remote_renderer_info_; | 105 mojom::RendererPtrInfo remote_renderer_info_; |
| 102 | 106 |
| 103 // Remote Renderer, bound to |task_runner_| during Initialize(). | 107 // Remote Renderer, bound to |task_runner_| during Initialize(). |
| 104 mojom::RendererPtr remote_renderer_; | 108 mojom::RendererPtr remote_renderer_; |
| 105 | 109 |
| 106 // Binding for RendererClient, bound to the |task_runner_|. | 110 // Binding for RendererClient, bound to the |task_runner_|. |
| 107 mojo::Binding<RendererClient> binding_; | 111 mojo::Binding<RendererClient> binding_; |
| 108 | 112 |
| 109 // Callbacks passed to Initialize() that we forward messages from | 113 bool encountered_error_ = false; |
| 110 // |remote_renderer_| through. | 114 |
| 111 PipelineStatusCB init_cb_; | 115 PipelineStatusCB init_cb_; |
| 116 base::Closure flush_cb_; |
| 117 CdmAttachedCB cdm_attached_cb_; |
| 112 | 118 |
| 113 // Lock used to serialize access for |time_|. | 119 // Lock used to serialize access for |time_|. |
| 114 mutable base::Lock lock_; | 120 mutable base::Lock lock_; |
| 115 base::TimeDelta time_; | 121 base::TimeDelta time_; |
| 116 | 122 |
| 117 DISALLOW_COPY_AND_ASSIGN(MojoRendererImpl); | 123 DISALLOW_COPY_AND_ASSIGN(MojoRendererImpl); |
| 118 }; | 124 }; |
| 119 | 125 |
| 120 } // namespace media | 126 } // namespace media |
| 121 | 127 |
| 122 #endif // MEDIA_MOJO_CLIENTS_MOJO_RENDERER_IMPL_H_ | 128 #endif // MEDIA_MOJO_CLIENTS_MOJO_RENDERER_IMPL_H_ |
| OLD | NEW |