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

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

Issue 643703009: MediaSourcePlayer: Handle the case where key is added during decoding. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 | « no previous file | 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // |start_time_ticks_| and |start_presentation_timestamp_| so that video can 155 // |start_time_ticks_| and |start_presentation_timestamp_| so that video can
156 // resync with audio and starts decoding. 156 // resync with audio and starts decoding.
157 void OnPrefetchDone(); 157 void OnPrefetchDone();
158 158
159 // Called when the demuxer config changes. 159 // Called when the demuxer config changes.
160 void OnDemuxerConfigsChanged(); 160 void OnDemuxerConfigsChanged();
161 161
162 // Called when new decryption key becomes available. 162 // Called when new decryption key becomes available.
163 void OnKeyAdded(); 163 void OnKeyAdded();
164 164
165 // Called to resume playback after NO_KEY is received, but a new key is
166 // available.
167 void ResumePlaybackAfterKeyAdded();
168
165 // Called when the CDM is detached. 169 // Called when the CDM is detached.
166 void OnCdmUnset(); 170 void OnCdmUnset();
167 171
168 // Test-only method to setup hook for the completion of the next decode cycle. 172 // Test-only method to setup hook for the completion of the next decode cycle.
169 // This callback state is cleared when it is next run. 173 // This callback state is cleared when it is next run.
170 // Prevent usage creep by only calling this from the 174 // Prevent usage creep by only calling this from the
171 // ReleaseWithOnPrefetchDoneAlreadyPosted MediaSourcePlayerTest. 175 // ReleaseWithOnPrefetchDoneAlreadyPosted MediaSourcePlayerTest.
172 void set_decode_callback_for_testing(const base::Closure& test_decode_cb) { 176 void set_decode_callback_for_testing(const base::Closure& test_decode_cb) {
173 decode_callback_for_testing_ = test_decode_cb; 177 decode_callback_for_testing_ = test_decode_cb;
174 } 178 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 base::CancelableClosure decoder_starvation_callback_; 247 base::CancelableClosure decoder_starvation_callback_;
244 248
245 MediaDrmBridge* drm_bridge_; 249 MediaDrmBridge* drm_bridge_;
246 int cdm_registration_id_; 250 int cdm_registration_id_;
247 251
248 // No decryption key available to decrypt the encrypted buffer. In this case, 252 // No decryption key available to decrypt the encrypted buffer. In this case,
249 // the player should pause. When a new key is added (OnKeyAdded()), we should 253 // the player should pause. When a new key is added (OnKeyAdded()), we should
250 // try to start playback again. 254 // try to start playback again.
251 bool is_waiting_for_key_; 255 bool is_waiting_for_key_;
252 256
257 // Indicates the situation where new key is added during pending decode
258 // (this variable can only be set when *_decoder_job_->is_decoding()). If this
259 // variable is true and MEDIA_CODEC_NO_KEY is returned then we need to try
260 // decoding again in case the newly added key is the correct decryption key.
261 bool key_added_while_decode_pending_;
262
253 // Indicates whether the player is waiting for audio or video decoder to be 263 // Indicates whether the player is waiting for audio or video decoder to be
254 // created. This could happen if video surface is not available or key is 264 // created. This could happen if video surface is not available or key is
255 // not added. 265 // not added.
256 bool is_waiting_for_audio_decoder_; 266 bool is_waiting_for_audio_decoder_;
257 bool is_waiting_for_video_decoder_; 267 bool is_waiting_for_video_decoder_;
258 268
259 // Test-only callback for hooking the completion of the next decode cycle. 269 // Test-only callback for hooking the completion of the next decode cycle.
260 base::Closure decode_callback_for_testing_; 270 base::Closure decode_callback_for_testing_;
261 271
262 // Whether audio or video decoder is in the process of prerolling. 272 // Whether audio or video decoder is in the process of prerolling.
263 bool prerolling_; 273 bool prerolling_;
264 274
265 // Weak pointer passed to media decoder jobs for callbacks. 275 // Weak pointer passed to media decoder jobs for callbacks.
266 // NOTE: Weak pointers must be invalidated before all other member variables. 276 // NOTE: Weak pointers must be invalidated before all other member variables.
267 base::WeakPtrFactory<MediaSourcePlayer> weak_factory_; 277 base::WeakPtrFactory<MediaSourcePlayer> weak_factory_;
268 base::WeakPtr<MediaSourcePlayer> weak_this_; 278 base::WeakPtr<MediaSourcePlayer> weak_this_;
269 279
270 DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayer); 280 DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayer);
271 }; 281 };
272 282
273 } // namespace media 283 } // namespace media
274 284
275 #endif // MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ 285 #endif // MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/android/media_source_player.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698