| Index: webrtc/media/engine/webrtcvideoframe.cc
|
| diff --git a/webrtc/media/engine/webrtcvideoframe.cc b/webrtc/media/engine/webrtcvideoframe.cc
|
| index 9c18235bb67de87291d341a2fbd0c7951a09cf61..b7d87a5bded645df9a5d6e233216e73de7ab21a3 100644
|
| --- a/webrtc/media/engine/webrtcvideoframe.cc
|
| +++ b/webrtc/media/engine/webrtcvideoframe.cc
|
| @@ -22,24 +22,18 @@
|
|
|
| namespace cricket {
|
|
|
| -WebRtcVideoFrame::WebRtcVideoFrame()
|
| - : timestamp_us_(0), rotation_(webrtc::kVideoRotation_0) {}
|
| -
|
| -WebRtcVideoFrame::WebRtcVideoFrame(
|
| - const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer,
|
| - webrtc::VideoRotation rotation,
|
| - int64_t timestamp_us)
|
| - : video_frame_buffer_(buffer),
|
| - timestamp_us_(timestamp_us),
|
| - rotation_(rotation) {}
|
| +WebRtcVideoFrame::WebRtcVideoFrame():
|
| + time_stamp_ns_(0),
|
| + rotation_(webrtc::kVideoRotation_0) {}
|
|
|
| WebRtcVideoFrame::WebRtcVideoFrame(
|
| const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer,
|
| int64_t time_stamp_ns,
|
| webrtc::VideoRotation rotation)
|
| - : WebRtcVideoFrame(buffer,
|
| - rotation,
|
| - time_stamp_ns / rtc::kNumNanosecsPerMicrosec) {}
|
| + : video_frame_buffer_(buffer),
|
| + time_stamp_ns_(time_stamp_ns),
|
| + rotation_(rotation) {
|
| +}
|
|
|
| WebRtcVideoFrame::~WebRtcVideoFrame() {}
|
|
|
| @@ -53,7 +47,7 @@
|
| int64_t time_stamp_ns,
|
| webrtc::VideoRotation rotation) {
|
| return Reset(format, w, h, dw, dh, sample, sample_size,
|
| - time_stamp_ns / rtc::kNumNanosecsPerMicrosec, rotation,
|
| + time_stamp_ns, rotation,
|
| true /*apply_rotation*/);
|
| }
|
|
|
| @@ -61,7 +55,7 @@
|
| bool apply_rotation) {
|
| return Reset(frame->fourcc, frame->width, frame->height, dw, dh,
|
| static_cast<uint8_t*>(frame->data), frame->data_size,
|
| - frame->time_stamp / rtc::kNumNanosecsPerMicrosec,
|
| + frame->time_stamp,
|
| frame->rotation, apply_rotation);
|
| }
|
|
|
| @@ -132,7 +126,9 @@
|
| }
|
|
|
| VideoFrame* WebRtcVideoFrame::Copy() const {
|
| - return new WebRtcVideoFrame(video_frame_buffer_, rotation_, timestamp_us_);
|
| + WebRtcVideoFrame* new_frame = new WebRtcVideoFrame(
|
| + video_frame_buffer_, time_stamp_ns_, rotation_);
|
| + return new_frame;
|
| }
|
|
|
| size_t WebRtcVideoFrame::ConvertToRgbBuffer(uint32_t to_fourcc,
|
| @@ -151,7 +147,7 @@
|
| int dh,
|
| uint8_t* sample,
|
| size_t sample_size,
|
| - int64_t timestamp_us,
|
| + int64_t time_stamp_ns,
|
| webrtc::VideoRotation rotation,
|
| bool apply_rotation) {
|
| if (!Validate(format, w, h, sample, sample_size)) {
|
| @@ -170,7 +166,8 @@
|
| new_height = dw;
|
| }
|
|
|
| - InitToEmptyBuffer(new_width, new_height);
|
| + InitToEmptyBuffer(new_width, new_height,
|
| + time_stamp_ns);
|
| rotation_ = apply_rotation ? webrtc::kVideoRotation_0 : rotation;
|
|
|
| int horiz_crop = ((w - dw) / 2) & ~1;
|
| @@ -195,27 +192,21 @@
|
| << " return code : " << r;
|
| return false;
|
| }
|
| - timestamp_us_ = timestamp_us;
|
| return true;
|
| }
|
|
|
| -VideoFrame* WebRtcVideoFrame::CreateEmptyFrame(int w,
|
| - int h,
|
| - int64_t timestamp_us) const {
|
| +VideoFrame* WebRtcVideoFrame::CreateEmptyFrame(
|
| + int w, int h,
|
| + int64_t time_stamp_ns) const {
|
| WebRtcVideoFrame* frame = new WebRtcVideoFrame();
|
| - frame->InitToEmptyBuffer(w, h, rtc::kNumNanosecsPerMicrosec * timestamp_us);
|
| + frame->InitToEmptyBuffer(w, h, time_stamp_ns);
|
| return frame;
|
| -}
|
| -
|
| -void WebRtcVideoFrame::InitToEmptyBuffer(int w, int h) {
|
| - video_frame_buffer_ = new rtc::RefCountedObject<webrtc::I420Buffer>(w, h);
|
| - rotation_ = webrtc::kVideoRotation_0;
|
| }
|
|
|
| void WebRtcVideoFrame::InitToEmptyBuffer(int w, int h,
|
| int64_t time_stamp_ns) {
|
| video_frame_buffer_ = new rtc::RefCountedObject<webrtc::I420Buffer>(w, h);
|
| - SetTimeStamp(time_stamp_ns);
|
| + time_stamp_ns_ = time_stamp_ns;
|
| rotation_ = webrtc::kVideoRotation_0;
|
| }
|
|
|
| @@ -246,8 +237,8 @@
|
| rotated_height = orig_width;
|
| }
|
|
|
| - rotated_frame_.reset(
|
| - CreateEmptyFrame(rotated_width, rotated_height, timestamp_us_));
|
| + rotated_frame_.reset(CreateEmptyFrame(rotated_width, rotated_height,
|
| + GetTimeStamp()));
|
|
|
| // TODO(guoweis): Add a function in webrtc_libyuv.cc to convert from
|
| // VideoRotation to libyuv::RotationMode.
|
|
|