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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 mojo::InterfaceRequest<mojom::Renderer> request); | 43 mojo::InterfaceRequest<mojom::Renderer> request); |
44 ~MojoRendererService() final; | 44 ~MojoRendererService() final; |
45 | 45 |
46 // mojom::Renderer implementation. | 46 // mojom::Renderer implementation. |
47 void Initialize(mojom::RendererClientPtr client, | 47 void Initialize(mojom::RendererClientPtr client, |
48 mojom::DemuxerStreamPtr audio, | 48 mojom::DemuxerStreamPtr audio, |
49 mojom::DemuxerStreamPtr video, | 49 mojom::DemuxerStreamPtr video, |
50 const base::Optional<GURL>& url, | 50 const base::Optional<GURL>& url, |
51 const InitializeCallback& callback) final; | 51 const InitializeCallback& callback) final; |
52 void Flush(const FlushCallback& callback) final; | 52 void Flush(const FlushCallback& callback) final; |
53 void StartPlayingFrom(int64_t time_delta_usec) final; | 53 void StartPlayingFrom(base::TimeDelta time_delta) final; |
54 void SetPlaybackRate(double playback_rate) final; | 54 void SetPlaybackRate(double playback_rate) final; |
55 void SetVolume(float volume) final; | 55 void SetVolume(float volume) final; |
56 void SetCdm(int32_t cdm_id, const SetCdmCallback& callback) final; | 56 void SetCdm(int32_t cdm_id, const SetCdmCallback& callback) final; |
57 | 57 |
58 private: | 58 private: |
59 enum State { | 59 enum State { |
60 STATE_UNINITIALIZED, | 60 STATE_UNINITIALIZED, |
61 STATE_INITIALIZING, | 61 STATE_INITIALIZING, |
62 STATE_FLUSHING, | 62 STATE_FLUSHING, |
63 STATE_PLAYING, | 63 STATE_PLAYING, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 mojo::StrongBinding<mojom::Renderer> binding_; | 100 mojo::StrongBinding<mojom::Renderer> binding_; |
101 | 101 |
102 base::WeakPtr<MojoCdmServiceContext> mojo_cdm_service_context_; | 102 base::WeakPtr<MojoCdmServiceContext> mojo_cdm_service_context_; |
103 | 103 |
104 State state_; | 104 State state_; |
105 | 105 |
106 std::unique_ptr<DemuxerStreamProvider> stream_provider_; | 106 std::unique_ptr<DemuxerStreamProvider> stream_provider_; |
107 | 107 |
108 base::RepeatingTimer time_update_timer_; | 108 base::RepeatingTimer time_update_timer_; |
109 int64_t last_media_time_usec_; | 109 base::TimeDelta last_media_time_; |
110 | 110 |
111 mojom::RendererClientPtr client_; | 111 mojom::RendererClientPtr client_; |
112 | 112 |
113 // Hold a reference to the CDM set on the |renderer_| so that the CDM won't be | 113 // Hold a reference to the CDM set on the |renderer_| so that the CDM won't be |
114 // destructed while the |renderer_| is still using it. | 114 // destructed while the |renderer_| is still using it. |
115 scoped_refptr<MediaKeys> cdm_; | 115 scoped_refptr<MediaKeys> cdm_; |
116 | 116 |
117 // Note: Destroy |renderer_| first to avoid access violation into other | 117 // Note: Destroy |renderer_| first to avoid access violation into other |
118 // members, e.g. |stream_provider_| and |cdm_|. | 118 // members, e.g. |stream_provider_| and |cdm_|. |
119 // Must use "media::" because "Renderer" is ambiguous. | 119 // Must use "media::" because "Renderer" is ambiguous. |
120 std::unique_ptr<media::Renderer> renderer_; | 120 std::unique_ptr<media::Renderer> renderer_; |
121 | 121 |
122 base::WeakPtr<MojoRendererService> weak_this_; | 122 base::WeakPtr<MojoRendererService> weak_this_; |
123 base::WeakPtrFactory<MojoRendererService> weak_factory_; | 123 base::WeakPtrFactory<MojoRendererService> weak_factory_; |
124 | 124 |
125 DISALLOW_COPY_AND_ASSIGN(MojoRendererService); | 125 DISALLOW_COPY_AND_ASSIGN(MojoRendererService); |
126 }; | 126 }; |
127 | 127 |
128 } // namespace media | 128 } // namespace media |
129 | 129 |
130 #endif // MEDIA_MOJO_SERVICES_MOJO_RENDERER_SERVICE_H_ | 130 #endif // MEDIA_MOJO_SERVICES_MOJO_RENDERER_SERVICE_H_ |
OLD | NEW |