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 |
11 #include "webrtc/logging/rtc_event_log/rtc_event_log_parser.h" | 11 #include "webrtc/logging/rtc_event_log/rtc_event_log_parser.h" |
12 | 12 |
| 13 #include <stdint.h> |
13 #include <string.h> | 14 #include <string.h> |
14 | 15 |
| 16 #include <algorithm> |
15 #include <fstream> | 17 #include <fstream> |
16 #include <istream> | 18 #include <istream> |
17 #include <utility> | 19 #include <utility> |
18 | 20 |
19 #include "webrtc/base/checks.h" | 21 #include "webrtc/base/checks.h" |
20 #include "webrtc/base/logging.h" | 22 #include "webrtc/base/logging.h" |
21 #include "webrtc/call/call.h" | 23 #include "webrtc/call/call.h" |
22 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 24 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
23 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 25 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
24 #include "webrtc/system_wrappers/include/file_wrapper.h" | 26 #include "webrtc/system_wrappers/include/file_wrapper.h" |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 RTC_CHECK(receiver_config.has_remote_ssrc()); | 309 RTC_CHECK(receiver_config.has_remote_ssrc()); |
308 config->rtp.remote_ssrc = receiver_config.remote_ssrc(); | 310 config->rtp.remote_ssrc = receiver_config.remote_ssrc(); |
309 RTC_CHECK(receiver_config.has_local_ssrc()); | 311 RTC_CHECK(receiver_config.has_local_ssrc()); |
310 config->rtp.local_ssrc = receiver_config.local_ssrc(); | 312 config->rtp.local_ssrc = receiver_config.local_ssrc(); |
311 // Get RTCP settings. | 313 // Get RTCP settings. |
312 RTC_CHECK(receiver_config.has_rtcp_mode()); | 314 RTC_CHECK(receiver_config.has_rtcp_mode()); |
313 config->rtp.rtcp_mode = GetRuntimeRtcpMode(receiver_config.rtcp_mode()); | 315 config->rtp.rtcp_mode = GetRuntimeRtcpMode(receiver_config.rtcp_mode()); |
314 RTC_CHECK(receiver_config.has_remb()); | 316 RTC_CHECK(receiver_config.has_remb()); |
315 config->rtp.remb = receiver_config.remb(); | 317 config->rtp.remb = receiver_config.remb(); |
316 // Get RTX map. | 318 // Get RTX map. |
317 config->rtp.rtx.clear(); | 319 std::vector<uint32_t> rtx_ssrcs(receiver_config.rtx_map_size()); |
| 320 config->rtp.rtx_payload_types.clear(); |
318 for (int i = 0; i < receiver_config.rtx_map_size(); i++) { | 321 for (int i = 0; i < receiver_config.rtx_map_size(); i++) { |
319 const rtclog::RtxMap& map = receiver_config.rtx_map(i); | 322 const rtclog::RtxMap& map = receiver_config.rtx_map(i); |
320 RTC_CHECK(map.has_payload_type()); | 323 RTC_CHECK(map.has_payload_type()); |
321 RTC_CHECK(map.has_config()); | 324 RTC_CHECK(map.has_config()); |
322 RTC_CHECK(map.config().has_rtx_ssrc()); | 325 RTC_CHECK(map.config().has_rtx_ssrc()); |
| 326 rtx_ssrcs[i] = map.config().rtx_ssrc(); |
323 RTC_CHECK(map.config().has_rtx_payload_type()); | 327 RTC_CHECK(map.config().has_rtx_payload_type()); |
324 webrtc::VideoReceiveStream::Config::Rtp::Rtx rtx_pair; | 328 config->rtp.rtx_payload_types.insert( |
325 rtx_pair.ssrc = map.config().rtx_ssrc(); | 329 std::make_pair(map.payload_type(), map.config().rtx_payload_type())); |
326 rtx_pair.payload_type = map.config().rtx_payload_type(); | 330 } |
327 config->rtp.rtx.insert(std::make_pair(map.payload_type(), rtx_pair)); | 331 if (!rtx_ssrcs.empty()) { |
| 332 config->rtp.rtx_ssrc = rtx_ssrcs[0]; |
| 333 |
| 334 auto pred = [&config](uint32_t ssrc) { |
| 335 return ssrc == config->rtp.rtx_ssrc; |
| 336 }; |
| 337 if (!std::all_of(rtx_ssrcs.cbegin(), rtx_ssrcs.cend(), pred)) { |
| 338 LOG(LS_WARNING) << "RtcEventLog protobuf contained different SSRCs for " |
| 339 "different received RTX payload types. Will only use " |
| 340 "rtx_ssrc = " |
| 341 << config->rtp.rtx_ssrc << "."; |
| 342 } |
328 } | 343 } |
329 // Get header extensions. | 344 // Get header extensions. |
330 GetHeaderExtensions(&config->rtp.extensions, | 345 GetHeaderExtensions(&config->rtp.extensions, |
331 receiver_config.header_extensions()); | 346 receiver_config.header_extensions()); |
332 // Get decoders. | 347 // Get decoders. |
333 config->decoders.clear(); | 348 config->decoders.clear(); |
334 for (int i = 0; i < receiver_config.decoders_size(); i++) { | 349 for (int i = 0; i < receiver_config.decoders_size(); i++) { |
335 RTC_CHECK(receiver_config.decoders(i).has_name()); | 350 RTC_CHECK(receiver_config.decoders(i).has_name()); |
336 RTC_CHECK(receiver_config.decoders(i).has_payload_type()); | 351 RTC_CHECK(receiver_config.decoders(i).has_payload_type()); |
337 VideoReceiveStream::Decoder decoder; | 352 VideoReceiveStream::Decoder decoder; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 if (ana_event.has_frame_length_ms()) | 490 if (ana_event.has_frame_length_ms()) |
476 config->frame_length_ms = rtc::Optional<int>(ana_event.frame_length_ms()); | 491 config->frame_length_ms = rtc::Optional<int>(ana_event.frame_length_ms()); |
477 if (ana_event.has_num_channels()) | 492 if (ana_event.has_num_channels()) |
478 config->num_channels = rtc::Optional<size_t>(ana_event.num_channels()); | 493 config->num_channels = rtc::Optional<size_t>(ana_event.num_channels()); |
479 if (ana_event.has_uplink_packet_loss_fraction()) | 494 if (ana_event.has_uplink_packet_loss_fraction()) |
480 config->uplink_packet_loss_fraction = | 495 config->uplink_packet_loss_fraction = |
481 rtc::Optional<float>(ana_event.uplink_packet_loss_fraction()); | 496 rtc::Optional<float>(ana_event.uplink_packet_loss_fraction()); |
482 } | 497 } |
483 | 498 |
484 } // namespace webrtc | 499 } // namespace webrtc |
OLD | NEW |