mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-16 15:20:42 +01:00

In https://webrtc-review.googlesource.com/c/src/+/1560 we moved WebRTC from src/webrtc to src/ (in order to preserve an healthy git history). This CL takes care of fixing header guards, #include paths, etc... NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true TBR=tommi@webrtc.org Bug: chromium:611808 Change-Id: Iea91618212bee0af16aa3f05071eab8f93706578 Reviewed-on: https://webrtc-review.googlesource.com/1561 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Henrik Kjellander <kjellander@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#19846}
66 lines
2 KiB
C++
66 lines
2 KiB
C++
/*
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* 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
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#include "api/video/video_frame.h"
|
|
|
|
#include "rtc_base/checks.h"
|
|
#include "rtc_base/timeutils.h"
|
|
|
|
namespace webrtc {
|
|
|
|
VideoFrame::VideoFrame(const rtc::scoped_refptr<VideoFrameBuffer>& buffer,
|
|
webrtc::VideoRotation rotation,
|
|
int64_t timestamp_us)
|
|
: video_frame_buffer_(buffer),
|
|
timestamp_rtp_(0),
|
|
ntp_time_ms_(0),
|
|
timestamp_us_(timestamp_us),
|
|
rotation_(rotation) {}
|
|
|
|
VideoFrame::VideoFrame(const rtc::scoped_refptr<VideoFrameBuffer>& buffer,
|
|
uint32_t timestamp,
|
|
int64_t render_time_ms,
|
|
VideoRotation rotation)
|
|
: video_frame_buffer_(buffer),
|
|
timestamp_rtp_(timestamp),
|
|
ntp_time_ms_(0),
|
|
timestamp_us_(render_time_ms * rtc::kNumMicrosecsPerMillisec),
|
|
rotation_(rotation) {
|
|
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;
|
|
}
|
|
|
|
int VideoFrame::height() const {
|
|
return video_frame_buffer_ ? video_frame_buffer_->height() : 0;
|
|
}
|
|
|
|
uint32_t VideoFrame::size() const {
|
|
return width() * height();
|
|
}
|
|
|
|
rtc::scoped_refptr<VideoFrameBuffer> VideoFrame::video_frame_buffer() const {
|
|
return video_frame_buffer_;
|
|
}
|
|
|
|
int64_t VideoFrame::render_time_ms() const {
|
|
return timestamp_us() / rtc::kNumMicrosecsPerMillisec;
|
|
}
|
|
|
|
} // namespace webrtc
|