You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

485 lines
18 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
  3. *
  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
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #include "call/rtp_payload_params.h"
  11. #include <stddef.h>
  12. #include <algorithm>
  13. #include "absl/container/inlined_vector.h"
  14. #include "absl/types/variant.h"
  15. #include "api/video/video_timing.h"
  16. #include "modules/video_coding/codecs/h264/include/h264_globals.h"
  17. #include "modules/video_coding/codecs/interface/common_constants.h"
  18. #include "modules/video_coding/codecs/vp8/include/vp8_globals.h"
  19. #include "modules/video_coding/codecs/vp9/include/vp9_globals.h"
  20. #include "rtc_base/arraysize.h"
  21. #include "rtc_base/checks.h"
  22. #include "rtc_base/logging.h"
  23. #include "rtc_base/random.h"
  24. #include "rtc_base/time_utils.h"
  25. #include "system_wrappers/include/field_trial.h"
  26. namespace webrtc {
  27. namespace {
  28. void PopulateRtpWithCodecSpecifics(const CodecSpecificInfo& info,
  29. absl::optional<int> spatial_index,
  30. RTPVideoHeader* rtp) {
  31. rtp->codec = info.codecType;
  32. switch (info.codecType) {
  33. case kVideoCodecVP8: {
  34. auto& vp8_header = rtp->video_type_header.emplace<RTPVideoHeaderVP8>();
  35. vp8_header.InitRTPVideoHeaderVP8();
  36. vp8_header.nonReference = info.codecSpecific.VP8.nonReference;
  37. vp8_header.temporalIdx = info.codecSpecific.VP8.temporalIdx;
  38. vp8_header.layerSync = info.codecSpecific.VP8.layerSync;
  39. vp8_header.keyIdx = info.codecSpecific.VP8.keyIdx;
  40. rtp->simulcastIdx = spatial_index.value_or(0);
  41. return;
  42. }
  43. case kVideoCodecVP9: {
  44. auto& vp9_header = rtp->video_type_header.emplace<RTPVideoHeaderVP9>();
  45. vp9_header.InitRTPVideoHeaderVP9();
  46. vp9_header.inter_pic_predicted =
  47. info.codecSpecific.VP9.inter_pic_predicted;
  48. vp9_header.flexible_mode = info.codecSpecific.VP9.flexible_mode;
  49. vp9_header.ss_data_available = info.codecSpecific.VP9.ss_data_available;
  50. vp9_header.non_ref_for_inter_layer_pred =
  51. info.codecSpecific.VP9.non_ref_for_inter_layer_pred;
  52. vp9_header.temporal_idx = info.codecSpecific.VP9.temporal_idx;
  53. vp9_header.temporal_up_switch = info.codecSpecific.VP9.temporal_up_switch;
  54. vp9_header.inter_layer_predicted =
  55. info.codecSpecific.VP9.inter_layer_predicted;
  56. vp9_header.gof_idx = info.codecSpecific.VP9.gof_idx;
  57. vp9_header.num_spatial_layers = info.codecSpecific.VP9.num_spatial_layers;
  58. if (vp9_header.num_spatial_layers > 1) {
  59. vp9_header.spatial_idx = spatial_index.value_or(kNoSpatialIdx);
  60. } else {
  61. vp9_header.spatial_idx = kNoSpatialIdx;
  62. }
  63. if (info.codecSpecific.VP9.ss_data_available) {
  64. vp9_header.spatial_layer_resolution_present =
  65. info.codecSpecific.VP9.spatial_layer_resolution_present;
  66. if (info.codecSpecific.VP9.spatial_layer_resolution_present) {
  67. for (size_t i = 0; i < info.codecSpecific.VP9.num_spatial_layers;
  68. ++i) {
  69. vp9_header.width[i] = info.codecSpecific.VP9.width[i];
  70. vp9_header.height[i] = info.codecSpecific.VP9.height[i];
  71. }
  72. }
  73. vp9_header.gof.CopyGofInfoVP9(info.codecSpecific.VP9.gof);
  74. }
  75. vp9_header.num_ref_pics = info.codecSpecific.VP9.num_ref_pics;
  76. for (int i = 0; i < info.codecSpecific.VP9.num_ref_pics; ++i) {
  77. vp9_header.pid_diff[i] = info.codecSpecific.VP9.p_diff[i];
  78. }
  79. vp9_header.end_of_picture = info.codecSpecific.VP9.end_of_picture;
  80. return;
  81. }
  82. case kVideoCodecH264: {
  83. auto& h264_header = rtp->video_type_header.emplace<RTPVideoHeaderH264>();
  84. h264_header.packetization_mode =
  85. info.codecSpecific.H264.packetization_mode;
  86. rtp->simulcastIdx = spatial_index.value_or(0);
  87. rtp->frame_marking.temporal_id = kNoTemporalIdx;
  88. if (info.codecSpecific.H264.temporal_idx != kNoTemporalIdx) {
  89. rtp->frame_marking.temporal_id = info.codecSpecific.H264.temporal_idx;
  90. rtp->frame_marking.layer_id = 0;
  91. rtp->frame_marking.independent_frame =
  92. info.codecSpecific.H264.idr_frame;
  93. rtp->frame_marking.base_layer_sync =
  94. info.codecSpecific.H264.base_layer_sync;
  95. }
  96. return;
  97. }
  98. case kVideoCodecMultiplex:
  99. case kVideoCodecGeneric:
  100. rtp->codec = kVideoCodecGeneric;
  101. rtp->simulcastIdx = spatial_index.value_or(0);
  102. return;
  103. default:
  104. return;
  105. }
  106. }
  107. void SetVideoTiming(const EncodedImage& image, VideoSendTiming* timing) {
  108. if (image.timing_.flags == VideoSendTiming::TimingFrameFlags::kInvalid ||
  109. image.timing_.flags == VideoSendTiming::TimingFrameFlags::kNotTriggered) {
  110. timing->flags = VideoSendTiming::TimingFrameFlags::kInvalid;
  111. return;
  112. }
  113. timing->encode_start_delta_ms = VideoSendTiming::GetDeltaCappedMs(
  114. image.capture_time_ms_, image.timing_.encode_start_ms);
  115. timing->encode_finish_delta_ms = VideoSendTiming::GetDeltaCappedMs(
  116. image.capture_time_ms_, image.timing_.encode_finish_ms);
  117. timing->packetization_finish_delta_ms = 0;
  118. timing->pacer_exit_delta_ms = 0;
  119. timing->network_timestamp_delta_ms = 0;
  120. timing->network2_timestamp_delta_ms = 0;
  121. timing->flags = image.timing_.flags;
  122. }
  123. } // namespace
  124. RtpPayloadParams::RtpPayloadParams(const uint32_t ssrc,
  125. const RtpPayloadState* state)
  126. : ssrc_(ssrc),
  127. generic_picture_id_experiment_(
  128. field_trial::IsEnabled("WebRTC-GenericPictureId")),
  129. generic_descriptor_experiment_(
  130. field_trial::IsEnabled("WebRTC-GenericDescriptor")) {
  131. for (auto& spatial_layer : last_shared_frame_id_)
  132. spatial_layer.fill(-1);
  133. buffer_id_to_frame_id_.fill(-1);
  134. Random random(rtc::TimeMicros());
  135. state_.picture_id =
  136. state ? state->picture_id : (random.Rand<int16_t>() & 0x7FFF);
  137. state_.tl0_pic_idx = state ? state->tl0_pic_idx : (random.Rand<uint8_t>());
  138. }
  139. RtpPayloadParams::RtpPayloadParams(const RtpPayloadParams& other) = default;
  140. RtpPayloadParams::~RtpPayloadParams() {}
  141. RTPVideoHeader RtpPayloadParams::GetRtpVideoHeader(
  142. const EncodedImage& image,
  143. const CodecSpecificInfo* codec_specific_info,
  144. int64_t shared_frame_id) {
  145. RTPVideoHeader rtp_video_header;
  146. if (codec_specific_info) {
  147. PopulateRtpWithCodecSpecifics(*codec_specific_info, image.SpatialIndex(),
  148. &rtp_video_header);
  149. }
  150. rtp_video_header.frame_type = image._frameType,
  151. rtp_video_header.rotation = image.rotation_;
  152. rtp_video_header.content_type = image.content_type_;
  153. rtp_video_header.playout_delay = image.playout_delay_;
  154. rtp_video_header.width = image._encodedWidth;
  155. rtp_video_header.height = image._encodedHeight;
  156. rtp_video_header.color_space = image.ColorSpace()
  157. ? absl::make_optional(*image.ColorSpace())
  158. : absl::nullopt;
  159. SetVideoTiming(image, &rtp_video_header.video_timing);
  160. const bool is_keyframe = image._frameType == VideoFrameType::kVideoFrameKey;
  161. const bool first_frame_in_picture =
  162. (codec_specific_info && codec_specific_info->codecType == kVideoCodecVP9)
  163. ? codec_specific_info->codecSpecific.VP9.first_frame_in_picture
  164. : true;
  165. SetCodecSpecific(&rtp_video_header, first_frame_in_picture);
  166. if (generic_descriptor_experiment_)
  167. SetGeneric(codec_specific_info, shared_frame_id, is_keyframe,
  168. &rtp_video_header);
  169. return rtp_video_header;
  170. }
  171. uint32_t RtpPayloadParams::ssrc() const {
  172. return ssrc_;
  173. }
  174. RtpPayloadState RtpPayloadParams::state() const {
  175. return state_;
  176. }
  177. void RtpPayloadParams::SetCodecSpecific(RTPVideoHeader* rtp_video_header,
  178. bool first_frame_in_picture) {
  179. // Always set picture id. Set tl0_pic_idx iff temporal index is set.
  180. if (first_frame_in_picture) {
  181. state_.picture_id = (static_cast<uint16_t>(state_.picture_id) + 1) & 0x7FFF;
  182. }
  183. if (rtp_video_header->codec == kVideoCodecVP8) {
  184. auto& vp8_header =
  185. absl::get<RTPVideoHeaderVP8>(rtp_video_header->video_type_header);
  186. vp8_header.pictureId = state_.picture_id;
  187. if (vp8_header.temporalIdx != kNoTemporalIdx) {
  188. if (vp8_header.temporalIdx == 0) {
  189. ++state_.tl0_pic_idx;
  190. }
  191. vp8_header.tl0PicIdx = state_.tl0_pic_idx;
  192. }
  193. }
  194. if (rtp_video_header->codec == kVideoCodecVP9) {
  195. auto& vp9_header =
  196. absl::get<RTPVideoHeaderVP9>(rtp_video_header->video_type_header);
  197. vp9_header.picture_id = state_.picture_id;
  198. // Note that in the case that we have no temporal layers but we do have
  199. // spatial layers, packets will carry layering info with a temporal_idx of
  200. // zero, and we then have to set and increment tl0_pic_idx.
  201. if (vp9_header.temporal_idx != kNoTemporalIdx ||
  202. vp9_header.spatial_idx != kNoSpatialIdx) {
  203. if (first_frame_in_picture &&
  204. (vp9_header.temporal_idx == 0 ||
  205. vp9_header.temporal_idx == kNoTemporalIdx)) {
  206. ++state_.tl0_pic_idx;
  207. }
  208. vp9_header.tl0_pic_idx = state_.tl0_pic_idx;
  209. }
  210. }
  211. if (rtp_video_header->codec == kVideoCodecH264) {
  212. if (rtp_video_header->frame_marking.temporal_id != kNoTemporalIdx) {
  213. if (rtp_video_header->frame_marking.temporal_id == 0) {
  214. ++state_.tl0_pic_idx;
  215. }
  216. rtp_video_header->frame_marking.tl0_pic_idx = state_.tl0_pic_idx;
  217. }
  218. }
  219. // There are currently two generic descriptors in WebRTC. The old descriptor
  220. // can not share a picture id space between simulcast streams, so we use the
  221. // |picture_id| in this case. We let the |picture_id| tag along in |frame_id|
  222. // until the old generic format can be removed.
  223. // TODO(philipel): Remove this when the new generic format has been fully
  224. // implemented.
  225. if (generic_picture_id_experiment_ &&
  226. rtp_video_header->codec == kVideoCodecGeneric) {
  227. rtp_video_header->generic.emplace().frame_id = state_.picture_id;
  228. }
  229. }
  230. void RtpPayloadParams::SetGeneric(const CodecSpecificInfo* codec_specific_info,
  231. int64_t frame_id,
  232. bool is_keyframe,
  233. RTPVideoHeader* rtp_video_header) {
  234. switch (rtp_video_header->codec) {
  235. case VideoCodecType::kVideoCodecGeneric:
  236. GenericToGeneric(frame_id, is_keyframe, rtp_video_header);
  237. return;
  238. case VideoCodecType::kVideoCodecVP8:
  239. if (codec_specific_info) {
  240. Vp8ToGeneric(codec_specific_info->codecSpecific.VP8, frame_id,
  241. is_keyframe, rtp_video_header);
  242. }
  243. return;
  244. case VideoCodecType::kVideoCodecVP9:
  245. // TODO(philipel): Implement VP9 to new generic descriptor.
  246. return;
  247. case VideoCodecType::kVideoCodecH264:
  248. if (codec_specific_info) {
  249. H264ToGeneric(codec_specific_info->codecSpecific.H264, frame_id,
  250. is_keyframe, rtp_video_header);
  251. }
  252. return;
  253. case VideoCodecType::kVideoCodecMultiplex:
  254. return;
  255. }
  256. RTC_NOTREACHED() << "Unsupported codec.";
  257. }
  258. void RtpPayloadParams::GenericToGeneric(int64_t shared_frame_id,
  259. bool is_keyframe,
  260. RTPVideoHeader* rtp_video_header) {
  261. RTPVideoHeader::GenericDescriptorInfo& generic =
  262. rtp_video_header->generic.emplace();
  263. generic.frame_id = shared_frame_id;
  264. if (is_keyframe) {
  265. last_shared_frame_id_[0].fill(-1);
  266. } else {
  267. int64_t frame_id = last_shared_frame_id_[0][0];
  268. RTC_DCHECK_NE(frame_id, -1);
  269. RTC_DCHECK_LT(frame_id, shared_frame_id);
  270. generic.dependencies.push_back(frame_id);
  271. }
  272. last_shared_frame_id_[0][0] = shared_frame_id;
  273. }
  274. void RtpPayloadParams::H264ToGeneric(const CodecSpecificInfoH264& h264_info,
  275. int64_t shared_frame_id,
  276. bool is_keyframe,
  277. RTPVideoHeader* rtp_video_header) {
  278. const int temporal_index =
  279. h264_info.temporal_idx != kNoTemporalIdx ? h264_info.temporal_idx : 0;
  280. if (temporal_index >= RtpGenericFrameDescriptor::kMaxTemporalLayers) {
  281. RTC_LOG(LS_WARNING) << "Temporal and/or spatial index is too high to be "
  282. "used with generic frame descriptor.";
  283. return;
  284. }
  285. RTPVideoHeader::GenericDescriptorInfo& generic =
  286. rtp_video_header->generic.emplace();
  287. generic.frame_id = shared_frame_id;
  288. generic.temporal_index = temporal_index;
  289. if (is_keyframe) {
  290. RTC_DCHECK_EQ(temporal_index, 0);
  291. last_shared_frame_id_[/*spatial index*/ 0].fill(-1);
  292. last_shared_frame_id_[/*spatial index*/ 0][temporal_index] =
  293. shared_frame_id;
  294. return;
  295. }
  296. if (h264_info.base_layer_sync) {
  297. int64_t tl0_frame_id = last_shared_frame_id_[/*spatial index*/ 0][0];
  298. for (int i = 1; i < RtpGenericFrameDescriptor::kMaxTemporalLayers; ++i) {
  299. if (last_shared_frame_id_[/*spatial index*/ 0][i] < tl0_frame_id) {
  300. last_shared_frame_id_[/*spatial index*/ 0][i] = -1;
  301. }
  302. }
  303. RTC_DCHECK_GE(tl0_frame_id, 0);
  304. RTC_DCHECK_LT(tl0_frame_id, shared_frame_id);
  305. generic.dependencies.push_back(tl0_frame_id);
  306. } else {
  307. for (int i = 0; i <= temporal_index; ++i) {
  308. int64_t frame_id = last_shared_frame_id_[/*spatial index*/ 0][i];
  309. if (frame_id != -1) {
  310. RTC_DCHECK_LT(frame_id, shared_frame_id);
  311. generic.dependencies.push_back(frame_id);
  312. }
  313. }
  314. }
  315. last_shared_frame_id_[/*spatial_index*/ 0][temporal_index] = shared_frame_id;
  316. }
  317. void RtpPayloadParams::Vp8ToGeneric(const CodecSpecificInfoVP8& vp8_info,
  318. int64_t shared_frame_id,
  319. bool is_keyframe,
  320. RTPVideoHeader* rtp_video_header) {
  321. const auto& vp8_header =
  322. absl::get<RTPVideoHeaderVP8>(rtp_video_header->video_type_header);
  323. const int spatial_index = 0;
  324. const int temporal_index =
  325. vp8_header.temporalIdx != kNoTemporalIdx ? vp8_header.temporalIdx : 0;
  326. if (temporal_index >= RtpGenericFrameDescriptor::kMaxTemporalLayers ||
  327. spatial_index >= RtpGenericFrameDescriptor::kMaxSpatialLayers) {
  328. RTC_LOG(LS_WARNING) << "Temporal and/or spatial index is too high to be "
  329. "used with generic frame descriptor.";
  330. return;
  331. }
  332. RTPVideoHeader::GenericDescriptorInfo& generic =
  333. rtp_video_header->generic.emplace();
  334. generic.frame_id = shared_frame_id;
  335. generic.spatial_index = spatial_index;
  336. generic.temporal_index = temporal_index;
  337. if (vp8_info.useExplicitDependencies) {
  338. SetDependenciesVp8New(vp8_info, shared_frame_id, is_keyframe,
  339. vp8_header.layerSync, &generic);
  340. } else {
  341. SetDependenciesVp8Deprecated(vp8_info, shared_frame_id, is_keyframe,
  342. spatial_index, temporal_index,
  343. vp8_header.layerSync, &generic);
  344. }
  345. }
  346. void RtpPayloadParams::SetDependenciesVp8Deprecated(
  347. const CodecSpecificInfoVP8& vp8_info,
  348. int64_t shared_frame_id,
  349. bool is_keyframe,
  350. int spatial_index,
  351. int temporal_index,
  352. bool layer_sync,
  353. RTPVideoHeader::GenericDescriptorInfo* generic) {
  354. RTC_DCHECK(!vp8_info.useExplicitDependencies);
  355. RTC_DCHECK(!new_version_used_.has_value() || !new_version_used_.value());
  356. new_version_used_ = false;
  357. if (is_keyframe) {
  358. RTC_DCHECK_EQ(temporal_index, 0);
  359. last_shared_frame_id_[spatial_index].fill(-1);
  360. last_shared_frame_id_[spatial_index][temporal_index] = shared_frame_id;
  361. return;
  362. }
  363. if (layer_sync) {
  364. int64_t tl0_frame_id = last_shared_frame_id_[spatial_index][0];
  365. for (int i = 1; i < RtpGenericFrameDescriptor::kMaxTemporalLayers; ++i) {
  366. if (last_shared_frame_id_[spatial_index][i] < tl0_frame_id) {
  367. last_shared_frame_id_[spatial_index][i] = -1;
  368. }
  369. }
  370. RTC_DCHECK_GE(tl0_frame_id, 0);
  371. RTC_DCHECK_LT(tl0_frame_id, shared_frame_id);
  372. generic->dependencies.push_back(tl0_frame_id);
  373. } else {
  374. for (int i = 0; i <= temporal_index; ++i) {
  375. int64_t frame_id = last_shared_frame_id_[spatial_index][i];
  376. if (frame_id != -1) {
  377. RTC_DCHECK_LT(frame_id, shared_frame_id);
  378. generic->dependencies.push_back(frame_id);
  379. }
  380. }
  381. }
  382. last_shared_frame_id_[spatial_index][temporal_index] = shared_frame_id;
  383. }
  384. void RtpPayloadParams::SetDependenciesVp8New(
  385. const CodecSpecificInfoVP8& vp8_info,
  386. int64_t shared_frame_id,
  387. bool is_keyframe,
  388. bool layer_sync,
  389. RTPVideoHeader::GenericDescriptorInfo* generic) {
  390. RTC_DCHECK(vp8_info.useExplicitDependencies);
  391. RTC_DCHECK(!new_version_used_.has_value() || new_version_used_.value());
  392. new_version_used_ = true;
  393. if (is_keyframe) {
  394. RTC_DCHECK_EQ(vp8_info.referencedBuffersCount, 0u);
  395. buffer_id_to_frame_id_.fill(shared_frame_id);
  396. return;
  397. }
  398. constexpr size_t kBuffersCountVp8 = CodecSpecificInfoVP8::kBuffersCount;
  399. RTC_DCHECK_GT(vp8_info.referencedBuffersCount, 0u);
  400. RTC_DCHECK_LE(vp8_info.referencedBuffersCount,
  401. arraysize(vp8_info.referencedBuffers));
  402. for (size_t i = 0; i < vp8_info.referencedBuffersCount; ++i) {
  403. const size_t referenced_buffer = vp8_info.referencedBuffers[i];
  404. RTC_DCHECK_LT(referenced_buffer, kBuffersCountVp8);
  405. RTC_DCHECK_LT(referenced_buffer, buffer_id_to_frame_id_.size());
  406. const int64_t dependency_frame_id =
  407. buffer_id_to_frame_id_[referenced_buffer];
  408. RTC_DCHECK_GE(dependency_frame_id, 0);
  409. RTC_DCHECK_LT(dependency_frame_id, shared_frame_id);
  410. const bool is_new_dependency =
  411. std::find(generic->dependencies.begin(), generic->dependencies.end(),
  412. dependency_frame_id) == generic->dependencies.end();
  413. if (is_new_dependency) {
  414. generic->dependencies.push_back(dependency_frame_id);
  415. }
  416. }
  417. RTC_DCHECK_LE(vp8_info.updatedBuffersCount, kBuffersCountVp8);
  418. for (size_t i = 0; i < vp8_info.updatedBuffersCount; ++i) {
  419. const size_t updated_id = vp8_info.updatedBuffers[i];
  420. buffer_id_to_frame_id_[updated_id] = shared_frame_id;
  421. }
  422. RTC_DCHECK_LE(buffer_id_to_frame_id_.size(), kBuffersCountVp8);
  423. }
  424. } // namespace webrtc