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

Side by Side Diff: media/base/android/media_source_player.h

Issue 1407933010: media: Make MediaKeys ref-counted. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase only Created 5 years, 1 month 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
« no previous file with comments | « media/base/android/media_player_android.cc ('k') | media/base/android/media_source_player.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_
6 #define MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ 6 #define MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 void SetVolume(double volume) override; 56 void SetVolume(double volume) override;
57 int GetVideoWidth() override; 57 int GetVideoWidth() override;
58 int GetVideoHeight() override; 58 int GetVideoHeight() override;
59 base::TimeDelta GetCurrentTime() override; 59 base::TimeDelta GetCurrentTime() override;
60 base::TimeDelta GetDuration() override; 60 base::TimeDelta GetDuration() override;
61 bool IsPlaying() override; 61 bool IsPlaying() override;
62 bool CanPause() override; 62 bool CanPause() override;
63 bool CanSeekForward() override; 63 bool CanSeekForward() override;
64 bool CanSeekBackward() override; 64 bool CanSeekBackward() override;
65 bool IsPlayerReady() override; 65 bool IsPlayerReady() override;
66 void SetCdm(BrowserCdm* cdm) override; 66 void SetCdm(const scoped_refptr<MediaKeys>& cdm) override;
67 67
68 // DemuxerAndroidClient implementation. 68 // DemuxerAndroidClient implementation.
69 void OnDemuxerConfigsAvailable(const DemuxerConfigs& params) override; 69 void OnDemuxerConfigsAvailable(const DemuxerConfigs& params) override;
70 void OnDemuxerDataAvailable(const DemuxerData& params) override; 70 void OnDemuxerDataAvailable(const DemuxerData& params) override;
71 void OnDemuxerSeekDone(base::TimeDelta actual_browser_seek_time) override; 71 void OnDemuxerSeekDone(base::TimeDelta actual_browser_seek_time) override;
72 void OnDemuxerDurationChanged(base::TimeDelta duration) override; 72 void OnDemuxerDurationChanged(base::TimeDelta duration) override;
73 73
74 private: 74 private:
75 friend class MediaSourcePlayerTest; 75 friend class MediaSourcePlayerTest;
76 76
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // Called when the demuxer config changes. 158 // Called when the demuxer config changes.
159 void OnDemuxerConfigsChanged(); 159 void OnDemuxerConfigsChanged();
160 160
161 // Called when new decryption key becomes available. 161 // Called when new decryption key becomes available.
162 void OnKeyAdded(); 162 void OnKeyAdded();
163 163
164 // Called to resume playback after NO_KEY is received, but a new key is 164 // Called to resume playback after NO_KEY is received, but a new key is
165 // available. 165 // available.
166 void ResumePlaybackAfterKeyAdded(); 166 void ResumePlaybackAfterKeyAdded();
167 167
168 // Called when the CDM is detached.
169 void OnCdmUnset();
170
171 // Test-only method to setup hook for the completion of the next decode cycle. 168 // Test-only method to setup hook for the completion of the next decode cycle.
172 // This callback state is cleared when it is next run. 169 // This callback state is cleared when it is next run.
173 // Prevent usage creep by only calling this from the 170 // Prevent usage creep by only calling this from the
174 // ReleaseWithOnPrefetchDoneAlreadyPosted MediaSourcePlayerTest. 171 // ReleaseWithOnPrefetchDoneAlreadyPosted MediaSourcePlayerTest.
175 void set_decode_callback_for_testing(const base::Closure& test_decode_cb) { 172 void set_decode_callback_for_testing(const base::Closure& test_decode_cb) {
176 decode_callback_for_testing_ = test_decode_cb; 173 decode_callback_for_testing_ = test_decode_cb;
177 } 174 }
178 175
179 // Please keep this in sync with |kPendingEventNames| in GetEventName(). 176 // Please keep this in sync with |kPendingEventNames| in GetEventName().
180 enum PendingEventFlags { 177 enum PendingEventFlags {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 235
239 // Track the most recent preroll target. Decoder re-creation needs this to 236 // Track the most recent preroll target. Decoder re-creation needs this to
240 // resume any in-progress preroll. 237 // resume any in-progress preroll.
241 base::TimeDelta preroll_timestamp_; 238 base::TimeDelta preroll_timestamp_;
242 239
243 // A cancelable task that is posted when the audio decoder starts requesting 240 // A cancelable task that is posted when the audio decoder starts requesting
244 // new data. This callback runs if no data arrives before the timeout period 241 // new data. This callback runs if no data arrives before the timeout period
245 // elapses. 242 // elapses.
246 base::CancelableClosure decoder_starvation_callback_; 243 base::CancelableClosure decoder_starvation_callback_;
247 244
248 MediaDrmBridge* drm_bridge_; 245 // Holds a ref-count to the CDM.
246 scoped_refptr<MediaKeys> cdm_;
247
249 int cdm_registration_id_; 248 int cdm_registration_id_;
250 249
251 // No decryption key available to decrypt the encrypted buffer. In this case, 250 // No decryption key available to decrypt the encrypted buffer. In this case,
252 // the player should pause. When a new key is added (OnKeyAdded()), we should 251 // the player should pause. When a new key is added (OnKeyAdded()), we should
253 // try to start playback again. 252 // try to start playback again.
254 bool is_waiting_for_key_; 253 bool is_waiting_for_key_;
255 254
256 // Indicates the situation where new key is added during pending decode 255 // Indicates the situation where new key is added during pending decode
257 // (this variable can only be set when *_decoder_job_->is_decoding()). If this 256 // (this variable can only be set when *_decoder_job_->is_decoding()). If this
258 // variable is true and MEDIA_CODEC_NO_KEY is returned then we need to try 257 // variable is true and MEDIA_CODEC_NO_KEY is returned then we need to try
(...skipping 20 matching lines...) Expand all
279 base::WeakPtr<MediaSourcePlayer> weak_this_; 278 base::WeakPtr<MediaSourcePlayer> weak_this_;
280 // NOTE: Weak pointers must be invalidated before all other member variables. 279 // NOTE: Weak pointers must be invalidated before all other member variables.
281 base::WeakPtrFactory<MediaSourcePlayer> weak_factory_; 280 base::WeakPtrFactory<MediaSourcePlayer> weak_factory_;
282 281
283 DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayer); 282 DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayer);
284 }; 283 };
285 284
286 } // namespace media 285 } // namespace media
287 286
288 #endif // MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ 287 #endif // MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_
OLDNEW
« no previous file with comments | « media/base/android/media_player_android.cc ('k') | media/base/android/media_source_player.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698