| Index: media/base/video_util.cc
|
| diff --git a/media/base/video_util.cc b/media/base/video_util.cc
|
| index 4476e6d0693e3934ec99f75392fcf610eba15ea1..db0e2d734bd0bde8f2a947e66f792d1ef3a4cb9c 100644
|
| --- a/media/base/video_util.cc
|
| +++ b/media/base/video_util.cc
|
| @@ -4,11 +4,31 @@
|
|
|
| #include "media/base/video_util.h"
|
|
|
| +#include <cmath>
|
| +
|
| #include "base/logging.h"
|
| #include "media/base/video_frame.h"
|
|
|
| namespace media {
|
|
|
| +gfx::Size GetNaturalSize(const gfx::Rect& visible_rect,
|
| + int aspect_ratio_numerator,
|
| + int aspect_ratio_denominator) {
|
| + if (aspect_ratio_denominator == 0)
|
| + return gfx::Size();
|
| +
|
| + // Calculate the natural size given the aspect ratio and visible rect.
|
| + double aspect_ratio = aspect_ratio_numerator /
|
| + static_cast<double>(aspect_ratio_denominator);
|
| +
|
| + int width = floor(visible_rect.width() * aspect_ratio + 0.5);
|
| + int height = visible_rect.height();
|
| +
|
| + // An even width makes things easier for YV12 and appears to be the behavior
|
| + // expected by WebKit layout tests.
|
| + return gfx::Size(width & ~1, height);
|
| +}
|
| +
|
| static void CopyPlane(size_t plane, const uint8* source, int stride, int rows,
|
| VideoFrame* frame) {
|
| uint8* dest = frame->data(plane);
|
|
|