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

Side by Side Diff: webrtc/media/engine/webrtcvideoframe.cc

Issue 2088953002: Add cricket::VideoFrame::frame_id() and set it to RTP timestamp. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: . Created 4 years, 4 months 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 10 matching lines...) Expand all
21 using webrtc::kVPlane; 21 using webrtc::kVPlane;
22 22
23 namespace cricket { 23 namespace cricket {
24 24
25 WebRtcVideoFrame::WebRtcVideoFrame() 25 WebRtcVideoFrame::WebRtcVideoFrame()
26 : timestamp_us_(0), rotation_(webrtc::kVideoRotation_0) {} 26 : timestamp_us_(0), rotation_(webrtc::kVideoRotation_0) {}
27 27
28 WebRtcVideoFrame::WebRtcVideoFrame( 28 WebRtcVideoFrame::WebRtcVideoFrame(
29 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer, 29 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer,
30 webrtc::VideoRotation rotation, 30 webrtc::VideoRotation rotation,
31 int64_t timestamp_us) 31 int64_t timestamp_us,
32 uint32_t transport_frame_id)
32 : video_frame_buffer_(buffer), 33 : video_frame_buffer_(buffer),
33 timestamp_us_(timestamp_us), 34 timestamp_us_(timestamp_us),
35 transport_frame_id_(transport_frame_id),
34 rotation_(rotation) {} 36 rotation_(rotation) {}
35 37
36 WebRtcVideoFrame::WebRtcVideoFrame( 38 WebRtcVideoFrame::WebRtcVideoFrame(
37 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer, 39 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer,
38 int64_t time_stamp_ns, 40 int64_t time_stamp_ns,
39 webrtc::VideoRotation rotation) 41 webrtc::VideoRotation rotation)
40 : WebRtcVideoFrame(buffer, 42 : WebRtcVideoFrame(buffer,
41 rotation, 43 rotation,
42 time_stamp_ns / rtc::kNumNanosecsPerMicrosec) {} 44 time_stamp_ns / rtc::kNumNanosecsPerMicrosec,
45 0) {}
43 46
44 WebRtcVideoFrame::~WebRtcVideoFrame() {} 47 WebRtcVideoFrame::~WebRtcVideoFrame() {}
45 48
46 bool WebRtcVideoFrame::Init(uint32_t format, 49 bool WebRtcVideoFrame::Init(uint32_t format,
47 int w, 50 int w,
48 int h, 51 int h,
49 int dw, 52 int dw,
50 int dh, 53 int dh,
51 uint8_t* sample, 54 uint8_t* sample,
52 size_t sample_size, 55 size_t sample_size,
(...skipping 18 matching lines...) Expand all
71 74
72 int WebRtcVideoFrame::height() const { 75 int WebRtcVideoFrame::height() const {
73 return video_frame_buffer_ ? video_frame_buffer_->height() : 0; 76 return video_frame_buffer_ ? video_frame_buffer_->height() : 0;
74 } 77 }
75 78
76 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& 79 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>&
77 WebRtcVideoFrame::video_frame_buffer() const { 80 WebRtcVideoFrame::video_frame_buffer() const {
78 return video_frame_buffer_; 81 return video_frame_buffer_;
79 } 82 }
80 83
84 uint32_t WebRtcVideoFrame::transport_frame_id() const {
85 return transport_frame_id_;
86 }
87
88 int64_t WebRtcVideoFrame::timestamp_us() const {
89 return timestamp_us_;
90 }
91
92 void WebRtcVideoFrame::set_timestamp_us(int64_t time_us) {
93 timestamp_us_ = time_us;
94 }
95
96 webrtc::VideoRotation WebRtcVideoFrame::rotation() const {
97 return rotation_;
98 }
99
81 VideoFrame* WebRtcVideoFrame::Copy() const { 100 VideoFrame* WebRtcVideoFrame::Copy() const {
82 return new WebRtcVideoFrame(video_frame_buffer_, rotation_, timestamp_us_); 101 return new WebRtcVideoFrame(video_frame_buffer_, rotation_, timestamp_us_,
102 transport_frame_id_);
83 } 103 }
84 104
85 size_t WebRtcVideoFrame::ConvertToRgbBuffer(uint32_t to_fourcc, 105 size_t WebRtcVideoFrame::ConvertToRgbBuffer(uint32_t to_fourcc,
86 uint8_t* buffer, 106 uint8_t* buffer,
87 size_t size, 107 size_t size,
88 int stride_rgb) const { 108 int stride_rgb) const {
89 RTC_CHECK(video_frame_buffer_); 109 RTC_CHECK(video_frame_buffer_);
90 RTC_CHECK(video_frame_buffer_->native_handle() == nullptr); 110 RTC_CHECK(video_frame_buffer_->native_handle() == nullptr);
91 return VideoFrame::ConvertToRgbBuffer(to_fourcc, buffer, size, stride_rgb); 111 return VideoFrame::ConvertToRgbBuffer(to_fourcc, buffer, size, stride_rgb);
92 } 112 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 // VideoRotation to libyuv::RotationMode. 208 // VideoRotation to libyuv::RotationMode.
189 int ret = libyuv::I420Rotate( 209 int ret = libyuv::I420Rotate(
190 video_frame_buffer_->DataY(), video_frame_buffer_->StrideY(), 210 video_frame_buffer_->DataY(), video_frame_buffer_->StrideY(),
191 video_frame_buffer_->DataU(), video_frame_buffer_->StrideU(), 211 video_frame_buffer_->DataU(), video_frame_buffer_->StrideU(),
192 video_frame_buffer_->DataV(), video_frame_buffer_->StrideV(), 212 video_frame_buffer_->DataV(), video_frame_buffer_->StrideV(),
193 buffer->MutableDataY(), buffer->StrideY(), buffer->MutableDataU(), 213 buffer->MutableDataY(), buffer->StrideY(), buffer->MutableDataU(),
194 buffer->StrideU(), buffer->MutableDataV(), buffer->StrideV(), 214 buffer->StrideU(), buffer->MutableDataV(), buffer->StrideV(),
195 current_width, current_height, 215 current_width, current_height,
196 static_cast<libyuv::RotationMode>(rotation())); 216 static_cast<libyuv::RotationMode>(rotation()));
197 if (ret == 0) { 217 if (ret == 0) {
198 rotated_frame_.reset( 218 rotated_frame_.reset(new WebRtcVideoFrame(
199 new WebRtcVideoFrame(buffer, webrtc::kVideoRotation_0, timestamp_us_)); 219 buffer, webrtc::kVideoRotation_0, timestamp_us_, transport_frame_id_));
200 } 220 }
201 221
202 return rotated_frame_.get(); 222 return rotated_frame_.get();
203 } 223 }
204 224
205 } // namespace cricket 225 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvideoframe.h ('k') | webrtc/sdk/objc/Framework/Classes/RTCVideoRendererAdapter.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698