| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 return s; | 30 return s; |
| 31 } | 31 } |
| 32 | 32 |
| 33 VoENetworkImpl::VoENetworkImpl(voe::SharedData* shared) : _shared(shared) { | 33 VoENetworkImpl::VoENetworkImpl(voe::SharedData* shared) : _shared(shared) { |
| 34 } | 34 } |
| 35 | 35 |
| 36 VoENetworkImpl::~VoENetworkImpl() = default; | 36 VoENetworkImpl::~VoENetworkImpl() = default; |
| 37 | 37 |
| 38 int VoENetworkImpl::RegisterExternalTransport(int channel, | 38 int VoENetworkImpl::RegisterExternalTransport(int channel, |
| 39 Transport& transport) { | 39 Transport& transport) { |
| 40 DCHECK(_shared->statistics().Initialized()); | 40 RTC_DCHECK(_shared->statistics().Initialized()); |
| 41 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 41 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 42 voe::Channel* channelPtr = ch.channel(); | 42 voe::Channel* channelPtr = ch.channel(); |
| 43 if (!channelPtr) { | 43 if (!channelPtr) { |
| 44 LOG_F(LS_ERROR) << "Failed to locate channel: " << channel; | 44 LOG_F(LS_ERROR) << "Failed to locate channel: " << channel; |
| 45 return -1; | 45 return -1; |
| 46 } | 46 } |
| 47 return channelPtr->RegisterExternalTransport(transport); | 47 return channelPtr->RegisterExternalTransport(transport); |
| 48 } | 48 } |
| 49 | 49 |
| 50 int VoENetworkImpl::DeRegisterExternalTransport(int channel) { | 50 int VoENetworkImpl::DeRegisterExternalTransport(int channel) { |
| 51 CHECK(_shared->statistics().Initialized()); | 51 RTC_CHECK(_shared->statistics().Initialized()); |
| 52 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 52 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 53 voe::Channel* channelPtr = ch.channel(); | 53 voe::Channel* channelPtr = ch.channel(); |
| 54 if (!channelPtr) { | 54 if (!channelPtr) { |
| 55 LOG_F(LS_ERROR) << "Failed to locate channel: " << channel; | 55 LOG_F(LS_ERROR) << "Failed to locate channel: " << channel; |
| 56 return -1; | 56 return -1; |
| 57 } | 57 } |
| 58 return channelPtr->DeRegisterExternalTransport(); | 58 return channelPtr->DeRegisterExternalTransport(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 int VoENetworkImpl::ReceivedRTPPacket(int channel, | 61 int VoENetworkImpl::ReceivedRTPPacket(int channel, |
| 62 const void* data, | 62 const void* data, |
| 63 size_t length) { | 63 size_t length) { |
| 64 return ReceivedRTPPacket(channel, data, length, webrtc::PacketTime()); | 64 return ReceivedRTPPacket(channel, data, length, webrtc::PacketTime()); |
| 65 } | 65 } |
| 66 | 66 |
| 67 int VoENetworkImpl::ReceivedRTPPacket(int channel, | 67 int VoENetworkImpl::ReceivedRTPPacket(int channel, |
| 68 const void* data, | 68 const void* data, |
| 69 size_t length, | 69 size_t length, |
| 70 const PacketTime& packet_time) { | 70 const PacketTime& packet_time) { |
| 71 CHECK(_shared->statistics().Initialized()); | 71 RTC_CHECK(_shared->statistics().Initialized()); |
| 72 CHECK(data); | 72 RTC_CHECK(data); |
| 73 // L16 at 32 kHz, stereo, 10 ms frames (+12 byte RTP header) -> 1292 bytes | 73 // L16 at 32 kHz, stereo, 10 ms frames (+12 byte RTP header) -> 1292 bytes |
| 74 if ((length < 12) || (length > 1292)) { | 74 if ((length < 12) || (length > 1292)) { |
| 75 LOG_F(LS_ERROR) << "Invalid packet length: " << length; | 75 LOG_F(LS_ERROR) << "Invalid packet length: " << length; |
| 76 return -1; | 76 return -1; |
| 77 } | 77 } |
| 78 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 78 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 79 voe::Channel* channelPtr = ch.channel(); | 79 voe::Channel* channelPtr = ch.channel(); |
| 80 if (!channelPtr) { | 80 if (!channelPtr) { |
| 81 LOG_F(LS_ERROR) << "Failed to locate channel: " << channel; | 81 LOG_F(LS_ERROR) << "Failed to locate channel: " << channel; |
| 82 return -1; | 82 return -1; |
| 83 } | 83 } |
| 84 if (!channelPtr->ExternalTransport()) { | 84 if (!channelPtr->ExternalTransport()) { |
| 85 LOG_F(LS_ERROR) << "No external transport for channel: " << channel; | 85 LOG_F(LS_ERROR) << "No external transport for channel: " << channel; |
| 86 return -1; | 86 return -1; |
| 87 } | 87 } |
| 88 return channelPtr->ReceivedRTPPacket((const int8_t*)data, length, | 88 return channelPtr->ReceivedRTPPacket((const int8_t*)data, length, |
| 89 packet_time); | 89 packet_time); |
| 90 } | 90 } |
| 91 | 91 |
| 92 int VoENetworkImpl::ReceivedRTCPPacket(int channel, | 92 int VoENetworkImpl::ReceivedRTCPPacket(int channel, |
| 93 const void* data, | 93 const void* data, |
| 94 size_t length) { | 94 size_t length) { |
| 95 CHECK(_shared->statistics().Initialized()); | 95 RTC_CHECK(_shared->statistics().Initialized()); |
| 96 CHECK(data); | 96 RTC_CHECK(data); |
| 97 if (length < 4) { | 97 if (length < 4) { |
| 98 LOG_F(LS_ERROR) << "Invalid packet length: " << length; | 98 LOG_F(LS_ERROR) << "Invalid packet length: " << length; |
| 99 return -1; | 99 return -1; |
| 100 } | 100 } |
| 101 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 101 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 102 voe::Channel* channelPtr = ch.channel(); | 102 voe::Channel* channelPtr = ch.channel(); |
| 103 if (!channelPtr) { | 103 if (!channelPtr) { |
| 104 LOG_F(LS_ERROR) << "Failed to locate channel: " << channel; | 104 LOG_F(LS_ERROR) << "Failed to locate channel: " << channel; |
| 105 return -1; | 105 return -1; |
| 106 } | 106 } |
| 107 if (!channelPtr->ExternalTransport()) { | 107 if (!channelPtr->ExternalTransport()) { |
| 108 LOG_F(LS_ERROR) << "No external transport for channel: " << channel; | 108 LOG_F(LS_ERROR) << "No external transport for channel: " << channel; |
| 109 return -1; | 109 return -1; |
| 110 } | 110 } |
| 111 return channelPtr->ReceivedRTCPPacket((const int8_t*)data, length); | 111 return channelPtr->ReceivedRTCPPacket((const int8_t*)data, length); |
| 112 } | 112 } |
| 113 | 113 |
| 114 } // namespace webrtc | 114 } // namespace webrtc |
| OLD | NEW |