Chromium Code Reviews| 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 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1237 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1237 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 1238 RTC_DCHECK(stream_); | 1238 RTC_DCHECK(stream_); |
| 1239 return stream_->GetStats(); | 1239 return stream_->GetStats(); |
| 1240 } | 1240 } |
| 1241 | 1241 |
| 1242 int channel() const { | 1242 int channel() const { |
| 1243 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1243 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 1244 return config_.voe_channel_id; | 1244 return config_.voe_channel_id; |
| 1245 } | 1245 } |
| 1246 | 1246 |
| 1247 void SetRawAudioSink(rtc::scoped_ptr<webrtc::AudioSinkInterface> sink) { | 1247 void SetRawAudioSink(rtc::scoped_refptr<webrtc::AudioSinkInterface> sink) { |
| 1248 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1248 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 1249 stream_->SetSink(std::move(sink)); | 1249 stream_->SetSink(sink); |
| 1250 } | 1250 } |
| 1251 | 1251 |
| 1252 private: | 1252 private: |
| 1253 void RecreateAudioReceiveStream(bool use_combined_bwe, | 1253 void RecreateAudioReceiveStream(bool use_combined_bwe, |
| 1254 const std::vector<webrtc::RtpExtension>& extensions) { | 1254 const std::vector<webrtc::RtpExtension>& extensions) { |
| 1255 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1255 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 1256 if (stream_) { | 1256 if (stream_) { |
| 1257 call_->DestroyAudioReceiveStream(stream_); | 1257 call_->DestroyAudioReceiveStream(stream_); |
| 1258 stream_ = nullptr; | 1258 stream_ = nullptr; |
| 1259 } | 1259 } |
| (...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2179 if (default_recv_ssrc_ == -1 && GetReceiveChannelId(ssrc) == -1) { | 2179 if (default_recv_ssrc_ == -1 && GetReceiveChannelId(ssrc) == -1) { |
| 2180 StreamParams sp; | 2180 StreamParams sp; |
| 2181 sp.ssrcs.push_back(ssrc); | 2181 sp.ssrcs.push_back(ssrc); |
| 2182 LOG(LS_INFO) << "Creating default receive stream for SSRC=" << ssrc << "."; | 2182 LOG(LS_INFO) << "Creating default receive stream for SSRC=" << ssrc << "."; |
| 2183 if (!AddRecvStream(sp)) { | 2183 if (!AddRecvStream(sp)) { |
| 2184 LOG(LS_WARNING) << "Could not create default receive stream."; | 2184 LOG(LS_WARNING) << "Could not create default receive stream."; |
| 2185 return; | 2185 return; |
| 2186 } | 2186 } |
| 2187 default_recv_ssrc_ = ssrc; | 2187 default_recv_ssrc_ = ssrc; |
| 2188 SetOutputVolume(default_recv_ssrc_, default_recv_volume_); | 2188 SetOutputVolume(default_recv_ssrc_, default_recv_volume_); |
| 2189 if (default_sink_) { | |
|
the sun
2016/01/08 13:14:26
No need for the conditional, setting a null sink s
Taylor Brandstetter
2016/01/08 19:46:58
Done.
| |
| 2190 SetRawAudioSink(default_recv_ssrc_, default_sink_); | |
| 2191 } | |
| 2189 } | 2192 } |
| 2190 | 2193 |
| 2191 // Forward packet to Call. If the SSRC is unknown we'll return after this. | 2194 // Forward packet to Call. If the SSRC is unknown we'll return after this. |
| 2192 const webrtc::PacketTime webrtc_packet_time(packet_time.timestamp, | 2195 const webrtc::PacketTime webrtc_packet_time(packet_time.timestamp, |
| 2193 packet_time.not_before); | 2196 packet_time.not_before); |
| 2194 webrtc::PacketReceiver::DeliveryStatus delivery_result = | 2197 webrtc::PacketReceiver::DeliveryStatus delivery_result = |
| 2195 call_->Receiver()->DeliverPacket(webrtc::MediaType::AUDIO, | 2198 call_->Receiver()->DeliverPacket(webrtc::MediaType::AUDIO, |
| 2196 reinterpret_cast<const uint8_t*>(packet->data()), packet->size(), | 2199 reinterpret_cast<const uint8_t*>(packet->data()), packet->size(), |
| 2197 webrtc_packet_time); | 2200 webrtc_packet_time); |
| 2198 if (webrtc::PacketReceiver::DELIVERY_OK != delivery_result) { | 2201 if (webrtc::PacketReceiver::DELIVERY_OK != delivery_result) { |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2405 rinfo.decoding_plc_cng = stats.decoding_plc_cng; | 2408 rinfo.decoding_plc_cng = stats.decoding_plc_cng; |
| 2406 rinfo.capture_start_ntp_time_ms = stats.capture_start_ntp_time_ms; | 2409 rinfo.capture_start_ntp_time_ms = stats.capture_start_ntp_time_ms; |
| 2407 info->receivers.push_back(rinfo); | 2410 info->receivers.push_back(rinfo); |
| 2408 } | 2411 } |
| 2409 | 2412 |
| 2410 return true; | 2413 return true; |
| 2411 } | 2414 } |
| 2412 | 2415 |
| 2413 void WebRtcVoiceMediaChannel::SetRawAudioSink( | 2416 void WebRtcVoiceMediaChannel::SetRawAudioSink( |
| 2414 uint32_t ssrc, | 2417 uint32_t ssrc, |
| 2415 rtc::scoped_ptr<webrtc::AudioSinkInterface> sink) { | 2418 rtc::scoped_refptr<webrtc::AudioSinkInterface> sink) { |
| 2416 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 2419 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 2417 LOG(LS_VERBOSE) << "WebRtcVoiceMediaChannel::SetRawAudioSink"; | 2420 LOG(LS_VERBOSE) << "WebRtcVoiceMediaChannel::SetRawAudioSink"; |
| 2421 if (ssrc == 0) { | |
| 2422 default_sink_ = sink; | |
| 2423 if (default_recv_ssrc_ != -1) { | |
| 2424 SetRawAudioSink(default_recv_ssrc_, sink); | |
|
the sun
2016/01/08 13:14:26
Nice, but will generate duplicate log lines. I'd p
Taylor Brandstetter
2016/01/08 19:46:58
Done.
| |
| 2425 } | |
| 2426 return; | |
| 2427 } | |
| 2418 const auto it = recv_streams_.find(ssrc); | 2428 const auto it = recv_streams_.find(ssrc); |
| 2419 if (it == recv_streams_.end()) { | 2429 if (it == recv_streams_.end()) { |
| 2420 LOG(LS_WARNING) << "SetRawAudioSink: no recv stream" << ssrc; | 2430 LOG(LS_WARNING) << "SetRawAudioSink: no recv stream" << ssrc; |
| 2421 return; | 2431 return; |
| 2422 } | 2432 } |
| 2423 it->second->SetRawAudioSink(std::move(sink)); | 2433 it->second->SetRawAudioSink(sink); |
| 2424 } | 2434 } |
| 2425 | 2435 |
| 2426 int WebRtcVoiceMediaChannel::GetOutputLevel(int channel) { | 2436 int WebRtcVoiceMediaChannel::GetOutputLevel(int channel) { |
| 2427 unsigned int ulevel = 0; | 2437 unsigned int ulevel = 0; |
| 2428 int ret = engine()->voe()->volume()->GetSpeechOutputLevel(channel, ulevel); | 2438 int ret = engine()->voe()->volume()->GetSpeechOutputLevel(channel, ulevel); |
| 2429 return (ret == 0) ? static_cast<int>(ulevel) : -1; | 2439 return (ret == 0) ? static_cast<int>(ulevel) : -1; |
| 2430 } | 2440 } |
| 2431 | 2441 |
| 2432 int WebRtcVoiceMediaChannel::GetReceiveChannelId(uint32_t ssrc) const { | 2442 int WebRtcVoiceMediaChannel::GetReceiveChannelId(uint32_t ssrc) const { |
| 2433 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 2443 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2500 } | 2510 } |
| 2501 } else { | 2511 } else { |
| 2502 LOG(LS_INFO) << "Stopping playout for channel #" << channel; | 2512 LOG(LS_INFO) << "Stopping playout for channel #" << channel; |
| 2503 engine()->voe()->base()->StopPlayout(channel); | 2513 engine()->voe()->base()->StopPlayout(channel); |
| 2504 } | 2514 } |
| 2505 return true; | 2515 return true; |
| 2506 } | 2516 } |
| 2507 } // namespace cricket | 2517 } // namespace cricket |
| 2508 | 2518 |
| 2509 #endif // HAVE_WEBRTC_VOICE | 2519 #endif // HAVE_WEBRTC_VOICE |
| OLD | NEW |