Delete method cricket::VideoFrame::Copy.

Should be unused in Chrome since cl
https://codereview.chromium.org/2068703002/

TBR=tkchin@webrtc.org,magjed@webrtc.org
BUG=webrtc:5682

Committed: https://crrev.com/9c00f646f0b3cd33506a1944c7bc6724af041237
Review-Url: https://codereview.webrtc.org/2080253002
Cr-Original-Commit-Position: refs/heads/master@{#13236}
Cr-Commit-Position: refs/heads/master@{#13244}
This commit is contained in:
nisse
2016-06-21 12:53:48 -07:00
committed by Commit bot
parent 3ee3d69e7d
commit 7e4e00d189
8 changed files with 13 additions and 61 deletions

View File

@ -29,7 +29,7 @@
#include <memory> #include <memory>
#include "webrtc/media/base/videoframe.h" #include "webrtc/media/engine/webrtcvideoframe.h"
@implementation RTCI420Frame { @implementation RTCI420Frame {
std::unique_ptr<cricket::VideoFrame> _videoFrame; std::unique_ptr<cricket::VideoFrame> _videoFrame;
@ -98,7 +98,10 @@
if (self = [super init]) { if (self = [super init]) {
// Keep a shallow copy of the video frame. The underlying frame buffer is // Keep a shallow copy of the video frame. The underlying frame buffer is
// not copied. // not copied.
_videoFrame.reset(videoFrame->Copy()); _videoFrame.reset(new cricket::WebRtcVideoFrame(
videoFrame->video_frame_buffer(),
videoFrame->rotation(),
videoFrame->timestamp_us()));
} }
return self; return self;
} }

View File

@ -768,7 +768,8 @@ class JavaVideoRendererWrapper
// ownership of the frame, and the frame should be released with // ownership of the frame, and the frame should be released with
// VideoRenderer.releaseNativeFrame(). // VideoRenderer.releaseNativeFrame().
static jlong javaShallowCopy(const cricket::VideoFrame* frame) { static jlong javaShallowCopy(const cricket::VideoFrame* frame) {
return jlongFromPointer(frame->Copy()); return jlongFromPointer(new cricket::WebRtcVideoFrame(
frame->video_frame_buffer(), frame->rotation(), frame->timestamp_us()));
} }
// Return a VideoRenderer.I420Frame referring to the data in |frame|. // Return a VideoRenderer.I420Frame referring to the data in |frame|.

View File

@ -51,11 +51,6 @@ class VideoFrame {
// Indicates the rotation angle in degrees. // Indicates the rotation angle in degrees.
virtual webrtc::VideoRotation rotation() 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
// frame buffer.
virtual VideoFrame *Copy() const = 0;
// Return a copy of frame which has its pending rotation applied. The // Return a copy of frame which has its pending rotation applied. The
// ownership of the returned frame is held by this frame. // ownership of the returned frame is held by this frame.
virtual const VideoFrame* GetCopyWithRotationApplied() const = 0; virtual const VideoFrame* GetCopyWithRotationApplied() const = 0;

View File

@ -1808,31 +1808,6 @@ class VideoFrameTest : public testing::Test {
EXPECT_TRUE(IsEqual(frame1, frame2, 1)); EXPECT_TRUE(IsEqual(frame1, frame2, 1));
} }
///////////////////
// General tests //
///////////////////
void Copy() {
std::unique_ptr<T> source(new T);
std::unique_ptr<cricket::VideoFrame> target;
ASSERT_TRUE(LoadFrameNoRepeat(source.get()));
target.reset(source->Copy());
EXPECT_TRUE(IsEqual(*source, *target, 0));
source.reset();
ASSERT_TRUE(target->video_frame_buffer() != NULL);
EXPECT_TRUE(target->video_frame_buffer()->DataY() != NULL);
}
void CopyIsRef() {
std::unique_ptr<T> source(new T);
std::unique_ptr<const cricket::VideoFrame> target;
ASSERT_TRUE(LoadFrameNoRepeat(source.get()));
target.reset(source->Copy());
EXPECT_TRUE(IsEqual(*source, *target, 0));
const T* const_source = source.get();
EXPECT_EQ(const_source->video_frame_buffer(), target->video_frame_buffer());
}
int repeat_; int repeat_;
}; };

View File

