Revert "Fix CVO in androidvideocapturer."
This reverts commit 02ed57bf9d12a959d5ec139b3fc49170d16b5f30.
https://webrtc-codereview.appspot.com/40759004/
Reason- breaks tests after rebase.
TBR=magjed@webrtc.org
BUG=4145
Review URL: https://webrtc-codereview.appspot.com/39349004
Cr-Commit-Position: refs/heads/master@{#8537}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8537 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/talk/app/webrtc/androidvideocapturer.cc b/talk/app/webrtc/androidvideocapturer.cc
index 01619af..48b822b 100644
--- a/talk/app/webrtc/androidvideocapturer.cc
+++ b/talk/app/webrtc/androidvideocapturer.cc
@@ -85,7 +85,7 @@
// Check that captured_frame is actually our frame.
DCHECK(captured_frame == &captured_frame_);
scoped_ptr<WebRtcVideoFrame> frame(new WebRtcVideoFrame());
- frame->Init(captured_frame, dst_width, dst_height, apply_rotation_);
+ frame->Init(captured_frame, dst_width, dst_height);
return frame.release();
}
diff --git a/talk/media/base/videoadapter_unittest.cc b/talk/media/base/videoadapter_unittest.cc
index 32bf9c3..76b1502 100755
--- a/talk/media/base/videoadapter_unittest.cc
+++ b/talk/media/base/videoadapter_unittest.cc
@@ -100,7 +100,7 @@
const CapturedFrame* captured_frame) {
WebRtcVideoFrame temp_i420;
EXPECT_TRUE(temp_i420.Init(captured_frame,
- captured_frame->width, abs(captured_frame->height), true));
+ captured_frame->width, abs(captured_frame->height)));
VideoFrame* out_frame = NULL;
rtc::CritScope lock(&crit_);
EXPECT_TRUE(video_adapter_->AdaptFrame(&temp_i420, &out_frame));
diff --git a/talk/media/base/videoframe.h b/talk/media/base/videoframe.h
index 7d097fb..56621ad 100644
--- a/talk/media/base/videoframe.h
+++ b/talk/media/base/videoframe.h
@@ -62,8 +62,7 @@
size_t pixel_height,
int64_t elapsed_time,
int64_t time_stamp,
- webrtc::VideoRotation rotation,
- bool apply_rotation) {
+ webrtc::VideoRotation rotation) {
return false;
}
@@ -81,7 +80,7 @@
int rotation) {
return Reset(fourcc, w, h, dw, dh, sample, sample_size, pixel_width,
pixel_height, elapsed_time, time_stamp,
- static_cast<webrtc::VideoRotation>(rotation), true);
+ static_cast<webrtc::VideoRotation>(rotation));
}
// Basic accessors.
@@ -124,6 +123,8 @@
virtual webrtc::VideoRotation GetVideoRotation() const {
return webrtc::kVideoRotation_0;
}
+ // TODO(guoweis): Remove the skeleton implementation once chrome is updated.
+ virtual void SetRotation(webrtc::VideoRotation rotation) {}
// Make a shallow copy of the frame. The frame buffer itself is not copied.
// Both the current and new VideoFrame will share a single reference-counted
diff --git a/talk/media/base/videoframe_unittest.h b/talk/media/base/videoframe_unittest.h
index 628b952..17f83c6 100644
--- a/talk/media/base/videoframe_unittest.h
+++ b/talk/media/base/videoframe_unittest.h
@@ -1428,8 +1428,7 @@
EXPECT_TRUE(IsEqual(frame1, frame2, 0));
EXPECT_TRUE(frame1.Reset(cricket::FOURCC_I420, kWidth, kHeight, kWidth,
kHeight, reinterpret_cast<uint8*>(ms->GetBuffer()),
- data_size, 1, 1, 0, 0, webrtc::kVideoRotation_0,
- true));
+ data_size, 1, 1, 0, 0, webrtc::kVideoRotation_0));
EXPECT_FALSE(IsBlack(frame1));
EXPECT_FALSE(IsEqual(frame1, frame2, 0));
}
diff --git a/talk/media/webrtc/webrtcvideoframe.cc b/talk/media/webrtc/webrtcvideoframe.cc
index af424f5..9764f31 100644
--- a/talk/media/webrtc/webrtcvideoframe.cc
+++ b/talk/media/webrtc/webrtcvideoframe.cc
@@ -112,8 +112,7 @@
}
WebRtcVideoFrame::WebRtcVideoFrame()
- : video_buffer_(new RefCountedBuffer()),
- rotation_(webrtc::kVideoRotation_0) {}
+ : video_buffer_(new RefCountedBuffer()) {}
WebRtcVideoFrame::~WebRtcVideoFrame() {}
@@ -130,18 +129,14 @@
int64_t time_stamp,
webrtc::VideoRotation rotation) {
return Reset(format, w, h, dw, dh, sample, sample_size, pixel_width,
- pixel_height, elapsed_time, time_stamp, rotation,
- true /*apply_rotation*/);
+ pixel_height, elapsed_time, time_stamp, rotation);
}
-bool WebRtcVideoFrame::Init(const CapturedFrame* frame, int dw, int dh,
- bool apply_rotation) {
+bool WebRtcVideoFrame::Init(const CapturedFrame* frame, int dw, int dh) {
return Reset(frame->fourcc, frame->width, frame->height, dw, dh,
static_cast<uint8*>(frame->data), frame->data_size,
frame->pixel_width, frame->pixel_height, frame->elapsed_time,
- frame->time_stamp,
- frame->GetRotation(),
- apply_rotation);
+ frame->time_stamp, frame->GetRotation());
}
bool WebRtcVideoFrame::Alias(const CapturedFrame* frame,
@@ -153,7 +148,7 @@
frame->GetRotation() != webrtc::kVideoRotation_0) ||
frame->width != dw || frame->height != dh) {
// TODO(fbarchard): Enable aliasing of more formats.
- return Init(frame, dw, dh, apply_rotation);
+ return Init(frame, dw, dh);
} else {
Alias(static_cast<uint8*>(frame->data), frame->data_size, frame->width,
frame->height, frame->pixel_width, frame->pixel_height,
@@ -307,8 +302,7 @@
size_t pixel_height,
int64_t elapsed_time,
int64_t time_stamp,
- webrtc::VideoRotation rotation,
- bool apply_rotation) {
+ webrtc::VideoRotation rotation) {
if (!Validate(format, w, h, sample, sample_size)) {
return false;
}
@@ -325,8 +319,7 @@
// TODO(fbarchard): Support lazy allocation.
int new_width = dw;
int new_height = dh;
- // If rotated swap width, height.
- if (apply_rotation && (rotation == 90 || rotation == 270)) {
+ if (rotation == 90 || rotation == 270) { // If rotated swap width, height.
new_width = dh;
new_height = dw;
}
@@ -357,9 +350,7 @@
int v_stride = GetVPitch();
int r = libyuv::ConvertToI420(
sample, sample_size, y, y_stride, u, u_stride, v, v_stride, horiz_crop,
- vert_crop, w, h, dw, idh,
- static_cast<libyuv::RotationMode>(
- apply_rotation ? rotation : webrtc::kVideoRotation_0),
+ vert_crop, w, h, dw, idh, static_cast<libyuv::RotationMode>(rotation),
format);
if (r) {
LOG(LS_ERROR) << "Error parsing format: " << GetFourccName(format)
@@ -416,8 +407,7 @@
size_t pixel_height,
int64_t elapsed_time,
int64_t time_stamp,
- webrtc::VideoRotation rotation,
- bool apply_rotation) {
+ webrtc::VideoRotation rotation) {
UNIMPLEMENTED;
return false;
}
diff --git a/talk/media/webrtc/webrtcvideoframe.h b/talk/media/webrtc/webrtcvideoframe.h
index 6d6e531..4de12b2 100644
--- a/talk/media/webrtc/webrtcvideoframe.h
+++ b/talk/media/webrtc/webrtcvideoframe.h
@@ -65,7 +65,7 @@
int64_t time_stamp,
webrtc::VideoRotation rotation);
- bool Init(const CapturedFrame* frame, int dw, int dh, bool apply_rotation);
+ bool Init(const CapturedFrame* frame, int dw, int dh);
void InitToEmptyBuffer(int w, int h, size_t pixel_width, size_t pixel_height,
int64_t elapsed_time, int64_t time_stamp);
@@ -107,8 +107,7 @@
size_t pixel_height,
int64_t elapsed_time,
int64_t time_stamp,
- webrtc::VideoRotation rotation,
- bool apply_rotation);
+ webrtc::VideoRotation rotation);
virtual size_t GetWidth() const;
virtual size_t GetHeight() const;
@@ -133,6 +132,9 @@
virtual void SetTimeStamp(int64_t time_stamp) { time_stamp_ = time_stamp; }
virtual webrtc::VideoRotation GetVideoRotation() const { return rotation_; }
+ virtual void SetRotation(webrtc::VideoRotation rotation) {
+ rotation_ = rotation;
+ }
virtual VideoFrame* Copy() const;
virtual bool MakeExclusive();
@@ -192,8 +194,7 @@
size_t pixel_height,
int64_t elapsed_time,
int64_t time_stamp,
- webrtc::VideoRotation rotation,
- bool apply_rotation) OVERRIDE;
+ webrtc::VideoRotation rotation) OVERRIDE;
virtual size_t GetWidth() const OVERRIDE;
virtual size_t GetHeight() const OVERRIDE;
virtual const uint8* GetYPlane() const OVERRIDE;
diff --git a/talk/media/webrtc/webrtcvideoframe_unittest.cc b/talk/media/webrtc/webrtcvideoframe_unittest.cc
index 9ddad13..656183c 100644
--- a/talk/media/webrtc/webrtcvideoframe_unittest.cc
+++ b/talk/media/webrtc/webrtcvideoframe_unittest.cc
@@ -33,9 +33,7 @@
WebRtcVideoFrameTest() {
}
- void TestInit(int cropped_width, int cropped_height,
- webrtc::VideoRotation frame_rotation,
- bool apply_rotation) {
+ void TestInit(int cropped_width, int cropped_height) {
const int frame_width = 1920;
const int frame_height = 1080;
@@ -46,7 +44,7 @@
captured_frame.pixel_height = 1;
captured_frame.elapsed_time = 1234;
captured_frame.time_stamp = 5678;
- captured_frame.rotation = frame_rotation;
+ captured_frame.rotation = webrtc::kVideoRotation_0;
captured_frame.width = frame_width;
captured_frame.height = frame_height;
captured_frame.data_size = (frame_width * frame_height) +
@@ -57,30 +55,17 @@
// Create the new frame from the CapturedFrame.
cricket::WebRtcVideoFrame frame;
- EXPECT_TRUE(
- frame.Init(&captured_frame, cropped_width, cropped_height,
- apply_rotation));
+ EXPECT_TRUE(frame.Init(&captured_frame, cropped_width, cropped_height));
// Verify the new frame.
EXPECT_EQ(1u, frame.GetPixelWidth());
EXPECT_EQ(1u, frame.GetPixelHeight());
EXPECT_EQ(1234, frame.GetElapsedTime());
EXPECT_EQ(5678, frame.GetTimeStamp());
- if (apply_rotation)
- EXPECT_EQ(webrtc::kVideoRotation_0, frame.GetRotation());
- else
- EXPECT_EQ(frame_rotation, frame.GetRotation());
+ EXPECT_EQ(webrtc::kVideoRotation_0, frame.GetRotation());
// The size of the new frame should have been cropped to multiple of 4.
- // If |apply_rotation| and the frame rotation is 90 or 270, width and
- // height are flipped.
- if (apply_rotation && (frame_rotation == webrtc::kVideoRotation_90
- || frame_rotation == webrtc::kVideoRotation_270)) {
- EXPECT_EQ(static_cast<size_t>(cropped_width & ~3), frame.GetHeight());
- EXPECT_EQ(static_cast<size_t>(cropped_height & ~3), frame.GetWidth() );
- } else {
- EXPECT_EQ(static_cast<size_t>(cropped_width & ~3), frame.GetWidth());
- EXPECT_EQ(static_cast<size_t>(cropped_height & ~3), frame.GetHeight());
- }
+ EXPECT_EQ(static_cast<size_t>(cropped_width & ~3), frame.GetWidth());
+ EXPECT_EQ(static_cast<size_t>(cropped_height & ~3), frame.GetHeight());
}
};
@@ -289,25 +274,17 @@
// Tests the Init function with different cropped size.
TEST_F(WebRtcVideoFrameTest, InitEvenSize) {
- TestInit(640, 360, webrtc::kVideoRotation_0, true);
+ TestInit(640, 360);
}
TEST_F(WebRtcVideoFrameTest, InitOddWidth) {
- TestInit(601, 480, webrtc::kVideoRotation_0, true);
+ TestInit(601, 480);
}
TEST_F(WebRtcVideoFrameTest, InitOddHeight) {
- TestInit(360, 765, webrtc::kVideoRotation_0, true);
+ TestInit(360, 765);
}
TEST_F(WebRtcVideoFrameTest, InitOddWidthHeight) {
- TestInit(355, 1021, webrtc::kVideoRotation_0, true);
-}
-
-TEST_F(WebRtcVideoFrameTest, InitRotated90ApplyRotation) {
- TestInit(640, 360, webrtc::kVideoRotation_90, true);
-}
-
-TEST_F(WebRtcVideoFrameTest, InitRotated90DontApplyRotation) {
- TestInit(640, 360, webrtc::kVideoRotation_90, false);
+ TestInit(355, 1021);
}