Delete unused cricket::VideoFrame methods MakeExclusive and CopyToFrame.
BUG=webrtc:5682 Review URL: https://codereview.webrtc.org/1843413002 Cr-Commit-Position: refs/heads/master@{#12188}
This commit is contained in:
parent
63a2c13d6d
commit
60083c86fa
@ -82,10 +82,6 @@
|
||||
return _videoFrame->GetVPitch();
|
||||
}
|
||||
|
||||
- (BOOL)makeExclusive {
|
||||
return _videoFrame->MakeExclusive();
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation RTCI420Frame (Internal)
|
||||
|
||||
@ -43,8 +43,6 @@
|
||||
@property(nonatomic, readonly) NSInteger uPitch;
|
||||
@property(nonatomic, readonly) NSInteger vPitch;
|
||||
|
||||
- (BOOL)makeExclusive;
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
// Disallow init and don't add to documentation
|
||||
- (id)init __attribute__((
|
||||
@ -52,4 +50,3 @@
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@ -46,16 +46,6 @@ bool VideoFrame::CopyToPlanes(uint8_t* dst_y,
|
||||
src_width, src_height) == 0;
|
||||
}
|
||||
|
||||
void VideoFrame::CopyToFrame(VideoFrame* dst) const {
|
||||
if (!dst) {
|
||||
LOG(LS_ERROR) << "NULL dst pointer.";
|
||||
return;
|
||||
}
|
||||
|
||||
CopyToPlanes(dst->GetYPlane(), dst->GetUPlane(), dst->GetVPlane(),
|
||||
dst->GetYPitch(), dst->GetUPitch(), dst->GetVPitch());
|
||||
}
|
||||
|
||||
size_t VideoFrame::ConvertToRgbBuffer(uint32_t to_fourcc,
|
||||
uint8_t* buffer,
|
||||
size_t size,
|
||||
|
||||
@ -88,15 +88,6 @@ class VideoFrame {
|
||||
// be shared, this function can be used to check exclusive ownership.
|
||||
virtual bool IsExclusive() const = 0;
|
||||
|
||||
// In case VideoFrame needs exclusive access of the frame buffer, user can
|
||||
// call MakeExclusive() to make sure the frame buffer is exclusively
|
||||
// accessible to the current object. This might mean a deep copy of the frame
|
||||
// buffer if it is currently shared by other objects.
|
||||
virtual bool MakeExclusive() = 0;
|
||||
|
||||
// Writes the frame into the target VideoFrame.
|
||||
virtual void CopyToFrame(VideoFrame* target) const;
|
||||
|
||||
// Return a copy of frame which has its pending rotation applied. The
|
||||
// ownership of the returned frame is held by this frame.
|
||||
virtual const VideoFrame* GetCopyWithRotationApplied() const = 0;
|
||||
|
||||
@ -1807,37 +1807,6 @@ class VideoFrameTest : public testing::Test {
|
||||
EXPECT_EQ(const_source->GetVPlane(), target->GetVPlane());
|
||||
}
|
||||
|
||||
void MakeExclusive() {
|
||||
std::unique_ptr<T> source(new T);
|
||||
std::unique_ptr<cricket::VideoFrame> target;
|
||||
ASSERT_TRUE(LoadFrameNoRepeat(source.get()));
|
||||
target.reset(source->Copy());
|
||||
EXPECT_TRUE(target->MakeExclusive());
|
||||
EXPECT_TRUE(IsEqual(*source, *target, 0));
|
||||
EXPECT_NE(target->GetYPlane(), source->GetYPlane());
|
||||
EXPECT_NE(target->GetUPlane(), source->GetUPlane());
|
||||
EXPECT_NE(target->GetVPlane(), source->GetVPlane());
|
||||
}
|
||||
|
||||
void CopyToFrame() {
|
||||
T source;
|
||||
std::unique_ptr<rtc::MemoryStream> ms(
|
||||
LoadSample(kImageFilename));
|
||||
ASSERT_TRUE(ms.get() != NULL);
|
||||
ASSERT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_I420, kWidth, kHeight,
|
||||
&source));
|
||||
|
||||
// Create the target frame by loading from a file.
|
||||
T target;
|
||||
ASSERT_TRUE(LoadFrameNoRepeat(&target));
|
||||
EXPECT_FALSE(IsBlack(target));
|
||||
|
||||
// Stretch and check if the stretched target is black.
|
||||
source.CopyToFrame(&target);
|
||||
|
||||
EXPECT_TRUE(IsEqual(source, target, 0));
|
||||
}
|
||||
|
||||
void StretchToFrame() {
|
||||
// Create the source frame as a black frame.
|
||||
T source;
|
||||
|
||||
@ -131,30 +131,6 @@ VideoFrame* WebRtcVideoFrame::Copy() const {
|
||||
return new_frame;
|
||||
}
|
||||
|
||||
bool WebRtcVideoFrame::MakeExclusive() {
|
||||
RTC_DCHECK(video_frame_buffer_->native_handle() == nullptr);
|
||||
if (IsExclusive())
|
||||
return true;
|
||||
|
||||
// Not exclusive already, need to copy buffer.
|
||||
rtc::scoped_refptr<webrtc::VideoFrameBuffer> new_buffer =
|
||||
new rtc::RefCountedObject<webrtc::I420Buffer>(
|
||||
video_frame_buffer_->width(), video_frame_buffer_->height(),
|
||||
video_frame_buffer_->stride(kYPlane),
|
||||
video_frame_buffer_->stride(kUPlane),
|
||||
video_frame_buffer_->stride(kVPlane));
|
||||
|
||||
if (!CopyToPlanes(
|
||||
new_buffer->MutableData(kYPlane), new_buffer->MutableData(kUPlane),
|
||||
new_buffer->MutableData(kVPlane), new_buffer->stride(kYPlane),
|
||||
new_buffer->stride(kUPlane), new_buffer->stride(kVPlane))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
video_frame_buffer_ = new_buffer;
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t WebRtcVideoFrame::ConvertToRgbBuffer(uint32_t to_fourcc,
|
||||
uint8_t* buffer,
|
||||
size_t size,
|
||||
|
||||
@ -91,7 +91,6 @@ class WebRtcVideoFrame : public VideoFrame {
|
||||
|
||||
VideoFrame* Copy() const override;
|
||||
bool IsExclusive() const override;
|
||||
bool MakeExclusive() override;
|
||||
size_t ConvertToRgbBuffer(uint32_t to_fourcc,
|
||||
uint8_t* buffer,
|
||||
size_t size,
|
||||
|
||||
@ -235,13 +235,11 @@ TEST_WEBRTCVIDEOFRAME(ConvertFromUYVYBuffer)
|
||||
TEST_WEBRTCVIDEOFRAME(ConvertFromUYVYBufferStride)
|
||||
TEST_WEBRTCVIDEOFRAME(ConvertFromUYVYBufferInverted)
|
||||
// TEST_WEBRTCVIDEOFRAME(ConvertToI422Buffer)
|
||||
TEST_WEBRTCVIDEOFRAME(CopyToFrame)
|
||||
// TEST_WEBRTCVIDEOFRAME(ConstructARGBBlackWhitePixel)
|
||||
|
||||
TEST_WEBRTCVIDEOFRAME(StretchToFrame)
|
||||
TEST_WEBRTCVIDEOFRAME(Copy)
|
||||
TEST_WEBRTCVIDEOFRAME(CopyIsRef)
|
||||
TEST_WEBRTCVIDEOFRAME(MakeExclusive)
|
||||
|
||||
// These functions test implementation-specific details.
|
||||
// Tests the Init function with different cropped size.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user