Rename some cricket::VideoFrame methods, to align with webrtc::VideoFrame.

GetVideoFrameBuffer --> video_frame_buffer
GetVideoRotation --> rotation
SetRotation --> set_rotation

BUG=webrtc:5682

Review URL: https://codereview.webrtc.org/1885443002

Cr-Commit-Position: refs/heads/master@{#12342}
This commit is contained in:
nisse 2016-04-13 03:29:16 -07:00 committed by Commit bot
parent cbac40d321
commit f386876354
11 changed files with 30 additions and 32 deletions

View File

@ -783,7 +783,7 @@ class JavaVideoRendererWrapper
return jni()->NewObject(
*j_frame_class_, j_i420_frame_ctor_id_,
frame->width(), frame->height(),
static_cast<int>(frame->GetVideoRotation()),
static_cast<int>(frame->rotation()),
strides, planes, javaShallowCopy(frame));
}
@ -796,7 +796,7 @@ class JavaVideoRendererWrapper
return jni()->NewObject(
*j_frame_class_, j_texture_frame_ctor_id_,
frame->width(), frame->height(),
static_cast<int>(frame->GetVideoRotation()),
static_cast<int>(frame->rotation()),
handle->oes_texture_id, sampling_matrix, javaShallowCopy(frame));
}

View File

@ -92,10 +92,10 @@
if (!_i420Buffer) {
if (_videoFrame->GetNativeHandle()) {
// Convert to I420.
_i420Buffer = _videoFrame->GetVideoFrameBuffer()->NativeToI420Buffer();
_i420Buffer = _videoFrame->video_frame_buffer()->NativeToI420Buffer();
} else {
// Should already be I420.
_i420Buffer = _videoFrame->GetVideoFrameBuffer();
_i420Buffer = _videoFrame->video_frame_buffer();
}
}
}

View File

@ -39,7 +39,7 @@ class FakeVideoRenderer : public rtc::VideoSinkInterface<cricket::VideoFrame> {
++num_rendered_frames_;
width_ = frame.width();
height_ = frame.height();
rotation_ = frame.GetVideoRotation();
rotation_ = frame.rotation();
timestamp_ = frame.GetTimeStamp();
SignalRenderFrame(&frame);
}

View File

@ -98,14 +98,14 @@ const cricket::VideoFrame& VideoBroadcaster::GetBlackFrame(
const cricket::VideoFrame& frame) {
if (black_frame_ && black_frame_->width() == frame.width() &&
black_frame_->height() == frame.height() &&
black_frame_->GetVideoRotation() == frame.GetVideoRotation()) {
black_frame_->rotation() == frame.rotation()) {
black_frame_->SetTimeStamp(frame.GetTimeStamp());
return *black_frame_;
}
black_frame_.reset(new cricket::WebRtcVideoFrame(
new rtc::RefCountedObject<webrtc::I420Buffer>(
frame.width(), frame.height()),
frame.GetTimeStamp(), frame.GetVideoRotation()));
frame.GetTimeStamp(), frame.rotation()));
black_frame_->SetToBlack();
return *black_frame_;
}

View File

