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

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

Issue 51613002: Abort MSP::OnPrefetchDone() if just after MSP::Release(). Let seek and config change survive. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments and nits from PS7 Created 7 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 | Annotate | Revision Log
« no previous file with comments | « media/base/android/media_decoder_job.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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // Helper function to determine whether a protected surface is needed for 147 // Helper function to determine whether a protected surface is needed for
148 // video playback. 148 // video playback.
149 bool IsProtectedSurfaceRequired(); 149 bool IsProtectedSurfaceRequired();
150 150
151 // Called when a MediaDecoderJob finishes prefetching data. Once all 151 // Called when a MediaDecoderJob finishes prefetching data. Once all
152 // MediaDecoderJobs have prefetched data, then this method updates 152 // MediaDecoderJobs have prefetched data, then this method updates
153 // |start_time_ticks_| and |start_presentation_timestamp_| so that video can 153 // |start_time_ticks_| and |start_presentation_timestamp_| so that video can
154 // resync with audio and starts decoding. 154 // resync with audio and starts decoding.
155 void OnPrefetchDone(); 155 void OnPrefetchDone();
156 156
157 // Test-only method to setup hook for the completion of the next decode cycle.
158 // This callback state is cleared when it is next run.
159 // Prevent usage creep by only calling this from the
160 // ReleaseWithOnPrefetchDoneAlreadyPosted MediaSourcePlayerTest.
161 void set_decode_callback_for_testing(const base::Closure& test_decode_cb) {
162 decode_callback_for_testing_ = test_decode_cb;
163 }
164
165 // TODO(qinmin/wolenetz): Reorder these based on their priority from
166 // ProcessPendingEvents(). Release() and other routines are dependent upon
167 // priority consistency.
157 enum PendingEventFlags { 168 enum PendingEventFlags {
158 NO_EVENT_PENDING = 0, 169 NO_EVENT_PENDING = 0,
159 SEEK_EVENT_PENDING = 1 << 0, 170 SEEK_EVENT_PENDING = 1 << 0,
160 SURFACE_CHANGE_EVENT_PENDING = 1 << 1, 171 SURFACE_CHANGE_EVENT_PENDING = 1 << 1,
161 CONFIG_CHANGE_EVENT_PENDING = 1 << 2, 172 CONFIG_CHANGE_EVENT_PENDING = 1 << 2,
162 PREFETCH_REQUEST_EVENT_PENDING = 1 << 3, 173 PREFETCH_REQUEST_EVENT_PENDING = 1 << 3,
163 PREFETCH_DONE_EVENT_PENDING = 1 << 4, 174 PREFETCH_DONE_EVENT_PENDING = 1 << 4,
164 }; 175 };
165 176
166 static const char* GetEventName(PendingEventFlags event); 177 static const char* GetEventName(PendingEventFlags event);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 // Weak pointer passed to media decoder jobs for callbacks. 261 // Weak pointer passed to media decoder jobs for callbacks.
251 base::WeakPtrFactory<MediaSourcePlayer> weak_this_; 262 base::WeakPtrFactory<MediaSourcePlayer> weak_this_;
252 263
253 MediaDrmBridge* drm_bridge_; 264 MediaDrmBridge* drm_bridge_;
254 265
255 // No decryption key available to decrypt the encrypted buffer. In this case, 266 // No decryption key available to decrypt the encrypted buffer. In this case,
256 // the player should pause. When a new key is added (OnKeyAdded()), we should 267 // the player should pause. When a new key is added (OnKeyAdded()), we should
257 // try to start playback again. 268 // try to start playback again.
258 bool is_waiting_for_key_; 269 bool is_waiting_for_key_;
259 270
271 // Test-only callback for hooking the completion of the next decode cycle.
272 base::Closure decode_callback_for_testing_;
273
260 friend class MediaSourcePlayerTest; 274 friend class MediaSourcePlayerTest;
261 DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayer); 275 DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayer);
262 }; 276 };
263 277
264 } // namespace media 278 } // namespace media
265 279
266 #endif // MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ 280 #endif // MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_
OLDNEW
« no previous file with comments | « media/base/android/media_decoder_job.cc ('k') | media/base/android/media_source_player.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698