Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Side by Side Diff: talk/media/webrtc/webrtcvoiceengine.cc

Issue 1455923003: Allow default audio receive channel to receive on any unsignalled SSRC. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | talk/media/webrtc/webrtcvoiceengine_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2427 matching lines...) Expand 10 before | Expand all | Expand 10 after
2438 2438
2439 void WebRtcVoiceMediaChannel::OnPacketReceived( 2439 void WebRtcVoiceMediaChannel::OnPacketReceived(
2440 rtc::Buffer* packet, const rtc::PacketTime& packet_time) { 2440 rtc::Buffer* packet, const rtc::PacketTime& packet_time) {
2441 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 2441 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
2442 2442
2443 uint32_t ssrc = 0; 2443 uint32_t ssrc = 0;
2444 if (!GetRtpSsrc(packet->data(), packet->size(), &ssrc)) { 2444 if (!GetRtpSsrc(packet->data(), packet->size(), &ssrc)) {
2445 return; 2445 return;
2446 } 2446 }
2447 2447
2448 if (receive_channels_.empty()) { 2448 // If we don't have a default channel, and the SSRC is unknown, create a
2449 // Create new channel, which will be the default receive channel. 2449 // default channel.
2450 if (default_recv_ssrc_ == -1 && GetReceiveChannelId(ssrc) == -1) {
2450 StreamParams sp; 2451 StreamParams sp;
2451 sp.ssrcs.push_back(ssrc); 2452 sp.ssrcs.push_back(ssrc);
2452 LOG(LS_INFO) << "Creating default receive stream for SSRC=" << ssrc << "."; 2453 LOG(LS_INFO) << "Creating default receive stream for SSRC=" << ssrc << ".";
2453 if (!AddRecvStream(sp)) { 2454 if (!AddRecvStream(sp)) {
2454 LOG(LS_WARNING) << "Could not create default receive stream."; 2455 LOG(LS_WARNING) << "Could not create default receive stream.";
2455 return; 2456 return;
2456 } 2457 }
2457 default_recv_ssrc_ = ssrc; 2458 default_recv_ssrc_ = ssrc;
2458 SetOutputVolume(default_recv_ssrc_, default_recv_volume_); 2459 SetOutputVolume(default_recv_ssrc_, default_recv_volume_);
2459 } 2460 }
2460 2461
2461 // Forward packet to Call. If the SSRC is unknown we'll return after this. 2462 // Forward packet to Call. If the SSRC is unknown we'll return after this.
2462 const webrtc::PacketTime webrtc_packet_time(packet_time.timestamp, 2463 const webrtc::PacketTime webrtc_packet_time(packet_time.timestamp,
2463 packet_time.not_before); 2464 packet_time.not_before);
2464 webrtc::PacketReceiver::DeliveryStatus delivery_result = 2465 webrtc::PacketReceiver::DeliveryStatus delivery_result =
2465 call_->Receiver()->DeliverPacket(webrtc::MediaType::AUDIO, 2466 call_->Receiver()->DeliverPacket(webrtc::MediaType::AUDIO,
2466 reinterpret_cast<const uint8_t*>(packet->data()), packet->size(), 2467 reinterpret_cast<const uint8_t*>(packet->data()), packet->size(),
2467 webrtc_packet_time); 2468 webrtc_packet_time);
2468 if (webrtc::PacketReceiver::DELIVERY_OK != delivery_result) { 2469 if (webrtc::PacketReceiver::DELIVERY_OK != delivery_result) {
2469 return; 2470 // If the SSRC is unknown here, route it to the default channel, if we have
2471 // one. See: https://bugs.chromium.org/p/webrtc/issues/detail?id=5208
2472 if (default_recv_ssrc_ == -1) {
2473 return;
2474 } else {
2475 ssrc = default_recv_ssrc_;
2476 }
2470 } 2477 }
2471 2478
2472 // Find the channel to send this packet to. It must exist since webrtc::Call 2479 // Find the channel to send this packet to. It must exist since webrtc::Call
2473 // was able to demux the packet. 2480 // was able to demux the packet.
2474 int channel = GetReceiveChannelId(ssrc); 2481 int channel = GetReceiveChannelId(ssrc);
2475 RTC_DCHECK(channel != -1); 2482 RTC_DCHECK(channel != -1);
2476 2483
2477 // Pass it off to the decoder. 2484 // Pass it off to the decoder.
2478 engine()->voe()->network()->ReceivedRTPPacket( 2485 engine()->voe()->network()->ReceivedRTPPacket(
2479 channel, packet->data(), packet->size(), webrtc_packet_time); 2486 channel, packet->data(), packet->size(), webrtc_packet_time);
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
2829 LOG(LS_WARNING) << "Unknown codec " << ToString(codec); 2836 LOG(LS_WARNING) << "Unknown codec " << ToString(codec);
2830 return false; 2837 return false;
2831 } 2838 }
2832 } 2839 }
2833 return true; 2840 return true;
2834 } 2841 }
2835 2842
2836 } // namespace cricket 2843 } // namespace cricket
2837 2844
2838 #endif // HAVE_WEBRTC_VOICE 2845 #endif // HAVE_WEBRTC_VOICE
OLDNEW
« no previous file with comments | « no previous file | talk/media/webrtc/webrtcvoiceengine_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698