aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornisse <nisse@webrtc.org>2016-01-14 02:35:22 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-14 10:35:30 +0000
commit268493a96b93d6a11a595b3272c5a4cd7a1fdc47 (patch)
treebcf9bc27f303031f37d0cf5c0fd951fcf8873063
parent35aae2e5cab191f820ad6757b1092e22a43e426b (diff)
downloadwebrtc-268493a96b93d6a11a595b3272c5a4cd7a1fdc47.tar.gz
Revert of Delete remnants of non-square pixel support from cricket::VideoFrame. (patchset #1 id:1 of https://codereview.webrtc.org/1586613002/ )
Reason for revert: These changes broke chrome. Need to temporarily keep methods InitToEmptyBuffer, InitToBlack, CreateEmptyFrame with old but ignored arguments for pixel_width and pixel_height. Then update chrome, and delete the old methods in a separate cl. Original issue's description: > Delete remnants of non-square pixel support from cricket::VideoFrame. > > If ever needed, add some aspect ratio parameter, without pixel_width > and pixel_height arguments cluttering commonly used functions. > > BUG=webrtc:5426 > > Committed: https://crrev.com/709513d4133107d5c02aed34a5ee99444c4d4e25 > Cr-Commit-Position: refs/heads/master@{#11243} TBR=pthatcher@webrtc.org,perkj@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:5426 Review URL: https://codereview.webrtc.org/1583223002 Cr-Commit-Position: refs/heads/master@{#11246}
-rw-r--r--talk/app/webrtc/videotrack_unittest.cc2
-rw-r--r--talk/media/base/videoframe.cc1
-rw-r--r--talk/media/base/videoframe.h13
-rw-r--r--talk/media/base/videoframe_unittest.h46
-rw-r--r--talk/media/webrtc/webrtcvideoframe.cc34
-rw-r--r--talk/media/webrtc/webrtcvideoframe.h17
-rw-r--r--talk/media/webrtc/webrtcvideoframe_unittest.cc8
7 files changed, 84 insertions, 37 deletions
diff --git a/talk/app/webrtc/videotrack_unittest.cc b/talk/app/webrtc/videotrack_unittest.cc
index c30a98b5e0..013d925cd2 100644
--- a/talk/app/webrtc/videotrack_unittest.cc
+++ b/talk/app/webrtc/videotrack_unittest.cc
@@ -82,7 +82,7 @@ TEST_F(VideoTrackTest, RenderVideo) {
ASSERT_FALSE(renderer_input == NULL);
cricket::WebRtcVideoFrame frame;
- frame.InitToBlack(123, 123, 0);
+ frame.InitToBlack(123, 123, 1, 1, 0);
renderer_input->RenderFrame(&frame);
EXPECT_EQ(1, renderer_1->num_rendered_frames());
diff --git a/talk/media/base/videoframe.cc b/talk/media/base/videoframe.cc
index 7e3648120c..3e4d60a258 100644
--- a/talk/media/base/videoframe.cc
+++ b/talk/media/base/videoframe.cc
@@ -220,6 +220,7 @@ VideoFrame* VideoFrame::Stretch(size_t dst_width, size_t dst_height,
bool interpolate, bool vert_crop) const {
VideoFrame* dest = CreateEmptyFrame(static_cast<int>(dst_width),
static_cast<int>(dst_height),
+ GetPixelWidth(), GetPixelHeight(),
GetTimeStamp());
if (dest) {
StretchToFrame(dest, interpolate, vert_crop);
diff --git a/talk/media/base/videoframe.h b/talk/media/base/videoframe.h
index 85d6ba8be2..f81c678d61 100644
--- a/talk/media/base/videoframe.h
+++ b/talk/media/base/videoframe.h
@@ -41,7 +41,8 @@ class VideoFrame {
VideoFrame() {}
virtual ~VideoFrame() {}
- virtual bool InitToBlack(int w, int h, int64_t time_stamp) = 0;
+ virtual bool InitToBlack(int w, int h, size_t pixel_width,
+ size_t pixel_height, int64_t time_stamp) = 0;
// Creates a frame from a raw sample with FourCC |format| and size |w| x |h|.
// |h| can be negative indicating a vertically flipped image.
// |dw| is destination width; can be less than |w| if cropping is desired.
@@ -55,6 +56,8 @@ class VideoFrame {
int dh,
uint8_t* sample,
size_t sample_size,
+ size_t pixel_width,
+ size_t pixel_height,
int64_t time_stamp,
webrtc::VideoRotation rotation,
bool apply_rotation) = 0;
@@ -89,6 +92,11 @@ class VideoFrame {
virtual rtc::scoped_refptr<webrtc::VideoFrameBuffer> GetVideoFrameBuffer()
const = 0;
+ // For retrieving the aspect ratio of each pixel. Usually this is 1x1, but
+ // the aspect_ratio_idc parameter of H.264 can specify non-square pixels.
+ virtual size_t GetPixelWidth() const = 0;
+ virtual size_t GetPixelHeight() const = 0;
+
virtual int64_t GetTimeStamp() const = 0;
virtual void SetTimeStamp(int64_t time_stamp) = 0;
@@ -201,7 +209,8 @@ class VideoFrame {
protected:
// Creates an empty frame.
- virtual VideoFrame *CreateEmptyFrame(int w, int h,
+ virtual VideoFrame *CreateEmptyFrame(int w, int h, size_t pixel_width,
+ size_t pixel_height,
int64_t time_stamp) const = 0;
virtual void SetRotation(webrtc::VideoRotation rotation) = 0;
};
diff --git a/talk/media/base/videoframe_unittest.h b/talk/media/base/videoframe_unittest.h
index 3236066bc3..73d1a2ffbc 100644
--- a/talk/media/base/videoframe_unittest.h
+++ b/talk/media/base/videoframe_unittest.h
@@ -152,7 +152,7 @@ class VideoFrameTest : public testing::Test {
bool ret = false;
for (int i = 0; i < repeat_; ++i) {
ret = frame->Init(format, width, height, dw, dh,
- sample, sample_size, 0, rotation);
+ sample, sample_size, 1, 1, 0, rotation);
}
return ret;
}
@@ -295,7 +295,7 @@ class VideoFrameTest : public testing::Test {
const uint8_t* start = reinterpret_cast<const uint8_t*>(ms->GetBuffer());
int awidth = (width + 1) & ~1;
- frame->InitToBlack(width, height, 0);
+ frame->InitToBlack(width, height, 1, 1, 0);
int stride_y = frame->GetYPitch();
int stride_u = frame->GetUPitch();
int stride_v = frame->GetVPitch();
@@ -339,7 +339,7 @@ class VideoFrameTest : public testing::Test {
start = start + pitch * (height - 1);
pitch = -pitch;
}
- frame->InitToBlack(width, height, 0);
+ frame->InitToBlack(width, height, 1, 1, 0);
int stride_y = frame->GetYPitch();
int stride_u = frame->GetUPitch();
int stride_v = frame->GetVPitch();
@@ -465,6 +465,8 @@ class VideoFrameTest : public testing::Test {
static bool IsEqual(const cricket::VideoFrame& frame,
size_t width,
size_t height,
+ size_t pixel_width,
+ size_t pixel_height,
int64_t time_stamp,
const uint8_t* y,
uint32_t ypitch,
@@ -475,6 +477,8 @@ class VideoFrameTest : public testing::Test {
int max_error) {
return IsSize(frame, static_cast<uint32_t>(width),
static_cast<uint32_t>(height)) &&
+ frame.GetPixelWidth() == pixel_width &&
+ frame.GetPixelHeight() == pixel_height &&
frame.GetTimeStamp() == time_stamp &&
IsPlaneEqual("y", frame.GetYPlane(), frame.GetYPitch(), y, ypitch,
static_cast<uint32_t>(width),
@@ -492,6 +496,7 @@ class VideoFrameTest : public testing::Test {
int max_error) {
return IsEqual(frame1,
frame2.GetWidth(), frame2.GetHeight(),
+ frame2.GetPixelWidth(), frame2.GetPixelHeight(),
frame2.GetTimeStamp(),
frame2.GetYPlane(), frame2.GetYPitch(),
frame2.GetUPlane(), frame2.GetUPitch(),
@@ -507,6 +512,7 @@ class VideoFrameTest : public testing::Test {
IsEqual(frame1,
frame2.GetWidth() - hcrop * 2,
frame2.GetHeight() - vcrop * 2,
+ frame2.GetPixelWidth(), frame2.GetPixelHeight(),
frame2.GetTimeStamp(),
frame2.GetYPlane() + vcrop * frame2.GetYPitch()
+ hcrop,
@@ -543,7 +549,7 @@ class VideoFrameTest : public testing::Test {
const uint8_t* y = reinterpret_cast<uint8_t*>(ms.get()->GetBuffer());
const uint8_t* u = y + kWidth * kHeight;
const uint8_t* v = u + kWidth * kHeight / 4;
- EXPECT_TRUE(IsEqual(frame, kWidth, kHeight, 0, y, kWidth, u,
+ EXPECT_TRUE(IsEqual(frame, kWidth, kHeight, 1, 1, 0, y, kWidth, u,
kWidth / 2, v, kWidth / 2, 0));
}
@@ -558,7 +564,7 @@ class VideoFrameTest : public testing::Test {
const uint8_t* y = reinterpret_cast<uint8_t*>(ms.get()->GetBuffer());
const uint8_t* v = y + kWidth * kHeight;
const uint8_t* u = v + kWidth * kHeight / 4;
- EXPECT_TRUE(IsEqual(frame, kWidth, kHeight, 0, y, kWidth, u,
+ EXPECT_TRUE(IsEqual(frame, kWidth, kHeight, 1, 1, 0, y, kWidth, u,
kWidth / 2, v, kWidth / 2, 0));
}
@@ -822,10 +828,10 @@ class VideoFrameTest : public testing::Test {
EXPECT_TRUE(frame2.Init(cricket::FOURCC_##FOURCC, kWidth, kHeight, kWidth, \
kHeight, \
reinterpret_cast<uint8_t*>(ms->GetBuffer()), \
- data_size, 0, webrtc::kVideoRotation_0)); \
+ data_size, 1, 1, 0, webrtc::kVideoRotation_0)); \
int width_rotate = static_cast<int>(frame1.GetWidth()); \
int height_rotate = static_cast<int>(frame1.GetHeight()); \
- EXPECT_TRUE(frame3.InitToBlack(width_rotate, height_rotate, 0)); \
+ EXPECT_TRUE(frame3.InitToBlack(width_rotate, height_rotate, 1, 1, 0)); \
libyuv::I420Mirror( \
frame2.GetYPlane(), frame2.GetYPitch(), frame2.GetUPlane(), \
frame2.GetUPitch(), frame2.GetVPlane(), frame2.GetVPitch(), \
@@ -853,10 +859,10 @@ class VideoFrameTest : public testing::Test {
EXPECT_TRUE(frame2.Init(cricket::FOURCC_##FOURCC, kWidth, kHeight, kWidth, \
kHeight, \
reinterpret_cast<uint8_t*>(ms->GetBuffer()), \
- data_size, 0, webrtc::kVideoRotation_0)); \
+ data_size, 1, 1, 0, webrtc::kVideoRotation_0)); \
int width_rotate = static_cast<int>(frame1.GetWidth()); \
int height_rotate = static_cast<int>(frame1.GetHeight()); \
- EXPECT_TRUE(frame3.InitToBlack(width_rotate, height_rotate, 0)); \
+ EXPECT_TRUE(frame3.InitToBlack(width_rotate, height_rotate, 1, 1, 0)); \
libyuv::I420Rotate( \
frame2.GetYPlane(), frame2.GetYPitch(), frame2.GetUPlane(), \
frame2.GetUPitch(), frame2.GetVPlane(), frame2.GetVPitch(), \
@@ -962,12 +968,12 @@ class VideoFrameTest : public testing::Test {
uint8_t pixel[3] = {1, 2, 3};
for (int i = 0; i < repeat_; ++i) {
EXPECT_TRUE(frame.Init(cricket::FOURCC_I420, 1, 1, 1, 1, pixel,
- sizeof(pixel), 0, webrtc::kVideoRotation_0));
+ sizeof(pixel), 1, 1, 0, webrtc::kVideoRotation_0));
}
const uint8_t* y = pixel;
const uint8_t* u = y + 1;
const uint8_t* v = u + 1;
- EXPECT_TRUE(IsEqual(frame, 1, 1, 0, y, 1, u, 1, v, 1, 0));
+ EXPECT_TRUE(IsEqual(frame, 1, 1, 1, 1, 0, y, 1, u, 1, v, 1, 0));
}
// Test 5 pixel edge case image.
@@ -977,7 +983,7 @@ class VideoFrameTest : public testing::Test {
memset(pixels5x5, 1, 5 * 5 + ((5 + 1) / 2 * (5 + 1) / 2) * 2);
for (int i = 0; i < repeat_; ++i) {
EXPECT_TRUE(frame.Init(cricket::FOURCC_I420, 5, 5, 5, 5, pixels5x5,
- sizeof(pixels5x5), 0,
+ sizeof(pixels5x5), 1, 1, 0,
webrtc::kVideoRotation_0));
}
EXPECT_EQ(5u, frame.GetWidth());
@@ -993,7 +999,7 @@ class VideoFrameTest : public testing::Test {
uint8_t pixel[4] = {64, 128, 192, 255};
for (int i = 0; i < repeat_; ++i) {
EXPECT_TRUE(frame.Init(cricket::FOURCC_ARGB, 1, 1, 1, 1, pixel,
- sizeof(pixel), 0,
+ sizeof(pixel), 1, 1, 0,
webrtc::kVideoRotation_0));
}
// Convert back to ARGB.
@@ -1343,7 +1349,7 @@ class VideoFrameTest : public testing::Test {
void ConstructBlack() {
T frame;
for (int i = 0; i < repeat_; ++i) {
- EXPECT_TRUE(frame.InitToBlack(kWidth, kHeight, 0));
+ EXPECT_TRUE(frame.InitToBlack(kWidth, kHeight, 1, 1, 0));
}
EXPECT_TRUE(IsSize(frame, kWidth, kHeight));
EXPECT_TRUE(IsBlack(frame));
@@ -1409,14 +1415,14 @@ class VideoFrameTest : public testing::Test {
ASSERT_TRUE(ms.get() != NULL);
size_t data_size;
ms->GetSize(&data_size);
- EXPECT_TRUE(frame1.InitToBlack(kWidth, kHeight, 0));
- EXPECT_TRUE(frame2.InitToBlack(kWidth, kHeight, 0));
+ EXPECT_TRUE(frame1.InitToBlack(kWidth, kHeight, 1, 1, 0));
+ EXPECT_TRUE(frame2.InitToBlack(kWidth, kHeight, 1, 1, 0));
EXPECT_TRUE(IsBlack(frame1));
EXPECT_TRUE(IsEqual(frame1, frame2, 0));
EXPECT_TRUE(frame1.Reset(cricket::FOURCC_I420, kWidth, kHeight, kWidth,
kHeight,
reinterpret_cast<uint8_t*>(ms->GetBuffer()),
- data_size, 0, rotation, apply_rotation));
+ data_size, 1, 1, 0, rotation, apply_rotation));
if (apply_rotation)
EXPECT_EQ(webrtc::kVideoRotation_0, frame1.GetVideoRotation());
else
@@ -1488,7 +1494,7 @@ class VideoFrameTest : public testing::Test {
out,
out_size, stride));
}
- EXPECT_TRUE(frame2.InitToBlack(kWidth, kHeight, 0));
+ EXPECT_TRUE(frame2.InitToBlack(kWidth, kHeight, 1, 1, 0));
for (int i = 0; i < repeat_from; ++i) {
EXPECT_EQ(0, RGBToI420(out, stride,
frame2.GetYPlane(), frame2.GetYPitch(),
@@ -1909,7 +1915,7 @@ class VideoFrameTest : public testing::Test {
uint8_t pixel[3] = {1, 2, 3};
T frame;
EXPECT_TRUE(frame.Init(cricket::FOURCC_I420, 1, 1, 1, 1, pixel,
- sizeof(pixel), 0,
+ sizeof(pixel), 1, 1, 0,
webrtc::kVideoRotation_0));
for (int i = 0; i < repeat_; ++i) {
EXPECT_EQ(out_size, frame.CopyToBuffer(out.get(), out_size));
@@ -1923,7 +1929,7 @@ class VideoFrameTest : public testing::Test {
void StretchToFrame() {
// Create the source frame as a black frame.
T source;
- EXPECT_TRUE(source.InitToBlack(kWidth * 2, kHeight * 2, 0));
+ EXPECT_TRUE(source.InitToBlack(kWidth * 2, kHeight * 2, 1, 1, 0));
EXPECT_TRUE(IsSize(source, kWidth * 2, kHeight * 2));
// Create the target frame by loading from a file.
diff --git a/talk/media/webrtc/webrtcvideoframe.cc b/talk/media/webrtc/webrtcvideoframe.cc
index 911466493a..fcc991c753 100644
--- a/talk/media/webrtc/webrtcvideoframe.cc
+++ b/talk/media/webrtc/webrtcvideoframe.cc
@@ -40,6 +40,8 @@ using webrtc::kVPlane;
namespace cricket {
WebRtcVideoFrame::WebRtcVideoFrame():
+ pixel_width_(0),
+ pixel_height_(0),
time_stamp_ns_(0),
rotation_(webrtc::kVideoRotation_0) {}
@@ -48,6 +50,8 @@ WebRtcVideoFrame::WebRtcVideoFrame(
int64_t time_stamp_ns,
webrtc::VideoRotation rotation)
: video_frame_buffer_(buffer),
+ pixel_width_(1),
+ pixel_height_(1),
time_stamp_ns_(time_stamp_ns),
rotation_(rotation) {
}
@@ -61,10 +65,12 @@ bool WebRtcVideoFrame::Init(uint32_t format,
int dh,
uint8_t* sample,
size_t sample_size,
+ size_t pixel_width,
+ size_t pixel_height,
int64_t time_stamp_ns,
webrtc::VideoRotation rotation) {
- return Reset(format, w, h, dw, dh, sample, sample_size,
- time_stamp_ns, rotation,
+ return Reset(format, w, h, dw, dh, sample, sample_size, pixel_width,
+ pixel_height, time_stamp_ns, rotation,
true /*apply_rotation*/);
}
@@ -72,13 +78,13 @@ bool WebRtcVideoFrame::Init(const CapturedFrame* frame, int dw, int dh,
bool apply_rotation) {
return Reset(frame->fourcc, frame->width, frame->height, dw, dh,
static_cast<uint8_t*>(frame->data), frame->data_size,
- frame->time_stamp,
+ frame->pixel_width, frame->pixel_height, frame->time_stamp,
frame->rotation, apply_rotation);
}
-bool WebRtcVideoFrame::InitToBlack(int w, int h,
- int64_t time_stamp_ns) {
- InitToEmptyBuffer(w, h, time_stamp_ns);
+bool WebRtcVideoFrame::InitToBlack(int w, int h, size_t pixel_width,
+ size_t pixel_height, int64_t time_stamp_ns) {
+ InitToEmptyBuffer(w, h, pixel_width, pixel_height, time_stamp_ns);
return SetToBlack();
}
@@ -145,6 +151,8 @@ WebRtcVideoFrame::GetVideoFrameBuffer() const {
VideoFrame* WebRtcVideoFrame::Copy() const {
WebRtcVideoFrame* new_frame = new WebRtcVideoFrame(
video_frame_buffer_, time_stamp_ns_, rotation_);
+ new_frame->pixel_width_ = pixel_width_;
+ new_frame->pixel_height_ = pixel_height_;
return new_frame;
}
@@ -188,6 +196,8 @@ bool WebRtcVideoFrame::Reset(uint32_t format,
int dh,
uint8_t* sample,
size_t sample_size,
+ size_t pixel_width,
+ size_t pixel_height,
int64_t time_stamp_ns,
webrtc::VideoRotation rotation,
bool apply_rotation) {
@@ -207,7 +217,7 @@ bool WebRtcVideoFrame::Reset(uint32_t format,
new_height = dw;
}
- InitToEmptyBuffer(new_width, new_height,
+ InitToEmptyBuffer(new_width, new_height, pixel_width, pixel_height,
time_stamp_ns);
rotation_ = apply_rotation ? webrtc::kVideoRotation_0 : rotation;
@@ -237,16 +247,19 @@ bool WebRtcVideoFrame::Reset(uint32_t format,
}
VideoFrame* WebRtcVideoFrame::CreateEmptyFrame(
- int w, int h,
+ int w, int h, size_t pixel_width, size_t pixel_height,
int64_t time_stamp_ns) const {
WebRtcVideoFrame* frame = new WebRtcVideoFrame();
- frame->InitToEmptyBuffer(w, h, time_stamp_ns);
+ frame->InitToEmptyBuffer(w, h, pixel_width, pixel_height, time_stamp_ns);
return frame;
}
-void WebRtcVideoFrame::InitToEmptyBuffer(int w, int h,
+void WebRtcVideoFrame::InitToEmptyBuffer(int w, int h, size_t pixel_width,
+ size_t pixel_height,
int64_t time_stamp_ns) {
video_frame_buffer_ = new rtc::RefCountedObject<webrtc::I420Buffer>(w, h);
+ pixel_width_ = pixel_width;
+ pixel_height_ = pixel_height;
time_stamp_ns_ = time_stamp_ns;
rotation_ = webrtc::kVideoRotation_0;
}
@@ -279,6 +292,7 @@ const VideoFrame* WebRtcVideoFrame::GetCopyWithRotationApplied() const {
}
rotated_frame_.reset(CreateEmptyFrame(rotated_width, rotated_height,
+ GetPixelWidth(), GetPixelHeight(),
GetTimeStamp()));
// TODO(guoweis): Add a function in webrtc_libyuv.cc to convert from
diff --git a/talk/media/webrtc/webrtcvideoframe.h b/talk/media/webrtc/webrtcvideoframe.h
index 33d2873874..827cf28821 100644
--- a/talk/media/webrtc/webrtcvideoframe.h
+++ b/talk/media/webrtc/webrtcvideoframe.h
@@ -59,14 +59,18 @@ class WebRtcVideoFrame : public VideoFrame {
int dh,
uint8_t* sample,
size_t sample_size,
+ size_t pixel_width,
+ size_t pixel_height,
int64_t time_stamp_ns,
webrtc::VideoRotation rotation);
bool Init(const CapturedFrame* frame, int dw, int dh, bool apply_rotation);
- void InitToEmptyBuffer(int w, int h, int64_t time_stamp_ns);
+ void InitToEmptyBuffer(int w, int h, size_t pixel_width, size_t pixel_height,
+ int64_t time_stamp_ns);
- bool InitToBlack(int w, int h, int64_t time_stamp_ns) override;
+ bool InitToBlack(int w, int h, size_t pixel_width, size_t pixel_height,
+ int64_t time_stamp_ns) override;
// From base class VideoFrame.
bool Reset(uint32_t format,
@@ -76,6 +80,8 @@ class WebRtcVideoFrame : public VideoFrame {
int dh,
uint8_t* sample,
size_t sample_size,
+ size_t pixel_width,
+ size_t pixel_height,
int64_t time_stamp_ns,
webrtc::VideoRotation rotation,
bool apply_rotation) override;
@@ -95,6 +101,8 @@ class WebRtcVideoFrame : public VideoFrame {
rtc::scoped_refptr<webrtc::VideoFrameBuffer> GetVideoFrameBuffer()
const override;
+ size_t GetPixelWidth() const override { return pixel_width_; }
+ size_t GetPixelHeight() const override { return pixel_height_; }
int64_t GetTimeStamp() const override { return time_stamp_ns_; }
void SetTimeStamp(int64_t time_stamp_ns) override {
time_stamp_ns_ = time_stamp_ns;
@@ -120,11 +128,14 @@ class WebRtcVideoFrame : public VideoFrame {
}
private:
- VideoFrame* CreateEmptyFrame(int w, int h,
+ VideoFrame* CreateEmptyFrame(int w, int h, size_t pixel_width,
+ size_t pixel_height,
int64_t time_stamp_ns) const override;
// An opaque reference counted handle that stores the pixel data.
rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer_;
+ size_t pixel_width_;
+ size_t pixel_height_;
int64_t time_stamp_ns_;
webrtc::VideoRotation rotation_;
diff --git a/talk/media/webrtc/webrtcvideoframe_unittest.cc b/talk/media/webrtc/webrtcvideoframe_unittest.cc
index 2552331141..8388f07ba0 100644
--- a/talk/media/webrtc/webrtcvideoframe_unittest.cc
+++ b/talk/media/webrtc/webrtcvideoframe_unittest.cc
@@ -39,9 +39,11 @@ class WebRtcVideoTestFrame : public cricket::WebRtcVideoFrame {
virtual VideoFrame* CreateEmptyFrame(int w,
int h,
+ size_t pixel_width,
+ size_t pixel_height,
int64_t time_stamp) const override {
WebRtcVideoTestFrame* frame = new WebRtcVideoTestFrame();
- frame->InitToBlack(w, h, time_stamp);
+ frame->InitToBlack(w, h, pixel_width, pixel_height, time_stamp);
return frame;
}
};
@@ -62,6 +64,8 @@ class WebRtcVideoFrameTest : public VideoFrameTest<cricket::WebRtcVideoFrame> {
// Build the CapturedFrame.
cricket::CapturedFrame captured_frame;
captured_frame.fourcc = cricket::FOURCC_I420;
+ captured_frame.pixel_width = 1;
+ captured_frame.pixel_height = 1;
captured_frame.time_stamp = 5678;
captured_frame.rotation = frame_rotation;
captured_frame.width = frame_width;
@@ -81,6 +85,8 @@ class WebRtcVideoFrameTest : public VideoFrameTest<cricket::WebRtcVideoFrame> {
apply_rotation));
// Verify the new frame.
+ EXPECT_EQ(1u, frame.GetPixelWidth());
+ EXPECT_EQ(1u, frame.GetPixelHeight());
EXPECT_EQ(5678, frame.GetTimeStamp());
if (apply_rotation)
EXPECT_EQ(webrtc::kVideoRotation_0, frame.GetRotation());