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