Index: webrtc/common_video/video_frame.cc |
diff --git a/webrtc/common_video/video_frame.cc b/webrtc/common_video/video_frame.cc |
index 7145a623e65ef4837c7b216b528ae1575254506a..9a8f8ab3187e10d5f1eb15dc8226f3bcf23ef4e9 100644 |
--- a/webrtc/common_video/video_frame.cc |
+++ b/webrtc/common_video/video_frame.cc |
@@ -93,6 +93,15 @@ |
stride_uv, stride_uv, rotation); |
} |
+void VideoFrame::CopyFrame(const VideoFrame& videoFrame) { |
+ ShallowCopy(videoFrame); |
+ |
+ // 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) { |
video_frame_buffer_ = videoFrame.video_frame_buffer(); |
timestamp_rtp_ = videoFrame.timestamp_rtp_; |