@ -78,10 +78,6 @@ WebRtcVideoFrame::video_frame_buffer() const {
return video_frame_buffer_; return video_frame_buffer_;
} }
VideoFrame* WebRtcVideoFrame::Copy() const {
return new WebRtcVideoFrame(video_frame_buffer_, rotation_, timestamp_us_);
}
size_t WebRtcVideoFrame::ConvertToRgbBuffer(uint32_t to_fourcc, size_t WebRtcVideoFrame::ConvertToRgbBuffer(uint32_t to_fourcc,
uint8_t* buffer, uint8_t* buffer,
size_t size, size_t size,

View File

@ -75,8 +75,6 @@ class WebRtcVideoFrame : public VideoFrame {
webrtc::VideoRotation rotation() const override { return rotation_; } webrtc::VideoRotation rotation() const override { return rotation_; }
VideoFrame* Copy() const override;
size_t ConvertToRgbBuffer(uint32_t to_fourcc, size_t ConvertToRgbBuffer(uint32_t to_fourcc,
uint8_t* buffer, uint8_t* buffer,
size_t size, size_t size,

View File

@ -245,9 +245,6 @@ TEST_WEBRTCVIDEOFRAME(ConvertFromUYVYBufferInverted)
// TEST_WEBRTCVIDEOFRAME(ConvertToI422Buffer) // TEST_WEBRTCVIDEOFRAME(ConvertToI422Buffer)
// TEST_WEBRTCVIDEOFRAME(ConstructARGBBlackWhitePixel) // TEST_WEBRTCVIDEOFRAME(ConstructARGBBlackWhitePixel)
TEST_WEBRTCVIDEOFRAME(Copy)
TEST_WEBRTCVIDEOFRAME(CopyIsRef)
// These functions test implementation-specific details. // These functions test implementation-specific details.
// Tests the Init function with different cropped size. // Tests the Init function with different cropped size.
TEST_F(WebRtcVideoFrameTest, InitEvenSize) { TEST_F(WebRtcVideoFrameTest, InitEvenSize) {
@ -292,24 +289,6 @@ TEST_F(WebRtcVideoFrameTest, TextureInitialValues) {
EXPECT_EQ(40, frame.timestamp_us()); EXPECT_EQ(40, frame.timestamp_us());
} }
TEST_F(WebRtcVideoFrameTest, CopyTextureFrame) {
webrtc::test::FakeNativeHandle* dummy_handle =
new webrtc::test::FakeNativeHandle();
webrtc::NativeHandleBuffer* buffer =
new rtc::RefCountedObject<webrtc::test::FakeNativeHandleBuffer>(
dummy_handle, 640, 480);
// Timestamp is converted from ns to us, so last three digits are lost.
cricket::WebRtcVideoFrame frame1(buffer, 20000, webrtc::kVideoRotation_0);
cricket::VideoFrame* frame2 = frame1.Copy();
EXPECT_EQ(frame1.video_frame_buffer()->native_handle(),
frame2->video_frame_buffer()->native_handle());
EXPECT_EQ(frame1.width(), frame2->width());
EXPECT_EQ(frame1.height(), frame2->height());
EXPECT_EQ(frame1.GetTimeStamp(), frame2->GetTimeStamp());
EXPECT_EQ(frame1.timestamp_us(), frame2->timestamp_us());
delete frame2;
}
TEST_F(WebRtcVideoFrameTest, ApplyRotationToFrame) { TEST_F(WebRtcVideoFrameTest, ApplyRotationToFrame) {
WebRtcVideoTestFrame applied0; WebRtcVideoTestFrame applied0;
EXPECT_TRUE(IsNull(applied0)); EXPECT_TRUE(IsNull(applied0));

View File

@ -12,6 +12,8 @@
#include <memory> #include <memory>
#include "webrtc/media/engine/webrtcvideoframe.h"
@implementation RTCVideoFrame { @implementation RTCVideoFrame {
std::unique_ptr<cricket::VideoFrame> _videoFrame; std::unique_ptr<cricket::VideoFrame> _videoFrame;
rtc::scoped_refptr<webrtc::VideoFrameBuffer> _i420Buffer; rtc::scoped_refptr<webrtc::VideoFrameBuffer> _i420Buffer;
@ -105,7 +107,10 @@
if (self = [super init]) { if (self = [super init]) {
// Keep a shallow copy of the video frame. The underlying frame buffer is // Keep a shallow copy of the video frame. The underlying frame buffer is
// not copied. // not copied.
_videoFrame.reset(nativeFrame->Copy()); _videoFrame.reset(new cricket::WebRtcVideoFrame(
nativeFrame->video_frame_buffer(),
nativeFrame->rotation(),
nativeFrame->timestamp_us()));
} }
return self; return self;
} }