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_H_ | 5 #ifndef MEDIA_MOJO_CLIENTS_MOJO_RENDERER_H_ |
6 #define MEDIA_MOJO_CLIENTS_MOJO_RENDERER_H_ | 6 #define MEDIA_MOJO_CLIENTS_MOJO_RENDERER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
89 // DemuxerSteamProvider::Type::STREAM. | 89 // DemuxerSteamProvider::Type::STREAM. |
90 void InitializeRendererFromStreams(media::RendererClient* client); | 90 void InitializeRendererFromStreams(media::RendererClient* client); |
91 | 91 |
92 // Initialize the remote renderer when |demuxer_stream_provider| is of type | 92 // Initialize the remote renderer when |demuxer_stream_provider| is of type |
93 // DemuxerSteamProvider::Type::URL. | 93 // DemuxerSteamProvider::Type::URL. |
94 void InitializeRendererFromUrl(media::RendererClient* client); | 94 void InitializeRendererFromUrl(media::RendererClient* client); |
95 | 95 |
96 // Callback for connection error on |remote_renderer_|. | 96 // Callback for connection error on |remote_renderer_|. |
97 void OnConnectionError(); | 97 void OnConnectionError(); |
98 | 98 |
99 // Callback for connection error on |audio_stream_| and |video_stream_|. | 99 // Callback for connection error on any of |streams_|. |
100 void OnDemuxerStreamConnectionError(DemuxerStream::Type type); | 100 void OnDemuxerStreamConnectionError(MojoDemuxerStreamImpl* stream); |
xhwang
2017/01/31 00:15:21
Add comment about what |stream| means in this API
servolk
2017/01/31 01:10:40
Done.
| |
101 | 101 |
102 // Callbacks for |remote_renderer_| methods. | 102 // Callbacks for |remote_renderer_| methods. |
103 void OnInitialized(media::RendererClient* client, bool success); | 103 void OnInitialized(media::RendererClient* client, bool success); |
104 void OnFlushed(); | 104 void OnFlushed(); |
105 void OnCdmAttached(bool success); | 105 void OnCdmAttached(bool success); |
106 | 106 |
107 void CancelPendingCallbacks(); | 107 void CancelPendingCallbacks(); |
108 | 108 |
109 // |task_runner| on which all methods are invoked, except for GetMediaTime(), | 109 // |task_runner| on which all methods are invoked, except for GetMediaTime(), |
110 // which can be called on any thread. | 110 // which can be called on any thread. |
(...skipping 13 matching lines...) Expand all Loading... | |
124 | 124 |
125 // Client of |this| renderer passed in Initialize. | 125 // Client of |this| renderer passed in Initialize. |
126 media::RendererClient* client_ = nullptr; | 126 media::RendererClient* client_ = nullptr; |
127 | 127 |
128 // Mojo demuxer streams. | 128 // Mojo demuxer streams. |
129 // Owned by MojoRenderer instead of remote mojom::Renderer | 129 // Owned by MojoRenderer instead of remote mojom::Renderer |
130 // becuase these demuxer streams need to be destroyed as soon as |this| is | 130 // becuase these demuxer streams need to be destroyed as soon as |this| is |
131 // destroyed. The local demuxer streams returned by DemuxerStreamProvider | 131 // destroyed. The local demuxer streams returned by DemuxerStreamProvider |
132 // cannot be used after |this| is destroyed. | 132 // cannot be used after |this| is destroyed. |
133 // TODO(alokp): Add tests for MojoDemuxerStreamImpl. | 133 // TODO(alokp): Add tests for MojoDemuxerStreamImpl. |
134 std::unique_ptr<MojoDemuxerStreamImpl> audio_stream_; | 134 std::vector<std::unique_ptr<MojoDemuxerStreamImpl>> streams_; |
xhwang
2017/01/31 00:15:21
nit: include <vector> and <memory>
servolk
2017/01/31 01:10:40
Done.
| |
135 std::unique_ptr<MojoDemuxerStreamImpl> video_stream_; | |
136 | 135 |
137 // This class is constructed on one thread and used exclusively on another | 136 // This class is constructed on one thread and used exclusively on another |
138 // thread. This member is used to safely pass the RendererPtr from one thread | 137 // thread. This member is used to safely pass the RendererPtr from one thread |
139 // to another. It is set in the constructor and is consumed in Initialize(). | 138 // to another. It is set in the constructor and is consumed in Initialize(). |
140 mojom::RendererPtrInfo remote_renderer_info_; | 139 mojom::RendererPtrInfo remote_renderer_info_; |
141 | 140 |
142 // Remote Renderer, bound to |task_runner_| during Initialize(). | 141 // Remote Renderer, bound to |task_runner_| during Initialize(). |
143 mojom::RendererPtr remote_renderer_; | 142 mojom::RendererPtr remote_renderer_; |
144 | 143 |
145 // Binding for RendererClient, bound to the |task_runner_|. | 144 // Binding for RendererClient, bound to the |task_runner_|. |
146 mojo::AssociatedBinding<RendererClient> client_binding_; | 145 mojo::AssociatedBinding<RendererClient> client_binding_; |
147 | 146 |
148 bool encountered_error_ = false; | 147 bool encountered_error_ = false; |
149 | 148 |
150 PipelineStatusCB init_cb_; | 149 PipelineStatusCB init_cb_; |
151 base::Closure flush_cb_; | 150 base::Closure flush_cb_; |
152 CdmAttachedCB cdm_attached_cb_; | 151 CdmAttachedCB cdm_attached_cb_; |
153 | 152 |
154 // Lock used to serialize access for |time_interpolator_|. | 153 // Lock used to serialize access for |time_interpolator_|. |
155 mutable base::Lock lock_; | 154 mutable base::Lock lock_; |
156 base::DefaultTickClock media_clock_; | 155 base::DefaultTickClock media_clock_; |
157 media::TimeDeltaInterpolator media_time_interpolator_; | 156 media::TimeDeltaInterpolator media_time_interpolator_; |
158 | 157 |
159 DISALLOW_COPY_AND_ASSIGN(MojoRenderer); | 158 DISALLOW_COPY_AND_ASSIGN(MojoRenderer); |
160 }; | 159 }; |
161 | 160 |
162 } // namespace media | 161 } // namespace media |
163 | 162 |
164 #endif // MEDIA_MOJO_CLIENTS_MOJO_RENDERER_H_ | 163 #endif // MEDIA_MOJO_CLIENTS_MOJO_RENDERER_H_ |
OLD | NEW |