OLD | NEW |
---|---|
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 1154 matching lines...) Loading... | |
1165 ASSERT(signaling_thread()->IsCurrent()); | 1165 ASSERT(signaling_thread()->IsCurrent()); |
1166 if (!voice_channel_) { | 1166 if (!voice_channel_) { |
1167 LOG(LS_ERROR) << "SetAudioSend: No audio channel exists."; | 1167 LOG(LS_ERROR) << "SetAudioSend: No audio channel exists."; |
1168 return; | 1168 return; |
1169 } | 1169 } |
1170 if (!voice_channel_->SetLocalRenderer(ssrc, renderer)) { | 1170 if (!voice_channel_->SetLocalRenderer(ssrc, renderer)) { |
1171 // SetRenderer() can fail if the ssrc does not match any send channel. | 1171 // SetRenderer() can fail if the ssrc does not match any send channel. |
1172 LOG(LS_ERROR) << "SetAudioSend: ssrc is incorrect: " << ssrc; | 1172 LOG(LS_ERROR) << "SetAudioSend: ssrc is incorrect: " << ssrc; |
1173 return; | 1173 return; |
1174 } | 1174 } |
1175 if (!voice_channel_->MuteStream(ssrc, !enable)) { | 1175 if (!voice_channel_->MuteStream(ssrc, !enable, &options)) { |
pthatcher1
2015/09/04 23:21:16
I like this. We should take in one step further r
the sun
2015/09/08 11:31:12
I decided to take it even further and collapse Set
| |
1176 // Allow that MuteStream fail if |enable| is false but assert otherwise. | 1176 // Allow that MuteStream fail if |enable| is false but assert otherwise. |
1177 // This in the normal case when the underlying media channel has already | 1177 // This in the normal case when the underlying media channel has already |
1178 // been deleted. | 1178 // been deleted. |
1179 ASSERT(enable == false); | 1179 ASSERT(enable == false); |
1180 return; | |
1181 } | 1180 } |
1182 if (enable) | |
1183 voice_channel_->SetChannelOptions(options); | |
1184 } | 1181 } |
1185 | 1182 |
1186 void WebRtcSession::SetAudioPlayoutVolume(uint32 ssrc, double volume) { | 1183 void WebRtcSession::SetAudioPlayoutVolume(uint32 ssrc, double volume) { |
1187 ASSERT(signaling_thread()->IsCurrent()); | 1184 ASSERT(signaling_thread()->IsCurrent()); |
1188 ASSERT(volume >= 0 && volume <= 10); | 1185 ASSERT(volume >= 0 && volume <= 10); |
1189 if (!voice_channel_) { | 1186 if (!voice_channel_) { |
1190 LOG(LS_ERROR) << "SetAudioPlayoutVolume: No audio channel exists."; | 1187 LOG(LS_ERROR) << "SetAudioPlayoutVolume: No audio channel exists."; |
1191 return; | 1188 return; |
1192 } | 1189 } |
1193 | 1190 |
(...skipping 37 matching lines...) Loading... | |
1231 } | 1228 } |
1232 } | 1229 } |
1233 | 1230 |
1234 void WebRtcSession::SetVideoSend(uint32 ssrc, bool enable, | 1231 void WebRtcSession::SetVideoSend(uint32 ssrc, bool enable, |
1235 const cricket::VideoOptions* options) { | 1232 const cricket::VideoOptions* options) { |
1236 ASSERT(signaling_thread()->IsCurrent()); | 1233 ASSERT(signaling_thread()->IsCurrent()); |
1237 if (!video_channel_) { | 1234 if (!video_channel_) { |
1238 LOG(LS_WARNING) << "SetVideoSend: No video channel exists."; | 1235 LOG(LS_WARNING) << "SetVideoSend: No video channel exists."; |
1239 return; | 1236 return; |
1240 } | 1237 } |
1241 if (!video_channel_->MuteStream(ssrc, !enable)) { | 1238 if (!video_channel_->MuteStream(ssrc, !enable, options)) { |
1242 // Allow that MuteStream fail if |enable| is false but assert otherwise. | 1239 // Allow that MuteStream fail if |enable| is false but assert otherwise. |
1243 // This in the normal case when the underlying media channel has already | 1240 // This in the normal case when the underlying media channel has already |
1244 // been deleted. | 1241 // been deleted. |
1245 ASSERT(enable == false); | 1242 ASSERT(enable == false); |
1246 return; | |
1247 } | 1243 } |
1248 if (enable && options) | |
1249 video_channel_->SetChannelOptions(*options); | |
1250 } | 1244 } |
1251 | 1245 |
1252 bool WebRtcSession::CanInsertDtmf(const std::string& track_id) { | 1246 bool WebRtcSession::CanInsertDtmf(const std::string& track_id) { |
1253 ASSERT(signaling_thread()->IsCurrent()); | 1247 ASSERT(signaling_thread()->IsCurrent()); |
1254 if (!voice_channel_) { | 1248 if (!voice_channel_) { |
1255 LOG(LS_ERROR) << "CanInsertDtmf: No audio channel exists."; | 1249 LOG(LS_ERROR) << "CanInsertDtmf: No audio channel exists."; |
1256 return false; | 1250 return false; |
1257 } | 1251 } |
1258 uint32 send_ssrc = 0; | 1252 uint32 send_ssrc = 0; |
1259 // The Dtmf is negotiated per channel not ssrc, so we only check if the ssrc | 1253 // The Dtmf is negotiated per channel not ssrc, so we only check if the ssrc |
(...skipping 821 matching lines...) Loading... | |
2081 | 2075 |
2082 if (!srtp_cipher.empty()) { | 2076 if (!srtp_cipher.empty()) { |
2083 metrics_observer_->AddHistogramSample(srtp_name, srtp_cipher); | 2077 metrics_observer_->AddHistogramSample(srtp_name, srtp_cipher); |
2084 } | 2078 } |
2085 if (!ssl_cipher.empty()) { | 2079 if (!ssl_cipher.empty()) { |
2086 metrics_observer_->AddHistogramSample(ssl_name, ssl_cipher); | 2080 metrics_observer_->AddHistogramSample(ssl_name, ssl_cipher); |
2087 } | 2081 } |
2088 } | 2082 } |
2089 | 2083 |
2090 } // namespace webrtc | 2084 } // namespace webrtc |
OLD | NEW |