OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 2952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2963 // Get speech level. | 2963 // Get speech level. |
2964 rinfo.audio_level = (engine()->voe()->volume()-> | 2964 rinfo.audio_level = (engine()->voe()->volume()-> |
2965 GetSpeechOutputLevelFullRange(ch_id, level) != -1) ? level : -1; | 2965 GetSpeechOutputLevelFullRange(ch_id, level) != -1) ? level : -1; |
2966 info->receivers.push_back(rinfo); | 2966 info->receivers.push_back(rinfo); |
2967 } | 2967 } |
2968 } | 2968 } |
2969 | 2969 |
2970 return true; | 2970 return true; |
2971 } | 2971 } |
2972 | 2972 |
2973 void WebRtcVoiceMediaChannel::GetLastMediaError( | |
2974 uint32* ssrc, VoiceMediaChannel::Error* error) { | |
2975 RTC_DCHECK(ssrc != NULL); | |
2976 RTC_DCHECK(error != NULL); | |
2977 FindSsrc(voe_channel(), ssrc); | |
2978 *error = WebRtcErrorToChannelError(GetLastEngineError()); | |
2979 } | |
2980 | |
2981 bool WebRtcVoiceMediaChannel::FindSsrc(int channel_num, uint32* ssrc) { | 2973 bool WebRtcVoiceMediaChannel::FindSsrc(int channel_num, uint32* ssrc) { |
2982 rtc::CritScope lock(&receive_channels_cs_); | 2974 rtc::CritScope lock(&receive_channels_cs_); |
2983 RTC_DCHECK(ssrc != NULL); | 2975 RTC_DCHECK(ssrc != NULL); |
2984 if (channel_num == -1 && send_ != SEND_NOTHING) { | 2976 if (channel_num == -1 && send_ != SEND_NOTHING) { |
2985 // Sometimes the VoiceEngine core will throw error with channel_num = -1. | 2977 // Sometimes the VoiceEngine core will throw error with channel_num = -1. |
2986 // This means the error is not limited to a specific channel. Signal the | 2978 // This means the error is not limited to a specific channel. Signal the |
2987 // message using ssrc=0. If the current channel is sending, use this | 2979 // message using ssrc=0. If the current channel is sending, use this |
2988 // channel for sending the message. | 2980 // channel for sending the message. |
2989 *ssrc = 0; | 2981 *ssrc = 0; |
2990 return true; | 2982 return true; |
(...skipping 21 matching lines...) Expand all Loading... |
3012 } | 3004 } |
3013 return false; | 3005 return false; |
3014 } | 3006 } |
3015 | 3007 |
3016 void WebRtcVoiceMediaChannel::OnError(uint32 ssrc, int error) { | 3008 void WebRtcVoiceMediaChannel::OnError(uint32 ssrc, int error) { |
3017 if (error == VE_TYPING_NOISE_WARNING) { | 3009 if (error == VE_TYPING_NOISE_WARNING) { |
3018 typing_noise_detected_ = true; | 3010 typing_noise_detected_ = true; |
3019 } else if (error == VE_TYPING_NOISE_OFF_WARNING) { | 3011 } else if (error == VE_TYPING_NOISE_OFF_WARNING) { |
3020 typing_noise_detected_ = false; | 3012 typing_noise_detected_ = false; |
3021 } | 3013 } |
3022 SignalMediaError(ssrc, WebRtcErrorToChannelError(error)); | |
3023 } | 3014 } |
3024 | 3015 |
3025 int WebRtcVoiceMediaChannel::GetOutputLevel(int channel) { | 3016 int WebRtcVoiceMediaChannel::GetOutputLevel(int channel) { |
3026 unsigned int ulevel; | 3017 unsigned int ulevel; |
3027 int ret = | 3018 int ret = |
3028 engine()->voe()->volume()->GetSpeechOutputLevel(channel, ulevel); | 3019 engine()->voe()->volume()->GetSpeechOutputLevel(channel, ulevel); |
3029 return (ret == 0) ? static_cast<int>(ulevel) : -1; | 3020 return (ret == 0) ? static_cast<int>(ulevel) : -1; |
3030 } | 3021 } |
3031 | 3022 |
3032 int WebRtcVoiceMediaChannel::GetReceiveChannelNum(uint32 ssrc) const { | 3023 int WebRtcVoiceMediaChannel::GetReceiveChannelNum(uint32 ssrc) const { |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3260 LOG(LS_WARNING) << "Unknown codec " << ToString(codec); | 3251 LOG(LS_WARNING) << "Unknown codec " << ToString(codec); |
3261 return false; | 3252 return false; |
3262 } | 3253 } |
3263 } | 3254 } |
3264 return true; | 3255 return true; |
3265 } | 3256 } |
3266 | 3257 |
3267 } // namespace cricket | 3258 } // namespace cricket |
3268 | 3259 |
3269 #endif // HAVE_WEBRTC_VOICE | 3260 #endif // HAVE_WEBRTC_VOICE |
OLD | NEW |