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

Side by Side Diff: webrtc/voice_engine/channel.cc

Issue 2697833002: Replace AudioReceiveStream::DeliverRtp with OnRtpPacket. (Closed)
Patch Set: Another return value fix. Created 3 years, 10 months 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 | « webrtc/voice_engine/channel.h ('k') | webrtc/voice_engine/channel_proxy.h » ('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 * 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 14 matching lines...) Expand all
25 #include "webrtc/config.h" 25 #include "webrtc/config.h"
26 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" 26 #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
27 #include "webrtc/modules/audio_coding/codecs/audio_format_conversion.h" 27 #include "webrtc/modules/audio_coding/codecs/audio_format_conversion.h"
28 #include "webrtc/modules/audio_device/include/audio_device.h" 28 #include "webrtc/modules/audio_device/include/audio_device.h"
29 #include "webrtc/modules/audio_processing/include/audio_processing.h" 29 #include "webrtc/modules/audio_processing/include/audio_processing.h"
30 #include "webrtc/modules/include/module_common_types.h" 30 #include "webrtc/modules/include/module_common_types.h"
31 #include "webrtc/modules/pacing/packet_router.h" 31 #include "webrtc/modules/pacing/packet_router.h"
32 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" 32 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h"
33 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h" 33 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h"
34 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" 34 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h"
35 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h"
35 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h" 36 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h"
36 #include "webrtc/modules/utility/include/process_thread.h" 37 #include "webrtc/modules/utility/include/process_thread.h"
37 #include "webrtc/system_wrappers/include/trace.h" 38 #include "webrtc/system_wrappers/include/trace.h"
38 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" 39 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h"
39 #include "webrtc/voice_engine/output_mixer.h" 40 #include "webrtc/voice_engine/output_mixer.h"
40 #include "webrtc/voice_engine/statistics.h" 41 #include "webrtc/voice_engine/statistics.h"
41 #include "webrtc/voice_engine/transmit_mixer.h" 42 #include "webrtc/voice_engine/transmit_mixer.h"
42 #include "webrtc/voice_engine/utility.h" 43 #include "webrtc/voice_engine/utility.h"
43 44
44 namespace webrtc { 45 namespace webrtc {
(...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 _engineStatisticsPtr->SetLastError( 1545 _engineStatisticsPtr->SetLastError(
1545 VE_INVALID_OPERATION, kTraceWarning, 1546 VE_INVALID_OPERATION, kTraceWarning,
1546 "DeRegisterExternalTransport() external transport already " 1547 "DeRegisterExternalTransport() external transport already "
1547 "disabled"); 1548 "disabled");
1548 } 1549 }
1549 _externalTransport = false; 1550 _externalTransport = false;
1550 _transportPtr = NULL; 1551 _transportPtr = NULL;
1551 return 0; 1552 return 0;
1552 } 1553 }
1553 1554
1555 // TODO(nisse): Delete this method together with ReceivedRTPPacket.
1556 // It's a temporary hack to support both ReceivedRTPPacket and
1557 // OnRtpPacket interfaces without too much code duplication.
1558 bool Channel::OnRtpPacketWithHeader(const uint8_t* received_packet,
1559 size_t length,
1560 RTPHeader *header) {
1561 // Store playout timestamp for the received RTP packet
1562 UpdatePlayoutTimestamp(false);
1563
1564 header->payload_type_frequency =
1565 rtp_payload_registry_->GetPayloadTypeFrequency(header->payloadType);
1566 if (header->payload_type_frequency < 0)
1567 return false;
1568 bool in_order = IsPacketInOrder(*header);
1569 rtp_receive_statistics_->IncomingPacket(
1570 *header, length, IsPacketRetransmitted(*header, in_order));
1571 rtp_payload_registry_->SetIncomingPayloadType(*header);
1572
1573 return ReceivePacket(received_packet, length, *header, in_order);
1574 }
1575
1554 int32_t Channel::ReceivedRTPPacket(const uint8_t* received_packet, 1576 int32_t Channel::ReceivedRTPPacket(const uint8_t* received_packet,
1555 size_t length, 1577 size_t length,
1556 const PacketTime& packet_time) { 1578 const PacketTime& packet_time) {
1557 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, _channelId), 1579 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, _channelId),
1558 "Channel::ReceivedRTPPacket()"); 1580 "Channel::ReceivedRTPPacket()");
1559 1581
1560 // Store playout timestamp for the received RTP packet
1561 UpdatePlayoutTimestamp(false);
1562
1563 RTPHeader header; 1582 RTPHeader header;
1564 if (!rtp_header_parser_->Parse(received_packet, length, &header)) { 1583 if (!rtp_header_parser_->Parse(received_packet, length, &header)) {
1565 WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVoice, _channelId, 1584 WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVoice, _channelId,
1566 "Incoming packet: invalid RTP header"); 1585 "Incoming packet: invalid RTP header");
1567 return -1; 1586 return -1;
1568 } 1587 }
1569 header.payload_type_frequency = 1588 return OnRtpPacketWithHeader(received_packet, length, &header) ? 0 : -1;
1570 rtp_payload_registry_->GetPayloadTypeFrequency(header.payloadType); 1589 }
1571 if (header.payload_type_frequency < 0)
1572 return -1;
1573 bool in_order = IsPacketInOrder(header);
1574 rtp_receive_statistics_->IncomingPacket(
1575 header, length, IsPacketRetransmitted(header, in_order));
1576 rtp_payload_registry_->SetIncomingPayloadType(header);
1577 1590
1578 return ReceivePacket(received_packet, length, header, in_order) ? 0 : -1; 1591 void Channel::OnRtpPacket(const RtpPacketReceived& packet) {
1592 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, _channelId),
1593 "Channel::ReceivedRTPPacket()");
1594
1595 RTPHeader header;
1596 packet.GetHeader(&header);
1597 OnRtpPacketWithHeader(packet.data(), packet.size(), &header);
1579 } 1598 }
1580 1599
1581 bool Channel::ReceivePacket(const uint8_t* packet, 1600 bool Channel::ReceivePacket(const uint8_t* packet,
1582 size_t packet_length, 1601 size_t packet_length,
1583 const RTPHeader& header, 1602 const RTPHeader& header,
1584 bool in_order) { 1603 bool in_order) {
1585 if (rtp_payload_registry_->IsRtx(header)) { 1604 if (rtp_payload_registry_->IsRtx(header)) {
1586 return HandleRtxPacket(packet, packet_length, header); 1605 return HandleRtxPacket(packet, packet_length, header);
1587 } 1606 }
1588 const uint8_t* payload = packet + header.headerLength; 1607 const uint8_t* payload = packet + header.headerLength;
(...skipping 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after
3049 int64_t min_rtt = 0; 3068 int64_t min_rtt = 0;
3050 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != 3069 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) !=
3051 0) { 3070 0) {
3052 return 0; 3071 return 0;
3053 } 3072 }
3054 return rtt; 3073 return rtt;
3055 } 3074 }
3056 3075
3057 } // namespace voe 3076 } // namespace voe
3058 } // namespace webrtc 3077 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/voice_engine/channel.h ('k') | webrtc/voice_engine/channel_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698