OLD | NEW |
---|---|
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 |
(...skipping 10 matching lines...) Expand all Loading... | |
21 #include "webrtc/system_wrappers/include/clock.h" | 21 #include "webrtc/system_wrappers/include/clock.h" |
22 | 22 |
23 namespace webrtc { | 23 namespace webrtc { |
24 namespace video_coding { | 24 namespace video_coding { |
25 | 25 |
26 namespace { | 26 namespace { |
27 // Max number of frames the buffer will hold. | 27 // Max number of frames the buffer will hold. |
28 constexpr int kMaxFramesBuffered = 600; | 28 constexpr int kMaxFramesBuffered = 600; |
29 | 29 |
30 // Max number of decoded frame info that will be saved. | 30 // Max number of decoded frame info that will be saved. |
31 constexpr int kMaxFramesHistory = 20; | 31 constexpr int kMaxFramesHistory = 50; |
32 } // namespace | 32 } // namespace |
33 | 33 |
34 FrameBuffer::FrameBuffer(Clock* clock, | 34 FrameBuffer::FrameBuffer(Clock* clock, |
35 VCMJitterEstimator* jitter_estimator, | 35 VCMJitterEstimator* jitter_estimator, |
36 VCMTiming* timing) | 36 VCMTiming* timing) |
37 : clock_(clock), | 37 : clock_(clock), |
38 new_countinuous_frame_event_(false, false), | 38 new_countinuous_frame_event_(false, false), |
39 jitter_estimator_(jitter_estimator), | 39 jitter_estimator_(jitter_estimator), |
40 timing_(timing), | 40 timing_(timing), |
41 inter_frame_delay_(clock_->TimeInMilliseconds()), | 41 inter_frame_delay_(clock_->TimeInMilliseconds()), |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 } // rtc::Critscope lock(&crit_); | 107 } // rtc::Critscope lock(&crit_); |
108 | 108 |
109 wait_ms = std::min<int64_t>(wait_ms, latest_return_time - now_ms); | 109 wait_ms = std::min<int64_t>(wait_ms, latest_return_time - now_ms); |
110 wait_ms = std::max<int64_t>(wait_ms, 0); | 110 wait_ms = std::max<int64_t>(wait_ms, 0); |
111 } while (new_countinuous_frame_event_.Wait(wait_ms)); | 111 } while (new_countinuous_frame_event_.Wait(wait_ms)); |
112 | 112 |
113 rtc::CritScope lock(&crit_); | 113 rtc::CritScope lock(&crit_); |
114 if (next_frame_it != frames_.end()) { | 114 if (next_frame_it != frames_.end()) { |
115 std::unique_ptr<FrameObject> frame = std::move(next_frame_it->second.frame); | 115 std::unique_ptr<FrameObject> frame = std::move(next_frame_it->second.frame); |
116 int64_t received_time = frame->ReceivedTime(); | 116 int64_t received_time = frame->ReceivedTime(); |
117 uint32_t timestamp = frame->Timestamp(); | 117 uint32_t timestamp = frame->timestamp; |
nisse-webrtc
2016/11/08 11:56:30
Would be better with an accessor method also for t
philipel
2016/11/08 12:28:39
I agree on the accessor method, but just "timestam
danilchap
2016/11/08 12:37:21
may be rename it to rtp_timestamp
nisse-webrtc
2016/11/08 12:58:12
Ouch. Does it really have to be a codec-specific u
philipel
2016/11/08 13:35:51
Sounds good, WDYT stefan@?
philipel
2016/11/08 13:35:51
Well, for VP8/VP9/H264 the timestamp is a 90 kHz c
nisse-webrtc
2016/11/11 07:53:12
It makes some sense to me, if that's what it is us
| |
118 | 118 |
119 int64_t frame_delay; | 119 int64_t frame_delay; |
120 if (inter_frame_delay_.CalculateDelay(timestamp, &frame_delay, | 120 if (inter_frame_delay_.CalculateDelay(timestamp, &frame_delay, |
121 received_time)) { | 121 received_time)) { |
122 jitter_estimator_->UpdateEstimate(frame_delay, frame->size()); | 122 jitter_estimator_->UpdateEstimate(frame_delay, frame->size()); |
123 } | 123 } |
124 float rtt_mult = protection_mode_ == kProtectionNackFEC ? 0.0 : 1.0; | 124 float rtt_mult = protection_mode_ == kProtectionNackFEC ? 0.0 : 1.0; |
125 timing_->SetJitterDelay(jitter_estimator_->GetJitterEstimate(rtt_mult)); | 125 timing_->SetJitterDelay(jitter_estimator_->GetJitterEstimate(rtt_mult)); |
126 timing_->UpdateCurrentDelay(frame->RenderTime(), | 126 timing_->UpdateCurrentDelay(frame->RenderTime(), |
127 clock_->TimeInMilliseconds()); | 127 clock_->TimeInMilliseconds()); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
348 } | 348 } |
349 | 349 |
350 RTC_DCHECK_LE(info->second.num_missing_continuous, | 350 RTC_DCHECK_LE(info->second.num_missing_continuous, |
351 info->second.num_missing_decodable); | 351 info->second.num_missing_decodable); |
352 | 352 |
353 return true; | 353 return true; |
354 } | 354 } |
355 | 355 |
356 } // namespace video_coding | 356 } // namespace video_coding |
357 } // namespace webrtc | 357 } // namespace webrtc |
OLD | NEW |