| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 RTC_DCHECK_GE(audio_level, 0); | 163 RTC_DCHECK_GE(audio_level, 0); |
| 164 RTC_DCHECK_LE(audio_level, 32767); | 164 RTC_DCHECK_LE(audio_level, 32767); |
| 165 return audio_level / 32767.0; | 165 return audio_level / 32767.0; |
| 166 } | 166 } |
| 167 | 167 |
| 168 std::unique_ptr<RTCCodecStats> CodecStatsFromRtpCodecParameters( | 168 std::unique_ptr<RTCCodecStats> CodecStatsFromRtpCodecParameters( |
| 169 uint64_t timestamp_us, bool inbound, bool audio, | 169 uint64_t timestamp_us, bool inbound, bool audio, |
| 170 const RtpCodecParameters& codec_params) { | 170 const RtpCodecParameters& codec_params) { |
| 171 RTC_DCHECK_GE(codec_params.payload_type, 0); | 171 RTC_DCHECK_GE(codec_params.payload_type, 0); |
| 172 RTC_DCHECK_LE(codec_params.payload_type, 127); | 172 RTC_DCHECK_LE(codec_params.payload_type, 127); |
| 173 RTC_DCHECK(codec_params.clock_rate); |
| 173 uint32_t payload_type = static_cast<uint32_t>(codec_params.payload_type); | 174 uint32_t payload_type = static_cast<uint32_t>(codec_params.payload_type); |
| 174 std::unique_ptr<RTCCodecStats> codec_stats(new RTCCodecStats( | 175 std::unique_ptr<RTCCodecStats> codec_stats(new RTCCodecStats( |
| 175 RTCCodecStatsIDFromDirectionMediaAndPayload(inbound, audio, payload_type), | 176 RTCCodecStatsIDFromDirectionMediaAndPayload(inbound, audio, payload_type), |
| 176 timestamp_us)); | 177 timestamp_us)); |
| 177 codec_stats->payload_type = payload_type; | 178 codec_stats->payload_type = payload_type; |
| 178 codec_stats->codec = (audio ? "audio/" : "video/") + codec_params.mime_type; | 179 codec_stats->codec = codec_params.mime_type(); |
| 179 codec_stats->clock_rate = static_cast<uint32_t>(codec_params.clock_rate); | 180 if (codec_params.clock_rate) { |
| 181 codec_stats->clock_rate = static_cast<uint32_t>(*codec_params.clock_rate); |
| 182 } |
| 180 return codec_stats; | 183 return codec_stats; |
| 181 } | 184 } |
| 182 | 185 |
| 183 void SetMediaStreamTrackStatsFromMediaStreamTrackInterface( | 186 void SetMediaStreamTrackStatsFromMediaStreamTrackInterface( |
| 184 const MediaStreamTrackInterface& track, | 187 const MediaStreamTrackInterface& track, |
| 185 RTCMediaStreamTrackStats* track_stats) { | 188 RTCMediaStreamTrackStats* track_stats) { |
| 186 track_stats->track_identifier = track.id(); | 189 track_stats->track_identifier = track.id(); |
| 187 track_stats->ended = (track.state() == MediaStreamTrackInterface::kEnded); | 190 track_stats->ended = (track.state() == MediaStreamTrackInterface::kEnded); |
| 188 } | 191 } |
| 189 | 192 |
| (...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1222 const std::string& type) { | 1225 const std::string& type) { |
| 1223 return CandidateTypeToRTCIceCandidateType(type); | 1226 return CandidateTypeToRTCIceCandidateType(type); |
| 1224 } | 1227 } |
| 1225 | 1228 |
| 1226 const char* DataStateToRTCDataChannelStateForTesting( | 1229 const char* DataStateToRTCDataChannelStateForTesting( |
| 1227 DataChannelInterface::DataState state) { | 1230 DataChannelInterface::DataState state) { |
| 1228 return DataStateToRTCDataChannelState(state); | 1231 return DataStateToRTCDataChannelState(state); |
| 1229 } | 1232 } |
| 1230 | 1233 |
| 1231 } // namespace webrtc | 1234 } // namespace webrtc |
| OLD | NEW |