@ -136,7 +136,7 @@ void VideoFrame::StretchToFrame(VideoFrame* dst,
interpolate, vert_crop);
dst->SetTimeStamp(GetTimeStamp());
// Stretched frame should have the same rotation as the source.
dst->SetRotation(GetVideoRotation());
dst->set_rotation(rotation());
}
VideoFrame* VideoFrame::Stretch(size_t dst_width, size_t dst_height,

View File

@ -54,14 +54,14 @@ class VideoFrame {
// Returns the underlying video frame buffer. This function is ok to call
// multiple times, but the returned object will refer to the same memory.
virtual rtc::scoped_refptr<webrtc::VideoFrameBuffer> GetVideoFrameBuffer()
virtual rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer()
const = 0;
virtual int64_t GetTimeStamp() const = 0;
virtual void SetTimeStamp(int64_t time_stamp) = 0;
// Indicates the rotation angle in degrees.
virtual webrtc::VideoRotation GetVideoRotation() const = 0;
virtual webrtc::VideoRotation rotation() const = 0;
// 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
@ -139,7 +139,7 @@ class VideoFrame {
// Creates an empty frame.
virtual VideoFrame *CreateEmptyFrame(int w, int h,
int64_t time_stamp) const = 0;
virtual void SetRotation(webrtc::VideoRotation rotation) = 0;
virtual void set_rotation(webrtc::VideoRotation rotation) = 0;
};
} // namespace cricket

View File

@ -1574,8 +1574,8 @@ static void CreateBlackFrame(webrtc::VideoFrame* video_frame,
void WebRtcVideoChannel2::WebRtcVideoSendStream::OnFrame(
const VideoFrame& frame) {
TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::OnFrame");
webrtc::VideoFrame video_frame(frame.GetVideoFrameBuffer(), 0, 0,
frame.GetVideoRotation());
webrtc::VideoFrame video_frame(frame.video_frame_buffer(), 0, 0,
frame.rotation());
rtc::CritScope cs(&lock_);
if (stream_ == NULL) {
// Frame input before send codecs are configured, dropping frame.

View File

@ -121,7 +121,7 @@ void* WebRtcVideoFrame::GetNativeHandle() const {
}
rtc::scoped_refptr<webrtc::VideoFrameBuffer>
WebRtcVideoFrame::GetVideoFrameBuffer() const {
WebRtcVideoFrame::video_frame_buffer() const {
return video_frame_buffer_;
}
@ -213,7 +213,7 @@ void WebRtcVideoFrame::InitToEmptyBuffer(int w, int h,
const VideoFrame* WebRtcVideoFrame::GetCopyWithRotationApplied() const {
// If the frame is not rotated, the caller should reuse this frame instead of
// making a redundant copy.
if (GetVideoRotation() == webrtc::kVideoRotation_0) {
if (rotation() == webrtc::kVideoRotation_0) {
return this;
}
@ -231,8 +231,8 @@ const VideoFrame* WebRtcVideoFrame::GetCopyWithRotationApplied() const {
int rotated_width = orig_width;
int rotated_height = orig_height;
if (GetVideoRotation() == webrtc::kVideoRotation_90 ||
GetVideoRotation() == webrtc::kVideoRotation_270) {
if (rotation() == webrtc::kVideoRotation_90 ||
rotation() == webrtc::kVideoRotation_270) {
rotated_width = orig_height;
rotated_height = orig_width;
}
@ -248,7 +248,7 @@ const VideoFrame* WebRtcVideoFrame::GetCopyWithRotationApplied() const {
rotated_frame_->GetUPlane(), rotated_frame_->GetUPitch(),
rotated_frame_->GetVPlane(), rotated_frame_->GetVPitch(),
orig_width, orig_height,
static_cast<libyuv::RotationMode>(GetVideoRotation()));
static_cast<libyuv::RotationMode>(rotation()));
if (ret == 0) {
return rotated_frame_.get();
}

View File

@ -66,7 +66,7 @@ class WebRtcVideoFrame : public VideoFrame {
int32_t GetUPitch() const override;
int32_t GetVPitch() const override;
void* GetNativeHandle() const override;
rtc::scoped_refptr<webrtc::VideoFrameBuffer> GetVideoFrameBuffer()
rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer()
const override;
int64_t GetTimeStamp() const override { return time_stamp_ns_; }
@ -74,9 +74,7 @@ class WebRtcVideoFrame : public VideoFrame {
time_stamp_ns_ = time_stamp_ns;
}
webrtc::VideoRotation GetVideoRotation() const override {
return rotation_;
}
webrtc::VideoRotation rotation() const override { return rotation_; }
VideoFrame* Copy() const override;
bool IsExclusive() const override;
@ -88,7 +86,7 @@ class WebRtcVideoFrame : public VideoFrame {
const VideoFrame* GetCopyWithRotationApplied() const override;
protected:
void SetRotation(webrtc::VideoRotation rotation) override {
void set_rotation(webrtc::VideoRotation rotation) override {
rotation_ = rotation;
}
// Creates a frame from a raw sample with FourCC |format| and size |w| x |h|.

View File

@ -20,7 +20,7 @@ namespace {
class WebRtcVideoTestFrame : public cricket::WebRtcVideoFrame {
public:
using cricket::WebRtcVideoFrame::SetRotation;
using cricket::WebRtcVideoFrame::set_rotation;
virtual VideoFrame* CreateEmptyFrame(int w,
int h,
@ -68,9 +68,9 @@ class WebRtcVideoFrameTest : public VideoFrameTest<cricket::WebRtcVideoFrame> {
// Verify the new frame.
EXPECT_EQ(5678, frame.GetTimeStamp());
if (apply_rotation)
EXPECT_EQ(webrtc::kVideoRotation_0, frame.GetVideoRotation());
EXPECT_EQ(webrtc::kVideoRotation_0, frame.rotation());
else
EXPECT_EQ(frame_rotation, frame.GetVideoRotation());
EXPECT_EQ(frame_rotation, frame.rotation());
// If |apply_rotation| and the frame rotation is 90 or 270, width and
// height are flipped.
if (apply_rotation && (frame_rotation == webrtc::kVideoRotation_90
@ -303,22 +303,22 @@ TEST_F(WebRtcVideoFrameTest, ApplyRotationToFrame) {
LoadFrame(ms.get(), cricket::FOURCC_I420, kWidth, kHeight, &applied0));
// Claim that this frame needs to be rotated for 90 degree.
applied0.SetRotation(webrtc::kVideoRotation_90);
applied0.set_rotation(webrtc::kVideoRotation_90);
// Apply rotation on frame 1. Output should be different from frame 1.
WebRtcVideoTestFrame* applied90 = const_cast<WebRtcVideoTestFrame*>(
static_cast<const WebRtcVideoTestFrame*>(
applied0.GetCopyWithRotationApplied()));
EXPECT_TRUE(applied90);
EXPECT_EQ(applied90->GetVideoRotation(), webrtc::kVideoRotation_0);
EXPECT_EQ(applied90->rotation(), webrtc::kVideoRotation_0);
EXPECT_FALSE(IsEqual(applied0, *applied90, 0));
// Claim the frame 2 needs to be rotated for another 270 degree. The output
// from frame 2 rotation should be the same as frame 1.
applied90->SetRotation(webrtc::kVideoRotation_270);
applied90->set_rotation(webrtc::kVideoRotation_270);
const cricket::VideoFrame* applied360 =
applied90->GetCopyWithRotationApplied();
EXPECT_TRUE(applied360);
EXPECT_EQ(applied360->GetVideoRotation(), webrtc::kVideoRotation_0);
EXPECT_EQ(applied360->rotation(), webrtc::kVideoRotation_0);
EXPECT_TRUE(IsEqual(applied0, *applied360, 0));
}

View File

@ -48,11 +48,11 @@ class WebRtcVideoFrameFactoryTest
int src_height,
bool apply_rotation) {
if (!apply_rotation) {
EXPECT_EQ(dest_frame->GetVideoRotation(), src_rotation);
EXPECT_EQ(dest_frame->rotation(), src_rotation);
EXPECT_EQ(dest_frame->width(), src_width);
EXPECT_EQ(dest_frame->height(), src_height);
} else {
EXPECT_EQ(dest_frame->GetVideoRotation(), webrtc::kVideoRotation_0);
EXPECT_EQ(dest_frame->rotation(), webrtc::kVideoRotation_0);
if (src_rotation == webrtc::kVideoRotation_90 ||
src_rotation == webrtc::kVideoRotation_270) {
EXPECT_EQ(dest_frame->width(), src_height);