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

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

Issue 15898002: Fix various MediaSource related crashes on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make Destroy() public and remove friend decl to make compiler happy Created 7 years, 7 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 (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 #include "media/base/android/media_source_player.h" 5 #include "media/base/android/media_source_player.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 sampling_rate_(0), 201 sampling_rate_(0),
202 seekable_(true), 202 seekable_(true),
203 audio_finished_(true), 203 audio_finished_(true),
204 video_finished_(true), 204 video_finished_(true),
205 playing_(false), 205 playing_(false),
206 audio_access_unit_index_(0), 206 audio_access_unit_index_(0),
207 video_access_unit_index_(0), 207 video_access_unit_index_(0),
208 waiting_for_audio_data_(false), 208 waiting_for_audio_data_(false),
209 waiting_for_video_data_(false), 209 waiting_for_video_data_(false),
210 weak_this_(this) { 210 weak_this_(this) {
211 OnMediaMetadataChanged(duration_, width_, height_, false);
212 } 211 }
213 212
214 MediaSourcePlayer::~MediaSourcePlayer() { 213 MediaSourcePlayer::~MediaSourcePlayer() {
215 Release(); 214 Release();
216 } 215 }
217 216
218 void MediaSourcePlayer::SetVideoSurface(jobject surface) { 217 void MediaSourcePlayer::SetVideoSurface(jobject surface) {
219 video_decoder_job_.reset(); 218 video_decoder_job_.reset();
220 if (!surface) { 219 if (!surface) {
221 return; 220 return;
222 } 221 }
223 222
224 video_decoder_job_.reset(new VideoDecoderJob( 223 if (HasVideo()) {
225 base::MessageLoopProxy::current(), video_codec_, 224 video_decoder_job_.reset(new VideoDecoderJob(
226 gfx::Size(width_, height_), surface)); 225 base::MessageLoopProxy::current(), video_codec_,
226 gfx::Size(width_, height_), surface));
227 }
227 228
228 if (pending_play_) 229 if (pending_play_)
229 StartInternal(); 230 StartInternal();
230 231
231 // Inform the fullscreen view the player is ready. 232 // Inform the fullscreen view the player is ready.
232 // TODO(qinmin): refactor MediaPlayerBridge so that we have a better way 233 // TODO(qinmin): refactor MediaPlayerBridge so that we have a better way
233 // to inform ContentVideoView. 234 // to inform ContentVideoView.
234 OnMediaMetadataChanged(duration_, width_, height_, true); 235 OnMediaMetadataChanged(duration_, width_, height_, true);
235 } 236 }
236 237
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 453
453 bool MediaSourcePlayer::HasVideo() { 454 bool MediaSourcePlayer::HasVideo() {
454 return kUnknownVideoCodec != video_codec_; 455 return kUnknownVideoCodec != video_codec_;
455 } 456 }
456 457
457 bool MediaSourcePlayer::HasAudio() { 458 bool MediaSourcePlayer::HasAudio() {
458 return kUnknownAudioCodec != audio_codec_; 459 return kUnknownAudioCodec != audio_codec_;
459 } 460 }
460 461
461 } // namespace media 462 } // namespace media
OLDNEW
« no previous file with comments | « media/base/android/demuxer_stream_player_params.cc ('k') | webkit/media/android/media_source_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698