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

Side by Side Diff: webrtc/modules/video_coding/packet_buffer.cc

Issue 2124943002: Added various timestamps to FrameObject. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Renamed |received_timestamp| to |received_time|. Created 4 years, 5 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) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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
11 #include "webrtc/modules/video_coding/packet_buffer.h" 11 #include "webrtc/modules/video_coding/packet_buffer.h"
12 12
13 #include <algorithm> 13 #include <algorithm>
14 #include <limits> 14 #include <limits>
15 15
16 #include "webrtc/base/checks.h" 16 #include "webrtc/base/checks.h"
17 #include "webrtc/base/logging.h" 17 #include "webrtc/base/logging.h"
18 #include "webrtc/modules/video_coding/frame_object.h" 18 #include "webrtc/modules/video_coding/frame_object.h"
19 #include "webrtc/system_wrappers/include/clock.h"
19 20
20 namespace webrtc { 21 namespace webrtc {
21 namespace video_coding { 22 namespace video_coding {
22 23
23 PacketBuffer::PacketBuffer(size_t start_buffer_size, 24 PacketBuffer::PacketBuffer(Clock* clock,
25 size_t start_buffer_size,
24 size_t max_buffer_size, 26 size_t max_buffer_size,
25 OnCompleteFrameCallback* frame_callback) 27 OnCompleteFrameCallback* frame_callback)
26 : size_(start_buffer_size), 28 : clock_(clock),
29 size_(start_buffer_size),
27 max_size_(max_buffer_size), 30 max_size_(max_buffer_size),
28 first_seq_num_(0), 31 first_seq_num_(0),
29 last_seq_num_(0), 32 last_seq_num_(0),
30 first_packet_received_(false), 33 first_packet_received_(false),
31 data_buffer_(start_buffer_size), 34 data_buffer_(start_buffer_size),
32 sequence_buffer_(start_buffer_size), 35 sequence_buffer_(start_buffer_size),
33 reference_finder_(frame_callback) { 36 reference_finder_(frame_callback) {
34 RTC_DCHECK_LE(start_buffer_size, max_buffer_size); 37 RTC_DCHECK_LE(start_buffer_size, max_buffer_size);
35 // Buffer size must always be a power of 2. 38 // Buffer size must always be a power of 2.
36 RTC_DCHECK((start_buffer_size & (start_buffer_size - 1)) == 0); 39 RTC_DCHECK((start_buffer_size & (start_buffer_size - 1)) == 0);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 max_nack_count, data_buffer_[start_index].timesNacked); 159 max_nack_count, data_buffer_[start_index].timesNacked);
157 sequence_buffer_[start_index].frame_created = true; 160 sequence_buffer_[start_index].frame_created = true;
158 161
159 if (sequence_buffer_[start_index].frame_begin) 162 if (sequence_buffer_[start_index].frame_begin)
160 break; 163 break;
161 164
162 start_index = start_index > 0 ? start_index - 1 : size_ - 1; 165 start_index = start_index > 0 ? start_index - 1 : size_ - 1;
163 start_seq_num--; 166 start_seq_num--;
164 } 167 }
165 168
166 std::unique_ptr<RtpFrameObject> frame(new RtpFrameObject( 169 std::unique_ptr<RtpFrameObject> frame(
167 this, start_seq_num, seq_num, frame_size, max_nack_count)); 170 new RtpFrameObject(this, start_seq_num, seq_num, frame_size,
171 max_nack_count, clock_->TimeInMilliseconds()));
168 reference_finder_.ManageFrame(std::move(frame)); 172 reference_finder_.ManageFrame(std::move(frame));
169 } 173 }
170 174
171 index = (index + 1) % size_; 175 index = (index + 1) % size_;
172 ++seq_num; 176 ++seq_num;
173 } 177 }
174 } 178 }
175 179
176 void PacketBuffer::ReturnFrame(RtpFrameObject* frame) { 180 void PacketBuffer::ReturnFrame(RtpFrameObject* frame) {
177 rtc::CritScope lock(&crit_); 181 rtc::CritScope lock(&crit_);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 void PacketBuffer::Clear() { 234 void PacketBuffer::Clear() {
231 rtc::CritScope lock(&crit_); 235 rtc::CritScope lock(&crit_);
232 for (size_t i = 0; i < size_; ++i) 236 for (size_t i = 0; i < size_; ++i)
233 sequence_buffer_[i].used = false; 237 sequence_buffer_[i].used = false;
234 238
235 first_packet_received_ = false; 239 first_packet_received_ = false;
236 } 240 }
237 241
238 } // namespace video_coding 242 } // namespace video_coding
239 } // namespace webrtc 243 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/packet_buffer.h ('k') | webrtc/modules/video_coding/video_packet_buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698