Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: media/mojo/services/mojo_renderer_service.h

Issue 2358413002: media: Use associated interface for mojo RendererClient (Closed)
Patch Set: more test update Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 28 matching lines...) Expand all
39 // |mojo_cdm_service_context| can be used to find the CDM to support 39 // |mojo_cdm_service_context| can be used to find the CDM to support
40 // encrypted media. If null, encrypted media is not supported. 40 // encrypted media. If null, encrypted media is not supported.
41 MojoRendererService( 41 MojoRendererService(
42 base::WeakPtr<MojoCdmServiceContext> mojo_cdm_service_context, 42 base::WeakPtr<MojoCdmServiceContext> mojo_cdm_service_context,
43 scoped_refptr<AudioRendererSink> audio_sink, 43 scoped_refptr<AudioRendererSink> audio_sink,
44 std::unique_ptr<VideoRendererSink> video_sink, 44 std::unique_ptr<VideoRendererSink> video_sink,
45 std::unique_ptr<media::Renderer> renderer); 45 std::unique_ptr<media::Renderer> renderer);
46 ~MojoRendererService() final; 46 ~MojoRendererService() final;
47 47
48 // mojom::Renderer implementation. 48 // mojom::Renderer implementation.
49 void Initialize(mojom::RendererClientPtr client, 49 void Initialize(mojom::RendererClientAssociatedPtrInfo client,
50 mojom::DemuxerStreamPtr audio, 50 mojom::DemuxerStreamPtr audio,
51 mojom::DemuxerStreamPtr video, 51 mojom::DemuxerStreamPtr video,
52 const base::Optional<GURL>& url, 52 const base::Optional<GURL>& url,
53 const InitializeCallback& callback) final; 53 const InitializeCallback& callback) final;
54 void Flush(const FlushCallback& callback) final; 54 void Flush(const FlushCallback& callback) final;
55 void StartPlayingFrom(base::TimeDelta time_delta) final; 55 void StartPlayingFrom(base::TimeDelta time_delta) final;
56 void SetPlaybackRate(double playback_rate) final; 56 void SetPlaybackRate(double playback_rate) final;
57 void SetVolume(float volume) final; 57 void SetVolume(float volume) final;
58 void SetCdm(int32_t cdm_id, const SetCdmCallback& callback) final; 58 void SetCdm(int32_t cdm_id, const SetCdmCallback& callback) final;
59 59
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 base::WeakPtr<MojoCdmServiceContext> mojo_cdm_service_context_; 103 base::WeakPtr<MojoCdmServiceContext> mojo_cdm_service_context_;
104 104
105 State state_; 105 State state_;
106 double playback_rate_; 106 double playback_rate_;
107 107
108 std::unique_ptr<DemuxerStreamProvider> stream_provider_; 108 std::unique_ptr<DemuxerStreamProvider> stream_provider_;
109 109
110 base::RepeatingTimer time_update_timer_; 110 base::RepeatingTimer time_update_timer_;
111 base::TimeDelta last_media_time_; 111 base::TimeDelta last_media_time_;
112 112
113 mojom::RendererClientPtr client_; 113 mojom::RendererClientAssociatedPtr client_;
114 114
115 // Hold a reference to the CDM set on the |renderer_| so that the CDM won't be 115 // Hold a reference to the CDM set on the |renderer_| so that the CDM won't be
116 // destructed while the |renderer_| is still using it. 116 // destructed while the |renderer_| is still using it.
117 scoped_refptr<MediaKeys> cdm_; 117 scoped_refptr<MediaKeys> cdm_;
118 118
119 // Audio and Video sinks. 119 // Audio and Video sinks.
120 // May be null if underlying |renderer_| does not use them. 120 // May be null if underlying |renderer_| does not use them.
121 scoped_refptr<AudioRendererSink> audio_sink_; 121 scoped_refptr<AudioRendererSink> audio_sink_;
122 std::unique_ptr<VideoRendererSink> video_sink_; 122 std::unique_ptr<VideoRendererSink> video_sink_;
123 123
124 // Note: Destroy |renderer_| first to avoid access violation into other 124 // Note: Destroy |renderer_| first to avoid access violation into other
125 // members, e.g. |stream_provider_|, |cdm_|, |audio_sink_|, and 125 // members, e.g. |stream_provider_|, |cdm_|, |audio_sink_|, and
126 // |video_sink_|. 126 // |video_sink_|.
127 // Must use "media::" because "Renderer" is ambiguous. 127 // Must use "media::" because "Renderer" is ambiguous.
128 std::unique_ptr<media::Renderer> renderer_; 128 std::unique_ptr<media::Renderer> renderer_;
129 129
130 base::WeakPtr<MojoRendererService> weak_this_; 130 base::WeakPtr<MojoRendererService> weak_this_;
131 base::WeakPtrFactory<MojoRendererService> weak_factory_; 131 base::WeakPtrFactory<MojoRendererService> weak_factory_;
132 132
133 DISALLOW_COPY_AND_ASSIGN(MojoRendererService); 133 DISALLOW_COPY_AND_ASSIGN(MojoRendererService);
134 }; 134 };
135 135
136 } // namespace media 136 } // namespace media
137 137
138 #endif // MEDIA_MOJO_SERVICES_MOJO_RENDERER_SERVICE_H_ 138 #endif // MEDIA_MOJO_SERVICES_MOJO_RENDERER_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698