Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Unified Diff: webrtc/common_video/video_frame.cc

Issue 1881953002: Delete method webrtc::VideoFrame::native_handle. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Add missing braces. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/common_video/i420_video_frame_unittest.cc ('k') | webrtc/modules/video_coding/video_sender.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common_video/video_frame.cc
diff --git a/webrtc/common_video/video_frame.cc b/webrtc/common_video/video_frame.cc
index a30f658ea0eae9d246e952a87ff4fc3b73b36a23..28e463112c87434690e3ded3c45069be834def6c 100644
--- a/webrtc/common_video/video_frame.cc
+++ b/webrtc/common_video/video_frame.cc
@@ -113,22 +113,12 @@ void VideoFrame::CreateFrame(const uint8_t* buffer,
}
void VideoFrame::CopyFrame(const VideoFrame& videoFrame) {
- if (videoFrame.IsZeroSize()) {
- video_frame_buffer_ = nullptr;
- } else if (videoFrame.native_handle()) {
- video_frame_buffer_ = videoFrame.video_frame_buffer();
- } else {
- CreateFrame(videoFrame.buffer(kYPlane), videoFrame.buffer(kUPlane),
- videoFrame.buffer(kVPlane), videoFrame.width(),
- videoFrame.height(), videoFrame.stride(kYPlane),
- videoFrame.stride(kUPlane), videoFrame.stride(kVPlane),
- kVideoRotation_0);
- }
+ ShallowCopy(videoFrame);
- timestamp_ = videoFrame.timestamp_;
- ntp_time_ms_ = videoFrame.ntp_time_ms_;
- render_time_ms_ = videoFrame.render_time_ms_;
- rotation_ = videoFrame.rotation_;
+ // If backed by a plain memory buffer, create a new, non-shared, copy.
+ if (video_frame_buffer_ && !video_frame_buffer_->native_handle()) {
+ video_frame_buffer_ = I420Buffer::Copy(video_frame_buffer_);
+ }
}
void VideoFrame::ShallowCopy(const VideoFrame& videoFrame) {
@@ -177,10 +167,6 @@ bool VideoFrame::IsZeroSize() const {
return !video_frame_buffer_;
}
-void* VideoFrame::native_handle() const {
- return video_frame_buffer_ ? video_frame_buffer_->native_handle() : nullptr;
-}
-
rtc::scoped_refptr<VideoFrameBuffer> VideoFrame::video_frame_buffer() const {
return video_frame_buffer_;
}
@@ -191,7 +177,7 @@ void VideoFrame::set_video_frame_buffer(
}
VideoFrame VideoFrame::ConvertNativeToI420Frame() const {
- RTC_DCHECK(native_handle());
+ RTC_DCHECK(video_frame_buffer_->native_handle());
VideoFrame frame;
frame.ShallowCopy(*this);
frame.set_video_frame_buffer(video_frame_buffer_->NativeToI420Buffer());
« no previous file with comments | « webrtc/common_video/i420_video_frame_unittest.cc ('k') | webrtc/modules/video_coding/video_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698