summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorfischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-10 04:38:56 +0000
committerfischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-10 04:38:56 +0000
commitbf424edf6b8ac7cf26b6537ff72c786ebabaa751 (patch)
tree51d698ca54e77b7b6253299c0c9b383db1daf048 /media
parentd90579d1532a3b8736bfd68de450c54e0b3d741f (diff)
downloadchromium_src-bf424edf6b8ac7cf26b6537ff72c786ebabaa751.zip
chromium_src-bf424edf6b8ac7cf26b6537ff72c786ebabaa751.tar.gz
chromium_src-bf424edf6b8ac7cf26b6537ff72c786ebabaa751.tar.bz2
Fix crash in UMA-reporting aspect ratio when video height is zero.
Also fixed a DCHECK that gets triggered in the same case (audio renderer is destroyed without ever having been created, so DCHECK_NE(stream_id_, 0) was failing). BUG=103552 TEST=failing video stops crashing renderer Review URL: http://codereview.chromium.org/8510017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109379 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/base/video_decoder_config.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/media/base/video_decoder_config.cc b/media/base/video_decoder_config.cc
index 06f4664..304dd61 100644
--- a/media/base/video_decoder_config.cc
+++ b/media/base/video_decoder_config.cc
@@ -40,12 +40,16 @@ VideoDecoderConfig::VideoDecoderConfig(VideoCodec codec,
VideoDecoderConfig::~VideoDecoderConfig() {}
+// Some videos just want to watch the world burn, with a height of 0; cap the
+// "infinite" aspect ratio resulting.
+static const int kInfiniteRatio = 99999;
+
// Common aspect ratios (multiplied by 100 and truncated) used for histogramming
// video sizes. These were taken on 20111103 from
// http://wikipedia.org/wiki/Aspect_ratio_(image)#Previous_and_currently_used_aspect_ratios
static const int kCommonAspectRatios100[] = {
100, 115, 133, 137, 143, 150, 155, 160, 166, 175, 177, 185, 200, 210, 220,
- 221, 235, 237, 240, 255, 259, 266, 276, 293, 400, 1200,
+ 221, 235, 237, 240, 255, 259, 266, 276, 293, 400, 1200, kInfiniteRatio,
};
template<class T> // T has int width() & height() methods.
@@ -53,7 +57,7 @@ static void UmaHistogramAspectRatio(const char* name, const T& size) {
UMA_HISTOGRAM_CUSTOM_ENUMERATION(
name,
// Intentionally use integer division to truncate the result.
- (size.width() * 100) / size.height(),
+ size.height() ? (size.width() * 100) / size.height() : kInfiniteRatio,
base::CustomHistogram::ArrayToCustomRanges(
kCommonAspectRatios100, arraysize(kCommonAspectRatios100)));
}