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

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: Make EqualFramesVector and ExpectEqualFramesVector ignore timestamps. 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
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..cda25ccf45d8425052f3fd43c62920f0d7785d80 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,9 +167,11 @@ bool VideoFrame::IsZeroSize() const {
return !video_frame_buffer_;
}
+#if ENABLE_WEBRTC_VIDEOFRAME_NATIVE_HANDLE
perkj_webrtc 2016/04/13 05:44:08 ?
nisse-webrtc 2016/04/13 07:28:50 I wanted to disable the code temporarily for a cq
void* VideoFrame::native_handle() const {
return video_frame_buffer_ ? video_frame_buffer_->native_handle() : nullptr;
}
+#endif
rtc::scoped_refptr<VideoFrameBuffer> VideoFrame::video_frame_buffer() const {
return video_frame_buffer_;
@@ -191,7 +183,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());

Powered by Google App Engine
This is Rietveld 408576698