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

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

Issue 2230583002: Add MediaPlayerRenderer/MediaPlayerRendererClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added MEDIA_EXPORT. Created 4 years, 4 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
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/timer/timer.h" 16 #include "base/timer/timer.h"
17 #include "media/base/buffering_state.h" 17 #include "media/base/buffering_state.h"
18 #include "media/base/demuxer_stream_provider.h"
18 #include "media/base/pipeline_status.h" 19 #include "media/base/pipeline_status.h"
19 #include "media/base/renderer_client.h" 20 #include "media/base/renderer_client.h"
20 #include "media/mojo/interfaces/renderer.mojom.h" 21 #include "media/mojo/interfaces/renderer.mojom.h"
21 #include "media/mojo/services/media_mojo_export.h" 22 #include "media/mojo/services/media_mojo_export.h"
22 #include "mojo/public/cpp/bindings/strong_binding.h" 23 #include "mojo/public/cpp/bindings/strong_binding.h"
23 24
24 namespace media { 25 namespace media {
25 26
26 class DemuxerStreamProviderShim; 27 class DemuxerStreamProviderShim;
27 class MediaKeys; 28 class MediaKeys;
(...skipping 11 matching lines...) Expand all
39 MojoRendererService( 40 MojoRendererService(
40 base::WeakPtr<MojoCdmServiceContext> mojo_cdm_service_context, 41 base::WeakPtr<MojoCdmServiceContext> mojo_cdm_service_context,
41 std::unique_ptr<media::Renderer> renderer, 42 std::unique_ptr<media::Renderer> renderer,
42 mojo::InterfaceRequest<mojom::Renderer> request); 43 mojo::InterfaceRequest<mojom::Renderer> request);
43 ~MojoRendererService() final; 44 ~MojoRendererService() final;
44 45
45 // mojom::Renderer implementation. 46 // mojom::Renderer implementation.
46 void Initialize(mojom::RendererClientPtr client, 47 void Initialize(mojom::RendererClientPtr client,
47 mojom::DemuxerStreamPtr audio, 48 mojom::DemuxerStreamPtr audio,
48 mojom::DemuxerStreamPtr video, 49 mojom::DemuxerStreamPtr video,
50 const base::Optional<GURL>& url,
49 const InitializeCallback& callback) final; 51 const InitializeCallback& callback) final;
50 void Flush(const FlushCallback& callback) final; 52 void Flush(const FlushCallback& callback) final;
51 void StartPlayingFrom(int64_t time_delta_usec) final; 53 void StartPlayingFrom(int64_t time_delta_usec) final;
52 void SetPlaybackRate(double playback_rate) final; 54 void SetPlaybackRate(double playback_rate) final;
53 void SetVolume(float volume) final; 55 void SetVolume(float volume) final;
54 void SetCdm(int32_t cdm_id, const SetCdmCallback& callback) final; 56 void SetCdm(int32_t cdm_id, const SetCdmCallback& callback) final;
55 57
56 private: 58 private:
57 enum State { 59 enum State {
58 STATE_UNINITIALIZED, 60 STATE_UNINITIALIZED,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 void OnCdmAttached(scoped_refptr<MediaKeys> cdm, 95 void OnCdmAttached(scoped_refptr<MediaKeys> cdm,
94 const base::Callback<void(bool)>& callback, 96 const base::Callback<void(bool)>& callback,
95 bool success); 97 bool success);
96 98
97 mojo::StrongBinding<mojom::Renderer> binding_; 99 mojo::StrongBinding<mojom::Renderer> binding_;
98 100
99 base::WeakPtr<MojoCdmServiceContext> mojo_cdm_service_context_; 101 base::WeakPtr<MojoCdmServiceContext> mojo_cdm_service_context_;
100 102
101 State state_; 103 State state_;
102 104
103 std::unique_ptr<DemuxerStreamProviderShim> stream_provider_; 105 std::unique_ptr<DemuxerStreamProvider> stream_provider_;
104 106
105 base::RepeatingTimer time_update_timer_; 107 base::RepeatingTimer time_update_timer_;
106 int64_t last_media_time_usec_; 108 int64_t last_media_time_usec_;
107 109
108 mojom::RendererClientPtr client_; 110 mojom::RendererClientPtr client_;
109 111
110 // Hold a reference to the CDM set on the |renderer_| so that the CDM won't be 112 // Hold a reference to the CDM set on the |renderer_| so that the CDM won't be
111 // destructed while the |renderer_| is still using it. 113 // destructed while the |renderer_| is still using it.
112 scoped_refptr<MediaKeys> cdm_; 114 scoped_refptr<MediaKeys> cdm_;
113 115
114 // Note: Destroy |renderer_| first to avoid access violation into other 116 // Note: Destroy |renderer_| first to avoid access violation into other
115 // members, e.g. |stream_provider_| and |cdm_|. 117 // members, e.g. |stream_provider_| and |cdm_|.
116 // Must use "media::" because "Renderer" is ambiguous. 118 // Must use "media::" because "Renderer" is ambiguous.
117 std::unique_ptr<media::Renderer> renderer_; 119 std::unique_ptr<media::Renderer> renderer_;
118 120
119 base::WeakPtr<MojoRendererService> weak_this_; 121 base::WeakPtr<MojoRendererService> weak_this_;
120 base::WeakPtrFactory<MojoRendererService> weak_factory_; 122 base::WeakPtrFactory<MojoRendererService> weak_factory_;
121 123
122 DISALLOW_COPY_AND_ASSIGN(MojoRendererService); 124 DISALLOW_COPY_AND_ASSIGN(MojoRendererService);
123 }; 125 };
124 126
125 } // namespace media 127 } // namespace media
126 128
127 #endif // MEDIA_MOJO_SERVICES_MOJO_RENDERER_SERVICE_H_ 129 #endif // MEDIA_MOJO_SERVICES_MOJO_RENDERER_SERVICE_H_
OLDNEW
« no previous file with comments | « media/mojo/services/media_mojo_unittest.cc ('k') | media/mojo/services/mojo_renderer_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698