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 2977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2988 // Get speech level. | 2988 // Get speech level. |
2989 rinfo.audio_level = (engine()->voe()->volume()-> | 2989 rinfo.audio_level = (engine()->voe()->volume()-> |
2990 GetSpeechOutputLevelFullRange(ch_id, level) != -1) ? level : -1; | 2990 GetSpeechOutputLevelFullRange(ch_id, level) != -1) ? level : -1; |
2991 info->receivers.push_back(rinfo); | 2991 info->receivers.push_back(rinfo); |
2992 } | 2992 } |
2993 } | 2993 } |
2994 | 2994 |
2995 return true; | 2995 return true; |
2996 } | 2996 } |
2997 | 2997 |
2998 void WebRtcVoiceMediaChannel::GetLastMediaError( | |
2999 uint32* ssrc, VoiceMediaChannel::Error* error) { | |
3000 RTC_DCHECK(ssrc != NULL); | |
3001 RTC_DCHECK(error != NULL); | |
3002 FindSsrc(voe_channel(), ssrc); | |
3003 *error = WebRtcErrorToChannelError(GetLastEngineError()); | |
3004 } | |
3005 | |
3006 bool WebRtcVoiceMediaChannel::FindSsrc(int channel_num, uint32* ssrc) { | 2998 bool WebRtcVoiceMediaChannel::FindSsrc(int channel_num, uint32* ssrc) { |
3007 rtc::CritScope lock(&receive_channels_cs_); | 2999 rtc::CritScope lock(&receive_channels_cs_); |
3008 RTC_DCHECK(ssrc != NULL); | 3000 RTC_DCHECK(ssrc != NULL); |
3009 if (channel_num == -1 && send_ != SEND_NOTHING) { | 3001 if (channel_num == -1 && send_ != SEND_NOTHING) { |
3010 // Sometimes the VoiceEngine core will throw error with channel_num = -1. | 3002 // Sometimes the VoiceEngine core will throw error with channel_num = -1. |
3011 // This means the error is not limited to a specific channel. Signal the | 3003 // This means the error is not limited to a specific channel. Signal the |
3012 // message using ssrc=0. If the current channel is sending, use this | 3004 // message using ssrc=0. If the current channel is sending, use this |
3013 // channel for sending the message. | 3005 // channel for sending the message. |
3014 *ssrc = 0; | 3006 *ssrc = 0; |
3015 return true; | 3007 return true; |
(...skipping 21 matching lines...) Expand all Loading... |
3037 } | 3029 } |
3038 return false; | 3030 return false; |
3039 } | 3031 } |
3040 | 3032 |
3041 void WebRtcVoiceMediaChannel::OnError(uint32 ssrc, int error) { | 3033 void WebRtcVoiceMediaChannel::OnError(uint32 ssrc, int error) { |
3042 if (error == VE_TYPING_NOISE_WARNING) { | 3034 if (error == VE_TYPING_NOISE_WARNING) { |
3043 typing_noise_detected_ = true; | 3035 typing_noise_detected_ = true; |
3044 } else if (error == VE_TYPING_NOISE_OFF_WARNING) { | 3036 } else if (error == VE_TYPING_NOISE_OFF_WARNING) { |
3045 typing_noise_detected_ = false; | 3037 typing_noise_detected_ = false; |
3046 } | 3038 } |
3047 SignalMediaError(ssrc, WebRtcErrorToChannelError(error)); | |
3048 } | 3039 } |
3049 | 3040 |
3050 int WebRtcVoiceMediaChannel::GetOutputLevel(int channel) { | 3041 int WebRtcVoiceMediaChannel::GetOutputLevel(int channel) { |
3051 unsigned int ulevel; | 3042 unsigned int ulevel; |
3052 int ret = | 3043 int ret = |
3053 engine()->voe()->volume()->GetSpeechOutputLevel(channel, ulevel); | 3044 engine()->voe()->volume()->GetSpeechOutputLevel(channel, ulevel); |
3054 return (ret == 0) ? static_cast<int>(ulevel) : -1; | 3045 return (ret == 0) ? static_cast<int>(ulevel) : -1; |
3055 } | 3046 } |
3056 | 3047 |
3057 int WebRtcVoiceMediaChannel::GetReceiveChannelNum(uint32 ssrc) const { | 3048 int WebRtcVoiceMediaChannel::GetReceiveChannelNum(uint32 ssrc) const { |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3285 LOG(LS_WARNING) << "Unknown codec " << ToString(codec); | 3276 LOG(LS_WARNING) << "Unknown codec " << ToString(codec); |
3286 return false; | 3277 return false; |
3287 } | 3278 } |
3288 } | 3279 } |
3289 return true; | 3280 return true; |
3290 } | 3281 } |
3291 | 3282 |
3292 } // namespace cricket | 3283 } // namespace cricket |
3293 | 3284 |
3294 #endif // HAVE_WEBRTC_VOICE | 3285 #endif // HAVE_WEBRTC_VOICE |
OLD | NEW |