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

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

Issue 1372203002: Throttle media decoding after excessive Android media server crashes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: new infobar text per UI review Created 5 years, 2 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_CODEC_PLAYER_H_ 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_CODEC_PLAYER_H_
6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_PLAYER_H_ 6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_PLAYER_H_
7 7
8 #include "base/android/scoped_java_ref.h" 8 #include "base/android/scoped_java_ref.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 // For testing only. 179 // For testing only.
180 typedef base::Callback<void(DemuxerStream::Type, 180 typedef base::Callback<void(DemuxerStream::Type,
181 base::TimeDelta, 181 base::TimeDelta,
182 base::TimeDelta)> DecodersTimeCallback; 182 base::TimeDelta)> DecodersTimeCallback;
183 183
184 // For testing only. 184 // For testing only.
185 typedef base::Callback<void(DemuxerStream::Type)> CodecCreatedCallback; 185 typedef base::Callback<void(DemuxerStream::Type)> CodecCreatedCallback;
186 186
187 // Constructs a player with the given ID and demuxer. |manager| must outlive 187 // Constructs a player with the given ID and demuxer. |manager| must outlive
188 // the lifetime of this object. 188 // the lifetime of this object.
189 MediaCodecPlayer(int player_id, 189 MediaCodecPlayer(
190 base::WeakPtr<MediaPlayerManager> manager, 190 int player_id,
191 const RequestMediaResourcesCB& request_media_resources_cb, 191 base::WeakPtr<MediaPlayerManager> manager,
192 scoped_ptr<DemuxerAndroid> demuxer, 192 const OnDecoderResourcesReleasedCB& on_decoder_resources_released_cb,
193 const GURL& frame_url); 193 scoped_ptr<DemuxerAndroid> demuxer,
194 const GURL& frame_url);
194 ~MediaCodecPlayer() override; 195 ~MediaCodecPlayer() override;
195 196
196 // A helper method that performs the media thread part of initialization. 197 // A helper method that performs the media thread part of initialization.
197 void Initialize(); 198 void Initialize();
198 199
199 // MediaPlayerAndroid implementation. 200 // MediaPlayerAndroid implementation.
200 void DeleteOnCorrectThread() override; 201 void DeleteOnCorrectThread() override;
201 void SetVideoSurface(gfx::ScopedJavaSurface surface) override; 202 void SetVideoSurface(gfx::ScopedJavaSurface surface) override;
202 void Start() override; 203 void Start() override;
203 void Pause(bool is_media_related_action) override; 204 void Pause(bool is_media_related_action) override;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 void OnStopDone(DemuxerStream::Type type); 291 void OnStopDone(DemuxerStream::Type type);
291 void OnMissingKeyReported(DemuxerStream::Type type); 292 void OnMissingKeyReported(DemuxerStream::Type type);
292 void OnError(); 293 void OnError();
293 void OnStarvation(DemuxerStream::Type stream_type); 294 void OnStarvation(DemuxerStream::Type stream_type);
294 void OnTimeIntervalUpdate(DemuxerStream::Type stream_type, 295 void OnTimeIntervalUpdate(DemuxerStream::Type stream_type,
295 base::TimeDelta now_playing, 296 base::TimeDelta now_playing,
296 base::TimeDelta last_buffered, 297 base::TimeDelta last_buffered,
297 bool postpone); 298 bool postpone);
298 299
299 // Callbacks from video decoder 300 // Callbacks from video decoder
300 void OnVideoCodecCreated();
301 void OnVideoResolutionChanged(const gfx::Size& size); 301 void OnVideoResolutionChanged(const gfx::Size& size);
302 302
303 // Callbacks from CDM 303 // Callbacks from CDM
304 void OnMediaCryptoReady(MediaDrmBridge::JavaObjectPtr media_crypto, 304 void OnMediaCryptoReady(MediaDrmBridge::JavaObjectPtr media_crypto,
305 bool needs_protected_surface); 305 bool needs_protected_surface);
306 void OnKeyAdded(); 306 void OnKeyAdded();
307 void OnCdmUnset(); 307 void OnCdmUnset();
308 308
309 // Operations called from the state machine. 309 // Operations called from the state machine.
310 void SetState(PlayerState new_state); 310 void SetState(PlayerState new_state);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 343
344 // Major components: demuxer, audio and video decoders. 344 // Major components: demuxer, audio and video decoders.
345 scoped_ptr<DemuxerAndroid> demuxer_; 345 scoped_ptr<DemuxerAndroid> demuxer_;
346 scoped_ptr<MediaCodecAudioDecoder> audio_decoder_; 346 scoped_ptr<MediaCodecAudioDecoder> audio_decoder_;
347 scoped_ptr<MediaCodecVideoDecoder> video_decoder_; 347 scoped_ptr<MediaCodecVideoDecoder> video_decoder_;
348 348
349 // The state of the state machine. 349 // The state of the state machine.
350 PlayerState state_; 350 PlayerState state_;
351 351
352 // Notification callbacks, they call MediaPlayerManager. 352 // Notification callbacks, they call MediaPlayerManager.
353 base::Closure request_resources_cb_;
354 TimeUpdateCallback time_update_cb_; 353 TimeUpdateCallback time_update_cb_;
355 base::Closure completion_cb_; 354 base::Closure completion_cb_;
356 base::Closure waiting_for_decryption_key_cb_; 355 base::Closure waiting_for_decryption_key_cb_;
357 SeekDoneCallback seek_done_cb_; 356 SeekDoneCallback seek_done_cb_;
358 ErrorCallback error_cb_; 357 ErrorCallback error_cb_;
359 358
360 // A callback that updates metadata cache and calls the manager. 359 // A callback that updates metadata cache and calls the manager.
361 MetadataChangedCallback metadata_changed_cb_; 360 MetadataChangedCallback metadata_changed_cb_;
362 361
363 // We call the base class' AttachListener() and DetachListener() methods on UI 362 // We call the base class' AttachListener() and DetachListener() methods on UI
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 base::WeakPtr<MediaCodecPlayer> media_weak_this_; 416 base::WeakPtr<MediaCodecPlayer> media_weak_this_;
418 // NOTE: Weak pointers must be invalidated before all other member variables. 417 // NOTE: Weak pointers must be invalidated before all other member variables.
419 base::WeakPtrFactory<MediaCodecPlayer> media_weak_factory_; 418 base::WeakPtrFactory<MediaCodecPlayer> media_weak_factory_;
420 419
421 DISALLOW_COPY_AND_ASSIGN(MediaCodecPlayer); 420 DISALLOW_COPY_AND_ASSIGN(MediaCodecPlayer);
422 }; 421 };
423 422
424 } // namespace media 423 } // namespace media
425 424
426 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_PLAYER_H_ 425 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_PLAYER_H_
OLDNEW
« no previous file with comments | « media/base/android/media_codec_decoder_unittest.cc ('k') | media/base/android/media_codec_player.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698