| 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 <memory> | 10 #include <memory> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/time/default_tick_clock.h" | 14 #include "base/time/default_tick_clock.h" |
| 15 #include "base/unguessable_token.h" | 15 #include "base/unguessable_token.h" |
| 16 #include "media/base/demuxer_stream.h" | 16 #include "media/base/demuxer_stream.h" |
| 17 #include "media/base/renderer.h" | 17 #include "media/base/renderer.h" |
| 18 #include "media/base/time_delta_interpolator.h" | 18 #include "media/base/time_delta_interpolator.h" |
| 19 #include "media/mojo/interfaces/renderer.mojom.h" | 19 #include "media/mojo/interfaces/renderer.mojom.h" |
| 20 #include "mojo/public/cpp/bindings/associated_binding.h" | 20 #include "mojo/public/cpp/bindings/associated_binding.h" |
| 21 | 21 |
| 22 namespace base { | 22 namespace base { |
| 23 class SingleThreadTaskRunner; | 23 class SingleThreadTaskRunner; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace media { | 26 namespace media { |
| 27 | 27 |
| 28 class MediaResource; | 28 class MediaResource; |
| 29 class MojoDemuxerStreamImpl; | 29 class MojoDemuxerStreamImpl; |
| 30 class MojoVideoRendererSinkImpl; |
| 30 class VideoOverlayFactory; | 31 class VideoOverlayFactory; |
| 31 class VideoRendererSink; | 32 class VideoRendererSink; |
| 32 | 33 |
| 33 // A media::Renderer that proxies to a mojom::Renderer. That | 34 // A media::Renderer that proxies to a mojom::Renderer. That |
| 34 // mojom::Renderer proxies back to the MojoRenderer via the | 35 // mojom::Renderer proxies back to the MojoRenderer via the |
| 35 // mojom::RendererClient interface. | 36 // mojom::RendererClient interface. |
| 36 // | 37 // |
| 37 // This class can be created on any thread, where the |remote_renderer| is | 38 // This class can be created on any thread, where the |remote_renderer| is |
| 38 // connected and passed in the constructor. Then Initialize() will be called on | 39 // connected and passed in the constructor. Then Initialize() will be called on |
| 39 // the |task_runner| and starting from that point this class is bound to the | 40 // the |task_runner| and starting from that point this class is bound to the |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // MediaResource::Type::URL. | 97 // MediaResource::Type::URL. |
| 97 void InitializeRendererFromUrl(media::RendererClient* client); | 98 void InitializeRendererFromUrl(media::RendererClient* client); |
| 98 | 99 |
| 99 // Callback for connection error on |remote_renderer_|. | 100 // Callback for connection error on |remote_renderer_|. |
| 100 void OnConnectionError(); | 101 void OnConnectionError(); |
| 101 | 102 |
| 102 // Callback for connection error on any of |streams_|. The |stream| parameter | 103 // Callback for connection error on any of |streams_|. The |stream| parameter |
| 103 // indicates which stream the error happened on. | 104 // indicates which stream the error happened on. |
| 104 void OnDemuxerStreamConnectionError(MojoDemuxerStreamImpl* stream); | 105 void OnDemuxerStreamConnectionError(MojoDemuxerStreamImpl* stream); |
| 105 | 106 |
| 107 // Callback for connection error on |mojo_video_renderer_sink_|. |
| 108 void OnVideoRendererSinkConnectionError(); |
| 109 |
| 106 // Callbacks for |remote_renderer_| methods. | 110 // Callbacks for |remote_renderer_| methods. |
| 107 void OnInitialized(media::RendererClient* client, bool success); | 111 void OnInitialized(media::RendererClient* client, bool success); |
| 108 void OnFlushed(); | 112 void OnFlushed(); |
| 109 void OnCdmAttached(bool success); | 113 void OnCdmAttached(bool success); |
| 110 | 114 |
| 111 void CancelPendingCallbacks(); | 115 void CancelPendingCallbacks(); |
| 112 | 116 |
| 113 // |task_runner| on which all methods are invoked, except for GetMediaTime(), | 117 // |task_runner| on which all methods are invoked, except for GetMediaTime(), |
| 114 // which can be called on any thread. | 118 // which can be called on any thread. |
| 115 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 119 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 156 |
| 153 PipelineStatusCB init_cb_; | 157 PipelineStatusCB init_cb_; |
| 154 base::Closure flush_cb_; | 158 base::Closure flush_cb_; |
| 155 CdmAttachedCB cdm_attached_cb_; | 159 CdmAttachedCB cdm_attached_cb_; |
| 156 | 160 |
| 157 // Lock used to serialize access for |time_interpolator_|. | 161 // Lock used to serialize access for |time_interpolator_|. |
| 158 mutable base::Lock lock_; | 162 mutable base::Lock lock_; |
| 159 base::DefaultTickClock media_clock_; | 163 base::DefaultTickClock media_clock_; |
| 160 media::TimeDeltaInterpolator media_time_interpolator_; | 164 media::TimeDeltaInterpolator media_time_interpolator_; |
| 161 | 165 |
| 166 std::unique_ptr<MojoVideoRendererSinkImpl> mojo_video_renderer_sink_; |
| 167 |
| 162 DISALLOW_COPY_AND_ASSIGN(MojoRenderer); | 168 DISALLOW_COPY_AND_ASSIGN(MojoRenderer); |
| 163 }; | 169 }; |
| 164 | 170 |
| 165 } // namespace media | 171 } // namespace media |
| 166 | 172 |
| 167 #endif // MEDIA_MOJO_CLIENTS_MOJO_RENDERER_H_ | 173 #endif // MEDIA_MOJO_CLIENTS_MOJO_RENDERER_H_ |
| OLD | NEW |