Delete ShallowCopy, in favor of copy construction and assignment.

BUG=webrtc:6591

Review-Url: https://codereview.webrtc.org/2443123002
Cr-Commit-Position: refs/heads/master@{#14853}
This commit is contained in:
nisse 2016-10-31 08:05:50 -07:00 committed by Commit bot
parent c846f2f4c0
commit 67dca9f12e
7 changed files with 11 additions and 21 deletions

View File

@ -51,14 +51,6 @@ VideoFrame::VideoFrame(const rtc::scoped_refptr<VideoFrameBuffer>& buffer,
RTC_DCHECK(buffer);
}
void VideoFrame::ShallowCopy(const VideoFrame& videoFrame) {
video_frame_buffer_ = videoFrame.video_frame_buffer();
timestamp_rtp_ = videoFrame.timestamp_rtp_;
ntp_time_ms_ = videoFrame.ntp_time_ms_;
timestamp_us_ = videoFrame.timestamp_us_;
rotation_ = videoFrame.rotation_;
}
int VideoFrame::width() const {
return video_frame_buffer_ ? video_frame_buffer_->width() : 0;
}

View File

@ -178,7 +178,7 @@ void FakeVideoSendStream::OnFrame(const webrtc::VideoFrame& frame) {
video_streams_ = encoder_config_.video_stream_factory->CreateEncoderStreams(
frame.width(), frame.height(), encoder_config_);
}
last_frame_.ShallowCopy(frame);
last_frame_ = frame;
}
void FakeVideoSendStream::SetStats(

View File

@ -110,7 +110,7 @@ bool Vp8UnitTestDecodeCompleteCallback::DecodeComplete() {
}
int Vp8UnitTestDecodeCompleteCallback::Decoded(VideoFrame& image) {
decoded_frame_->ShallowCopy(image);
*decoded_frame_ = image;
decode_complete = true;
return 0;
}

View File

@ -249,8 +249,7 @@ void TestSize(const VideoFrame& source_frame,
WriteProcessedFrameForVisualInspection(source_frame, *out_frame);
// Scale |resampled_source_frame| back to the source scale.
VideoFrame resampled_source_frame;
resampled_source_frame.ShallowCopy(*out_frame);
VideoFrame resampled_source_frame(*out_frame);
// Compute PSNR against the cropped source frame and check expectation.
PreprocessFrameAndVerify(resampled_source_frame,
cropped_source.width(),

View File

@ -477,8 +477,8 @@ class VideoAnalyzer : public PacketReceiver,
rtc::CritScope crit(&comparison_lock_);
if (comparisons_.size() < kMaxComparisons) {
reference_copy.ShallowCopy(reference);
render_copy.ShallowCopy(render);
reference_copy = reference;
render_copy = render;
} else {
// Copy the time to ensure that delay calculations can still be made.
reference_copy.set_ntp_time_ms(reference.ntp_time_ms());

View File

@ -218,7 +218,7 @@ class ViEEncoder::EncodeTask : public rtc::QueuedTask {
: vie_encoder_(vie_encoder),
time_when_posted_ms_(time_when_posted_in_ms),
log_stats_(log_stats) {
frame_.ShallowCopy(frame);
frame_ = frame;
++vie_encoder_->posted_frames_waiting_for_encode_;
}

View File

@ -44,12 +44,11 @@ class VideoFrame {
int64_t render_time_ms,
VideoRotation rotation);
// Creates a shallow copy of |videoFrame|, i.e, the this object will retain a
// reference to the video buffer also retained by |videoFrame|.
// TODO(nisse): Deprecated. Should be deleted in the cricket::VideoFrame and
// webrtc::VideoFrame merge. Instead, pass video_frame_buffer() and timestamps
// to the constructor.
void ShallowCopy(const VideoFrame& videoFrame);
// Support move and copy.
VideoFrame(const VideoFrame&) = default;
VideoFrame(VideoFrame&&) = default;
VideoFrame& operator=(const VideoFrame&) = default;
VideoFrame& operator=(VideoFrame&&) = default;
// Get frame width.
int width() const;