diff options
Diffstat (limited to 'chromium/third_party/webrtc/common_video/i420_video_frame.cc')
-rw-r--r-- | chromium/third_party/webrtc/common_video/i420_video_frame.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/chromium/third_party/webrtc/common_video/i420_video_frame.cc b/chromium/third_party/webrtc/common_video/i420_video_frame.cc index e369ffe108f..fdc2bbc2305 100644 --- a/chromium/third_party/webrtc/common_video/i420_video_frame.cc +++ b/chromium/third_party/webrtc/common_video/i420_video_frame.cc @@ -10,6 +10,8 @@ #include "webrtc/common_video/interface/i420_video_frame.h" +#include <string.h> + #include <algorithm> // swap namespace webrtc { @@ -18,6 +20,7 @@ I420VideoFrame::I420VideoFrame() : width_(0), height_(0), timestamp_(0), + ntp_time_ms_(0), render_time_ms_(0) {} I420VideoFrame::~I420VideoFrame() {} @@ -37,6 +40,7 @@ int I420VideoFrame::CreateEmptyFrame(int width, int height, v_plane_.CreateEmptyPlane(size_v, stride_v, size_v); // Creating empty frame - reset all values. timestamp_ = 0; + ntp_time_ms_ = 0; render_time_ms_ = 0; return 0; } @@ -71,10 +75,20 @@ int I420VideoFrame::CopyFrame(const I420VideoFrame& videoFrame) { if (ret < 0) return ret; timestamp_ = videoFrame.timestamp_; + ntp_time_ms_ = videoFrame.ntp_time_ms_; render_time_ms_ = videoFrame.render_time_ms_; return 0; } +I420VideoFrame* I420VideoFrame::CloneFrame() const { + scoped_ptr<I420VideoFrame> new_frame(new I420VideoFrame()); + if (new_frame->CopyFrame(*this) == -1) { + // CopyFrame failed. + return NULL; + } + return new_frame.release(); +} + void I420VideoFrame::SwapFrame(I420VideoFrame* videoFrame) { y_plane_.Swap(videoFrame->y_plane_); u_plane_.Swap(videoFrame->u_plane_); @@ -82,6 +96,7 @@ void I420VideoFrame::SwapFrame(I420VideoFrame* videoFrame) { std::swap(width_, videoFrame->width_); std::swap(height_, videoFrame->height_); std::swap(timestamp_, videoFrame->timestamp_); + std::swap(ntp_time_ms_, videoFrame->ntp_time_ms_); std::swap(render_time_ms_, videoFrame->render_time_ms_); } |