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

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

Issue 2517173004: Move VideoFrame and related declarations to webrtc/api/video. (Closed)
Patch Set: Rebased. Created 4 years 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 70%
copy from webrtc/common_video/video_frame.cc
copy to webrtc/api/video/video_frame.cc
index ab1a6bef408fdddce69fca01e510942fa645ca0d..6b2d11f948410339cbb89f2a305e04e49a90f217 100644
--- a/webrtc/common_video/video_frame.cc
+++ b/webrtc/api/video/video_frame.cc
@@ -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"
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() = default;
+
+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,12 @@ 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);
+}
+
+int64_t VideoFrame::render_time_ms() const {
+ return timestamp_us() / rtc::kNumMicrosecsPerMillisec;
}
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698