| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  *  Copyright 2016 The WebRTC Project Authors. All rights reserved. | 2  *  Copyright 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 107     case DataChannelInterface::kClosing: | 107     case DataChannelInterface::kClosing: | 
| 108       return RTCDataChannelState::kClosing; | 108       return RTCDataChannelState::kClosing; | 
| 109     case DataChannelInterface::kClosed: | 109     case DataChannelInterface::kClosed: | 
| 110       return RTCDataChannelState::kClosed; | 110       return RTCDataChannelState::kClosed; | 
| 111     default: | 111     default: | 
| 112       RTC_NOTREACHED(); | 112       RTC_NOTREACHED(); | 
| 113       return nullptr; | 113       return nullptr; | 
| 114   } | 114   } | 
| 115 } | 115 } | 
| 116 | 116 | 
|  | 117 const char* IceCandidatePairStateToRTCStatsIceCandidatePairState( | 
|  | 118     cricket::IceCandidatePairState state) { | 
|  | 119   switch (state) { | 
|  | 120     case cricket::IceCandidatePairState::WAITING: | 
|  | 121       return RTCStatsIceCandidatePairState::kWaiting; | 
|  | 122     case cricket::IceCandidatePairState::IN_PROGRESS: | 
|  | 123       return RTCStatsIceCandidatePairState::kInProgress; | 
|  | 124     case cricket::IceCandidatePairState::SUCCEEDED: | 
|  | 125       return RTCStatsIceCandidatePairState::kSucceeded; | 
|  | 126     case cricket::IceCandidatePairState::FAILED: | 
|  | 127       return RTCStatsIceCandidatePairState::kFailed; | 
|  | 128     default: | 
|  | 129       RTC_NOTREACHED(); | 
|  | 130       return nullptr; | 
|  | 131   } | 
|  | 132 } | 
|  | 133 | 
| 117 std::unique_ptr<RTCCodecStats> CodecStatsFromRtpCodecParameters( | 134 std::unique_ptr<RTCCodecStats> CodecStatsFromRtpCodecParameters( | 
| 118     uint64_t timestamp_us, bool inbound, bool audio, | 135     uint64_t timestamp_us, bool inbound, bool audio, | 
| 119     const RtpCodecParameters& codec_params) { | 136     const RtpCodecParameters& codec_params) { | 
| 120   RTC_DCHECK_GE(codec_params.payload_type, 0); | 137   RTC_DCHECK_GE(codec_params.payload_type, 0); | 
| 121   RTC_DCHECK_LE(codec_params.payload_type, 127); | 138   RTC_DCHECK_LE(codec_params.payload_type, 127); | 
| 122   uint32_t payload_type = static_cast<uint32_t>(codec_params.payload_type); | 139   uint32_t payload_type = static_cast<uint32_t>(codec_params.payload_type); | 
| 123   std::unique_ptr<RTCCodecStats> codec_stats(new RTCCodecStats( | 140   std::unique_ptr<RTCCodecStats> codec_stats(new RTCCodecStats( | 
| 124       RTCCodecStatsIDFromDirectionMediaAndPayload(inbound, audio, payload_type), | 141       RTCCodecStatsIDFromDirectionMediaAndPayload(inbound, audio, payload_type), | 
| 125       timestamp_us)); | 142       timestamp_us)); | 
| 126   codec_stats->payload_type = payload_type; | 143   codec_stats->payload_type = payload_type; | 
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 639 | 656 | 
| 640         candidate_pair_stats->transport_id = transport_id; | 657         candidate_pair_stats->transport_id = transport_id; | 
| 641         // TODO(hbos): There could be other candidates that are not paired with | 658         // TODO(hbos): There could be other candidates that are not paired with | 
| 642         // anything. We don't have a complete list. Local candidates come from | 659         // anything. We don't have a complete list. Local candidates come from | 
| 643         // Port objects, and prflx candidates (both local and remote) are only | 660         // Port objects, and prflx candidates (both local and remote) are only | 
| 644         // stored in candidate pairs. crbug.com/632723 | 661         // stored in candidate pairs. crbug.com/632723 | 
| 645         candidate_pair_stats->local_candidate_id = ProduceIceCandidateStats( | 662         candidate_pair_stats->local_candidate_id = ProduceIceCandidateStats( | 
| 646             timestamp_us, info.local_candidate, true, report); | 663             timestamp_us, info.local_candidate, true, report); | 
| 647         candidate_pair_stats->remote_candidate_id = ProduceIceCandidateStats( | 664         candidate_pair_stats->remote_candidate_id = ProduceIceCandidateStats( | 
| 648             timestamp_us, info.remote_candidate, false, report); | 665             timestamp_us, info.remote_candidate, false, report); | 
|  | 666         candidate_pair_stats->state = | 
|  | 667             IceCandidatePairStateToRTCStatsIceCandidatePairState(info.state); | 
|  | 668         candidate_pair_stats->priority = info.priority; | 
| 649         // TODO(hbos): This writable is different than the spec. It goes to | 669         // TODO(hbos): This writable is different than the spec. It goes to | 
| 650         // false after a certain amount of time without a response passes. | 670         // false after a certain amount of time without a response passes. | 
| 651         // crbug.com/633550 | 671         // crbug.com/633550 | 
| 652         candidate_pair_stats->writable = info.writable; | 672         candidate_pair_stats->writable = info.writable; | 
| 653         candidate_pair_stats->bytes_sent = | 673         candidate_pair_stats->bytes_sent = | 
| 654             static_cast<uint64_t>(info.sent_total_bytes); | 674             static_cast<uint64_t>(info.sent_total_bytes); | 
| 655         candidate_pair_stats->bytes_received = | 675         candidate_pair_stats->bytes_received = | 
| 656             static_cast<uint64_t>(info.recv_total_bytes); | 676             static_cast<uint64_t>(info.recv_total_bytes); | 
| 657         // TODO(hbos): The |info.rtt| measurement is smoothed. It shouldn't be | 677         // TODO(hbos): The |info.rtt| measurement is smoothed. It shouldn't be | 
| 658         // smoothed according to the spec. crbug.com/633550. See | 678         // smoothed according to the spec. crbug.com/633550. See | 
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 946     const std::string& type) { | 966     const std::string& type) { | 
| 947   return CandidateTypeToRTCIceCandidateType(type); | 967   return CandidateTypeToRTCIceCandidateType(type); | 
| 948 } | 968 } | 
| 949 | 969 | 
| 950 const char* DataStateToRTCDataChannelStateForTesting( | 970 const char* DataStateToRTCDataChannelStateForTesting( | 
| 951     DataChannelInterface::DataState state) { | 971     DataChannelInterface::DataState state) { | 
| 952   return DataStateToRTCDataChannelState(state); | 972   return DataStateToRTCDataChannelState(state); | 
| 953 } | 973 } | 
| 954 | 974 | 
| 955 }  // namespace webrtc | 975 }  // namespace webrtc | 
| OLD | NEW | 
|---|