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

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, 6 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 frame_id)
32 : video_frame_buffer_(buffer), 33 : video_frame_buffer_(buffer),
33 timestamp_us_(timestamp_us), 34 timestamp_us_(timestamp_us),
35 frame_id_(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::frame_id() const {
85 return 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 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 rotated_frame_->video_frame_buffer()->StrideV(), 233 rotated_frame_->video_frame_buffer()->StrideV(),
214 orig_width, orig_height, 234 orig_width, orig_height,
215 static_cast<libyuv::RotationMode>(rotation())); 235 static_cast<libyuv::RotationMode>(rotation()));
216 if (ret == 0) { 236 if (ret == 0) {
217 return rotated_frame_.get(); 237 return rotated_frame_.get();
218 } 238 }
219 return nullptr; 239 return nullptr;
220 } 240 }
221 241
222 } // namespace cricket 242 } // namespace cricket
OLDNEW
« webrtc/media/engine/webrtcvideoengine2.cc ('K') | « webrtc/media/engine/webrtcvideoframe.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698