diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-08 21:26:39 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-08 21:26:39 +0000 |
commit | 6c37af55bd6636da96748d4ebc51ad6a691d6435 (patch) | |
tree | 445c9a54ef27c1ef1fdffa5a5aa32306ad32f26a /chrome/renderer | |
parent | a48f7c80c9aa6b3555f062fb950db2e510e2f21a (diff) | |
download | chromium_src-6c37af55bd6636da96748d4ebc51ad6a691d6435.zip chromium_src-6c37af55bd6636da96748d4ebc51ad6a691d6435.tar.gz chromium_src-6c37af55bd6636da96748d4ebc51ad6a691d6435.tar.bz2 |
Remove width_ and height_ from various VideoDecoder implementations.
Updated unit tests as well.
BUG=none
TEST=media_unittests
Review URL: http://codereview.chromium.org/6624068
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77336 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/media/ipc_video_decoder.cc | 27 | ||||
-rw-r--r-- | chrome/renderer/media/ipc_video_decoder.h | 4 |
2 files changed, 17 insertions, 14 deletions
diff --git a/chrome/renderer/media/ipc_video_decoder.cc b/chrome/renderer/media/ipc_video_decoder.cc index 89c980d..a285970 100644 --- a/chrome/renderer/media/ipc_video_decoder.cc +++ b/chrome/renderer/media/ipc_video_decoder.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -20,9 +20,7 @@ IpcVideoDecoder::IpcVideoDecoder(MessageLoop* message_loop, ggl::Context* ggl_context) - : width_(0), - height_(0), - decode_context_message_loop_(message_loop), + : decode_context_message_loop_(message_loop), ggl_context_(ggl_context) { } @@ -47,15 +45,22 @@ void IpcVideoDecoder::Initialize(media::DemuxerStream* demuxer_stream, // Get the AVStream by querying for the provider interface. media::AVStreamProvider* av_stream_provider; if (!demuxer_stream->QueryInterface(&av_stream_provider)) { - host()->SetError(media::PIPELINE_ERROR_DECODE); - callback->Run(); - delete callback; + media::VideoCodecInfo info = {0}; + OnInitializeComplete(info); return; } AVStream* av_stream = av_stream_provider->GetAVStream(); - width_ = av_stream->codec->width; - height_ = av_stream->codec->height; + + int width = av_stream->codec->width; + int height = av_stream->codec->height; + if (width > media::Limits::kMaxDimension || + height > media::Limits::kMaxDimension || + (width * height) > media::Limits::kMaxCanvas) { + media::VideoCodecInfo info = {0}; + OnInitializeComplete(info); + return; + } // Create a video decode context that assocates with the graphics // context. @@ -69,8 +74,8 @@ void IpcVideoDecoder::Initialize(media::DemuxerStream* demuxer_stream, // Initialize hardware decoder. media::VideoCodecConfig param; memset(¶m, 0, sizeof(param)); - param.width = width_; - param.height = height_; + param.width = width; + param.height = height; // VideoDecodeEngine will perform initialization on the message loop // given to it so it doesn't matter on which thread we are calling this. diff --git a/chrome/renderer/media/ipc_video_decoder.h b/chrome/renderer/media/ipc_video_decoder.h index 85627244..63702fa 100644 --- a/chrome/renderer/media/ipc_video_decoder.h +++ b/chrome/renderer/media/ipc_video_decoder.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -57,8 +57,6 @@ class IpcVideoDecoder : public media::VideoDecoder, void OnReadComplete(media::Buffer* buffer); void OnDestroyComplete(); - int32 width_; - int32 height_; media::MediaFormat media_format_; scoped_ptr<media::FilterCallback> flush_callback_; |