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

Unified Diff: webrtc/api/video/video_frame.cc

Issue 2517173004: Move VideoFrame and related declarations to webrtc/api/video. (Closed)
Patch Set: Address include and comment nits. Created 4 years, 1 month 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/api/video/video_frame.cc
diff --git a/webrtc/common_video/video_frame.cc b/webrtc/api/video/video_frame.cc
similarity index 67%
copy from webrtc/common_video/video_frame.cc
copy to webrtc/api/video/video_frame.cc
index ab1a6bef408fdddce69fca01e510942fa645ca0d..c605dc3461a369cdf62ad3d265b8fe4c41e35cda 100644
--- a/webrtc/common_video/video_frame.cc
+++ b/webrtc/api/video/video_frame.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
+ * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
magjed_webrtc 2016/11/29 15:43:49 2016?
nisse-webrtc 2016/11/29 15:56:14 I just copied the copyright header along with the
magjed_webrtc 2016/11/29 16:40:26 The year has been changed from 2012 to 2014. This
kjellander_webrtc 2016/11/30 07:19:12 Year should be current year if it's a new file, th
nisse-webrtc 2016/11/30 11:26:03 It's moving parts of webrtc/video_frame.h, which h
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@@ -8,21 +8,13 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "webrtc/video_frame.h"
+#include "webrtc/api/video/video_frame.h"
-#include <string.h>
-
-#include <algorithm> // swap
-
-#include "webrtc/base/bind.h"
#include "webrtc/base/checks.h"
+#include "webrtc/base/timeutils.h"
pthatcher1 2016/11/30 00:48:28 Does this need to eventually be moved to webrtc/ap
nisse-webrtc 2016/11/30 11:26:03 This is the implementation file. As far as I under
namespace webrtc {
-// FFmpeg's decoder, used by H264DecoderImpl, requires up to 8 bytes padding due
-// to optimized bitstream readers. See avcodec_decode_video2.
-const size_t EncodedImage::kBufferPaddingBytesH264 = 8;
-
VideoFrame::VideoFrame()
: video_frame_buffer_(nullptr),
timestamp_rtp_(0),
@@ -51,6 +43,13 @@ VideoFrame::VideoFrame(const rtc::scoped_refptr<VideoFrameBuffer>& buffer,
RTC_DCHECK(buffer);
}
+VideoFrame::~VideoFrame() {}
magjed_webrtc 2016/11/29 15:43:49 maybe '= default' is better?
nisse-webrtc 2016/11/29 15:56:15 Makes sense.
nisse-webrtc 2016/11/30 11:26:03 Done.
+
+VideoFrame::VideoFrame(const VideoFrame&) = default;
+VideoFrame::VideoFrame(VideoFrame&&) = default;
+VideoFrame& VideoFrame::operator=(const VideoFrame&) = default;
+VideoFrame& VideoFrame::operator=(VideoFrame&&) = default;
+
int VideoFrame::width() const {
return video_frame_buffer_ ? video_frame_buffer_->width() : 0;
}
@@ -67,23 +66,13 @@ rtc::scoped_refptr<VideoFrameBuffer> VideoFrame::video_frame_buffer() const {
return video_frame_buffer_;
}
-size_t EncodedImage::GetBufferPaddingBytes(VideoCodecType codec_type) {
- switch (codec_type) {
- case kVideoCodecVP8:
- case kVideoCodecVP9:
- return 0;
- case kVideoCodecH264:
- return kBufferPaddingBytesH264;
- case kVideoCodecI420:
- case kVideoCodecRED:
- case kVideoCodecULPFEC:
- case kVideoCodecFlexfec:
- case kVideoCodecGeneric:
- case kVideoCodecUnknown:
- return 0;
- }
- RTC_NOTREACHED();
- return 0;
+void VideoFrame::set_render_time_ms(int64_t render_time_ms) {
+ set_timestamp_us(render_time_ms * rtc::kNumMicrosecsPerMillisec);
+ ;
magjed_webrtc 2016/11/29 15:43:49 nit: remove lonely semicolon.
nisse-webrtc 2016/11/30 11:26:03 Done.
+}
+
+int64_t VideoFrame::render_time_ms() const {
+ return timestamp_us() / rtc::kNumMicrosecsPerMillisec;
}
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698