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 2168 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_) { | |
2190 SetRawAudioSink(default_recv_ssrc_, std::move(default_sink_)); | |
pthatcher1
2015/12/30 16:31:50
This looks different than default_recv_volume_ in
Taylor Brandstetter
2016/01/05 18:47:21
The first solution seems a little fragile. And it
| |
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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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_ptr<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 if (default_recv_ssrc_ == -1) { | |
2423 default_sink_ = std::move(sink); | |
2424 } else { | |
2425 SetRawAudioSink(default_recv_ssrc_, std::move(sink)); | |
2426 } | |
2427 return; | |
2428 } | |
2418 const auto it = recv_streams_.find(ssrc); | 2429 const auto it = recv_streams_.find(ssrc); |
2419 if (it == recv_streams_.end()) { | 2430 if (it == recv_streams_.end()) { |
2420 LOG(LS_WARNING) << "SetRawAudioSink: no recv stream" << ssrc; | 2431 LOG(LS_WARNING) << "SetRawAudioSink: no recv stream" << ssrc; |
2421 return; | 2432 return; |
2422 } | 2433 } |
2423 it->second->SetRawAudioSink(std::move(sink)); | 2434 it->second->SetRawAudioSink(std::move(sink)); |
2424 } | 2435 } |
2425 | 2436 |
2426 int WebRtcVoiceMediaChannel::GetOutputLevel(int channel) { | 2437 int WebRtcVoiceMediaChannel::GetOutputLevel(int channel) { |
2427 unsigned int ulevel = 0; | 2438 unsigned int ulevel = 0; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2500 } | 2511 } |
2501 } else { | 2512 } else { |
2502 LOG(LS_INFO) << "Stopping playout for channel #" << channel; | 2513 LOG(LS_INFO) << "Stopping playout for channel #" << channel; |
2503 engine()->voe()->base()->StopPlayout(channel); | 2514 engine()->voe()->base()->StopPlayout(channel); |
2504 } | 2515 } |
2505 return true; | 2516 return true; |
2506 } | 2517 } |
2507 } // namespace cricket | 2518 } // namespace cricket |
2508 | 2519 |
2509 #endif // HAVE_WEBRTC_VOICE | 2520 #endif // HAVE_WEBRTC_VOICE |
OLD | NEW |