summaryrefslogtreecommitdiffstats
path: root/media/base
diff options
context:
space:
mode:
authoracolwell@chromium.org <acolwell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-23 14:27:19 +0000
committeracolwell@chromium.org <acolwell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-23 14:27:19 +0000
commit5f4ae9c1f8f2b9263cbc68a2e451ff6c13f8296c (patch)
treebdc586fab34ec7ab828f835f14533b3fd7f5b2d6 /media/base
parent026230b3600dade8513a939f1fa05241e8a6b0d5 (diff)
downloadchromium_src-5f4ae9c1f8f2b9263cbc68a2e451ff6c13f8296c.zip
chromium_src-5f4ae9c1f8f2b9263cbc68a2e451ff6c13f8296c.tar.gz
chromium_src-5f4ae9c1f8f2b9263cbc68a2e451ff6c13f8296c.tar.bz2
Fix various MediaSource related crashes on Android.
This change fixes several issues that were causing crashes. - MediaPlayerHostMsg_DemuxerReady_Params was not initializing the xxx_codec member variables so audio-only or video-only content would randomly be flagged as A/V content with a random codec ID. - ChunkDemuxer::Stop() was not being called which could cause the delegate to be accessed after it was destroyed. - MediaSourceDelegate was signalling that it had metadata before the ChunkDemuxer was even initialized. This caused the HTMLMediaElement to signal that the load completed way too early and caused play() to be called when the delegate wasn't ready. BUG=233420 TEST=webkitmediasource-play.html LayoutTest reliably runs w/o crashing now. Review URL: https://chromiumcodereview.appspot.com/15754004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201791 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base')
-rw-r--r--media/base/android/demuxer_stream_player_params.cc4
-rw-r--r--media/base/android/media_source_player.cc9
2 files changed, 8 insertions, 5 deletions
diff --git a/media/base/android/demuxer_stream_player_params.cc b/media/base/android/demuxer_stream_player_params.cc
index ab9fcaf..3ed1a8c 100644
--- a/media/base/android/demuxer_stream_player_params.cc
+++ b/media/base/android/demuxer_stream_player_params.cc
@@ -8,9 +8,11 @@ namespace media {
MediaPlayerHostMsg_DemuxerReady_Params::
MediaPlayerHostMsg_DemuxerReady_Params()
- : audio_channels(0),
+ : audio_codec(kUnknownAudioCodec),
+ audio_channels(0),
audio_sampling_rate(0),
is_audio_encrypted(false),
+ video_codec(kUnknownVideoCodec),
is_video_encrypted(false),
duration_ms(0) {}
diff --git a/media/base/android/media_source_player.cc b/media/base/android/media_source_player.cc
index b29d182..f6cbd48 100644
--- a/media/base/android/media_source_player.cc
+++ b/media/base/android/media_source_player.cc
@@ -208,7 +208,6 @@ MediaSourcePlayer::MediaSourcePlayer(
waiting_for_audio_data_(false),
waiting_for_video_data_(false),
weak_this_(this) {
- OnMediaMetadataChanged(duration_, width_, height_, false);
}
MediaSourcePlayer::~MediaSourcePlayer() {
@@ -221,9 +220,11 @@ void MediaSourcePlayer::SetVideoSurface(jobject surface) {
return;
}
- video_decoder_job_.reset(new VideoDecoderJob(
- base::MessageLoopProxy::current(), video_codec_,
- gfx::Size(width_, height_), surface));
+ if (HasVideo()) {
+ video_decoder_job_.reset(new VideoDecoderJob(
+ base::MessageLoopProxy::current(), video_codec_,
+ gfx::Size(width_, height_), surface));
+ }
if (pending_play_)
StartInternal();