| 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 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1175 } | 1175 } | 
| 1176 | 1176 | 
| 1177 void WebRtcSession::SetAudioSend(uint32 ssrc, bool enable, | 1177 void WebRtcSession::SetAudioSend(uint32 ssrc, bool enable, | 
| 1178                                  const cricket::AudioOptions& options, | 1178                                  const cricket::AudioOptions& options, | 
| 1179                                  cricket::AudioRenderer* renderer) { | 1179                                  cricket::AudioRenderer* renderer) { | 
| 1180   ASSERT(signaling_thread()->IsCurrent()); | 1180   ASSERT(signaling_thread()->IsCurrent()); | 
| 1181   if (!voice_channel_) { | 1181   if (!voice_channel_) { | 
| 1182     LOG(LS_ERROR) << "SetAudioSend: No audio channel exists."; | 1182     LOG(LS_ERROR) << "SetAudioSend: No audio channel exists."; | 
| 1183     return; | 1183     return; | 
| 1184   } | 1184   } | 
| 1185   if (!voice_channel_->SetLocalRenderer(ssrc, renderer)) { | 1185   if (!voice_channel_->SetAudioSend(ssrc, !enable, &options, renderer)) { | 
| 1186     // SetRenderer() can fail if the ssrc does not match any send channel. |  | 
| 1187     LOG(LS_ERROR) << "SetAudioSend: ssrc is incorrect: " << ssrc; | 1186     LOG(LS_ERROR) << "SetAudioSend: ssrc is incorrect: " << ssrc; | 
| 1188     return; |  | 
| 1189   } | 1187   } | 
| 1190   if (!voice_channel_->MuteStream(ssrc, !enable)) { |  | 
| 1191     // Allow that MuteStream fail if |enable| is false but assert otherwise. |  | 
| 1192     // This in the normal case when the underlying media channel has already |  | 
| 1193     // been deleted. |  | 
| 1194     ASSERT(enable == false); |  | 
| 1195     return; |  | 
| 1196   } |  | 
| 1197   if (enable) |  | 
| 1198     voice_channel_->SetChannelOptions(options); |  | 
| 1199 } | 1188 } | 
| 1200 | 1189 | 
| 1201 void WebRtcSession::SetAudioPlayoutVolume(uint32 ssrc, double volume) { | 1190 void WebRtcSession::SetAudioPlayoutVolume(uint32 ssrc, double volume) { | 
| 1202   ASSERT(signaling_thread()->IsCurrent()); | 1191   ASSERT(signaling_thread()->IsCurrent()); | 
| 1203   ASSERT(volume >= 0 && volume <= 10); | 1192   ASSERT(volume >= 0 && volume <= 10); | 
| 1204   if (!voice_channel_) { | 1193   if (!voice_channel_) { | 
| 1205     LOG(LS_ERROR) << "SetAudioPlayoutVolume: No audio channel exists."; | 1194     LOG(LS_ERROR) << "SetAudioPlayoutVolume: No audio channel exists."; | 
| 1206     return; | 1195     return; | 
| 1207   } | 1196   } | 
| 1208 | 1197 | 
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1247   } | 1236   } | 
| 1248 } | 1237 } | 
| 1249 | 1238 | 
| 1250 void WebRtcSession::SetVideoSend(uint32 ssrc, bool enable, | 1239 void WebRtcSession::SetVideoSend(uint32 ssrc, bool enable, | 
| 1251                                  const cricket::VideoOptions* options) { | 1240                                  const cricket::VideoOptions* options) { | 
| 1252   ASSERT(signaling_thread()->IsCurrent()); | 1241   ASSERT(signaling_thread()->IsCurrent()); | 
| 1253   if (!video_channel_) { | 1242   if (!video_channel_) { | 
| 1254     LOG(LS_WARNING) << "SetVideoSend: No video channel exists."; | 1243     LOG(LS_WARNING) << "SetVideoSend: No video channel exists."; | 
| 1255     return; | 1244     return; | 
| 1256   } | 1245   } | 
| 1257   if (!video_channel_->MuteStream(ssrc, !enable)) { | 1246   if (!video_channel_->SetVideoSend(ssrc, !enable, options)) { | 
| 1258     // Allow that MuteStream fail if |enable| is false but assert otherwise. | 1247     // Allow that MuteStream fail if |enable| is false but assert otherwise. | 
| 1259     // This in the normal case when the underlying media channel has already | 1248     // This in the normal case when the underlying media channel has already | 
| 1260     // been deleted. | 1249     // been deleted. | 
| 1261     ASSERT(enable == false); | 1250     ASSERT(enable == false); | 
| 1262     return; |  | 
| 1263   } | 1251   } | 
| 1264   if (enable && options) |  | 
| 1265     video_channel_->SetChannelOptions(*options); |  | 
| 1266 } | 1252 } | 
| 1267 | 1253 | 
| 1268 bool WebRtcSession::CanInsertDtmf(const std::string& track_id) { | 1254 bool WebRtcSession::CanInsertDtmf(const std::string& track_id) { | 
| 1269   ASSERT(signaling_thread()->IsCurrent()); | 1255   ASSERT(signaling_thread()->IsCurrent()); | 
| 1270   if (!voice_channel_) { | 1256   if (!voice_channel_) { | 
| 1271     LOG(LS_ERROR) << "CanInsertDtmf: No audio channel exists."; | 1257     LOG(LS_ERROR) << "CanInsertDtmf: No audio channel exists."; | 
| 1272     return false; | 1258     return false; | 
| 1273   } | 1259   } | 
| 1274   uint32 send_ssrc = 0; | 1260   uint32 send_ssrc = 0; | 
| 1275   // The Dtmf is negotiated per channel not ssrc, so we only check if the ssrc | 1261   // The Dtmf is negotiated per channel not ssrc, so we only check if the ssrc | 
| (...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2097 | 2083 | 
| 2098   if (!srtp_cipher.empty()) { | 2084   if (!srtp_cipher.empty()) { | 
| 2099     metrics_observer_->AddHistogramSample(srtp_name, srtp_cipher); | 2085     metrics_observer_->AddHistogramSample(srtp_name, srtp_cipher); | 
| 2100   } | 2086   } | 
| 2101   if (!ssl_cipher.empty()) { | 2087   if (!ssl_cipher.empty()) { | 
| 2102     metrics_observer_->AddHistogramSample(ssl_name, ssl_cipher); | 2088     metrics_observer_->AddHistogramSample(ssl_name, ssl_cipher); | 
| 2103   } | 2089   } | 
| 2104 } | 2090 } | 
| 2105 | 2091 | 
| 2106 }  // namespace webrtc | 2092 }  // namespace webrtc | 
| OLD | NEW | 
|---|