OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 #include "webrtc/modules/video_coding/main/source/jitter_buffer.h" | 10 #include "webrtc/modules/video_coding/main/source/jitter_buffer.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 return diff / kVideoPayloadTypeFrequency >= kSsCleanupIntervalSec; | 161 return diff / kVideoPayloadTypeFrequency >= kSsCleanupIntervalSec; |
162 } | 162 } |
163 | 163 |
164 void Vp9SsMap::AdvanceFront(uint32_t timestamp) { | 164 void Vp9SsMap::AdvanceFront(uint32_t timestamp) { |
165 RTC_DCHECK(!ss_map_.empty()); | 165 RTC_DCHECK(!ss_map_.empty()); |
166 GofInfoVP9 gof = ss_map_.begin()->second; | 166 GofInfoVP9 gof = ss_map_.begin()->second; |
167 ss_map_.erase(ss_map_.begin()); | 167 ss_map_.erase(ss_map_.begin()); |
168 ss_map_[timestamp] = gof; | 168 ss_map_[timestamp] = gof; |
169 } | 169 } |
170 | 170 |
| 171 // TODO(asapersson): Update according to updates in RTP payload profile. |
171 bool Vp9SsMap::UpdatePacket(VCMPacket* packet) { | 172 bool Vp9SsMap::UpdatePacket(VCMPacket* packet) { |
172 uint8_t gof_idx = packet->codecSpecificHeader.codecHeader.VP9.gof_idx; | 173 uint8_t gof_idx = packet->codecSpecificHeader.codecHeader.VP9.gof_idx; |
173 if (gof_idx == kNoGofIdx) | 174 if (gof_idx == kNoGofIdx) |
174 return false; // No update needed. | 175 return false; // No update needed. |
175 | 176 |
176 SsMap::iterator it; | 177 SsMap::iterator it; |
177 if (!Find(packet->timestamp, &it)) | 178 if (!Find(packet->timestamp, &it)) |
178 return false; // Corresponding SS not yet received. | 179 return false; // Corresponding SS not yet received. |
179 | 180 |
180 if (gof_idx >= it->second.num_frames_in_gof) | 181 if (gof_idx >= it->second.num_frames_in_gof) |
181 return false; // Assume corresponding SS not yet received. | 182 return false; // Assume corresponding SS not yet received. |
182 | 183 |
183 RTPVideoHeaderVP9* vp9 = &packet->codecSpecificHeader.codecHeader.VP9; | 184 RTPVideoHeaderVP9* vp9 = &packet->codecSpecificHeader.codecHeader.VP9; |
184 vp9->temporal_idx = it->second.temporal_idx[gof_idx]; | 185 vp9->temporal_idx = it->second.temporal_idx[gof_idx]; |
185 vp9->temporal_up_switch = it->second.temporal_up_switch[gof_idx]; | 186 vp9->temporal_up_switch = it->second.temporal_up_switch[gof_idx]; |
186 | 187 |
187 // TODO(asapersson): Set vp9.ref_picture_id[i] and add usage. | 188 // TODO(asapersson): Set vp9.ref_picture_id[i] and add usage. |
188 vp9->num_ref_pics = it->second.num_ref_pics[gof_idx]; | 189 vp9->num_ref_pics = it->second.num_ref_pics[gof_idx]; |
189 for (size_t i = 0; i < it->second.num_ref_pics[gof_idx]; ++i) { | 190 for (uint8_t i = 0; i < it->second.num_ref_pics[gof_idx]; ++i) { |
190 vp9->pid_diff[i] = it->second.pid_diff[gof_idx][i]; | 191 vp9->pid_diff[i] = it->second.pid_diff[gof_idx][i]; |
191 } | 192 } |
192 return true; | 193 return true; |
193 } | 194 } |
194 | 195 |
195 void Vp9SsMap::UpdateFrames(FrameList* frames) { | 196 void Vp9SsMap::UpdateFrames(FrameList* frames) { |
196 for (const auto& frame_it : *frames) { | 197 for (const auto& frame_it : *frames) { |
197 uint8_t gof_idx = | 198 uint8_t gof_idx = |
198 frame_it.second->CodecSpecific()->codecSpecific.VP9.gof_idx; | 199 frame_it.second->CodecSpecific()->codecSpecific.VP9.gof_idx; |
199 if (gof_idx == kNoGofIdx) { | 200 if (gof_idx == kNoGofIdx) { |
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1318 } | 1319 } |
1319 // Evaluate if the RTT is higher than |high_rtt_nack_threshold_ms_|, and in | 1320 // Evaluate if the RTT is higher than |high_rtt_nack_threshold_ms_|, and in |
1320 // that case we don't wait for retransmissions. | 1321 // that case we don't wait for retransmissions. |
1321 if (high_rtt_nack_threshold_ms_ >= 0 && | 1322 if (high_rtt_nack_threshold_ms_ >= 0 && |
1322 rtt_ms_ >= high_rtt_nack_threshold_ms_) { | 1323 rtt_ms_ >= high_rtt_nack_threshold_ms_) { |
1323 return false; | 1324 return false; |
1324 } | 1325 } |
1325 return true; | 1326 return true; |
1326 } | 1327 } |
1327 } // namespace webrtc | 1328 } // namespace webrtc |
OLD | NEW |