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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_sender.cc

Issue 1582503002: [rtp_rtcp] rtcp::Empty moved into own file and renamed to CompoundPacket on the way (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 11 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/modules/rtp_rtcp/source/rtcp_packet_unittest.cc ('k') | no next file » | 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
11 #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h" 11 #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h"
12 12
13 #include <assert.h> // assert 13 #include <assert.h> // assert
14 #include <string.h> // memcpy 14 #include <string.h> // memcpy
15 15
16 #include <algorithm> // min 16 #include <algorithm> // min
17 #include <limits> // max 17 #include <limits> // max
18 #include <utility> 18 #include <utility>
19 19
20 #include "webrtc/base/checks.h" 20 #include "webrtc/base/checks.h"
21 #include "webrtc/base/logging.h" 21 #include "webrtc/base/logging.h"
22 #include "webrtc/base/trace_event.h" 22 #include "webrtc/base/trace_event.h"
23 #include "webrtc/common_types.h" 23 #include "webrtc/common_types.h"
24 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" 24 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
25 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h" 25 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h"
26 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h" 26 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h"
27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/compound_packet.h"
27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h" 28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h"
28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.h" 29 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.h"
29 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" 30 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h"
30 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h" 31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h"
31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h" 32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h"
32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" 33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
33 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h" 34 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h"
34 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" 35 #include "webrtc/system_wrappers/include/critical_section_wrapper.h"
35 36
36 namespace webrtc { 37 namespace webrtc {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 frequency_hz(0), 72 frequency_hz(0),
72 packets_sent(0), 73 packets_sent(0),
73 media_bytes_sent(0), 74 media_bytes_sent(0),
74 send_bitrate(0), 75 send_bitrate(0),
75 last_rr_ntp_secs(0), 76 last_rr_ntp_secs(0),
76 last_rr_ntp_frac(0), 77 last_rr_ntp_frac(0),
77 remote_sr(0), 78 remote_sr(0),
78 has_last_xr_rr(false), 79 has_last_xr_rr(false),
79 module(nullptr) {} 80 module(nullptr) {}
80 81
81 class PacketContainer : public rtcp::Empty, 82 class PacketContainer : public rtcp::CompoundPacket,
82 public rtcp::RtcpPacket::PacketReadyCallback { 83 public rtcp::RtcpPacket::PacketReadyCallback {
83 public: 84 public:
84 explicit PacketContainer(Transport* transport) 85 explicit PacketContainer(Transport* transport)
85 : transport_(transport), bytes_sent_(0) {} 86 : transport_(transport), bytes_sent_(0) {}
86 virtual ~PacketContainer() { 87 virtual ~PacketContainer() {
87 for (RtcpPacket* packet : appended_packets_) 88 for (RtcpPacket* packet : appended_packets_)
88 delete packet; 89 delete packet;
89 } 90 }
90 91
91 void OnPacketReady(uint8_t* data, size_t length) override { 92 void OnPacketReady(uint8_t* data, size_t length) override {
92 if (transport_->SendRtcp(data, length)) 93 if (transport_->SendRtcp(data, length))
93 bytes_sent_ += length; 94 bytes_sent_ += length;
94 } 95 }
95 96
96 size_t SendPackets() { 97 size_t SendPackets() {
97 rtcp::Empty::Build(this); 98 rtcp::CompoundPacket::Build(this);
98 return bytes_sent_; 99 return bytes_sent_;
99 } 100 }
100 101
101 private: 102 private:
102 Transport* transport_; 103 Transport* transport_;
103 size_t bytes_sent_; 104 size_t bytes_sent_;
104 }; 105 };
105 106
106 class RTCPSender::RtcpContext { 107 class RTCPSender::RtcpContext {
107 public: 108 public:
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 Transport* const transport_; 1054 Transport* const transport_;
1054 bool send_failure_; 1055 bool send_failure_;
1055 } sender(transport_); 1056 } sender(transport_);
1056 1057
1057 uint8_t buffer[IP_PACKET_SIZE]; 1058 uint8_t buffer[IP_PACKET_SIZE];
1058 return packet.BuildExternalBuffer(buffer, IP_PACKET_SIZE, &sender) && 1059 return packet.BuildExternalBuffer(buffer, IP_PACKET_SIZE, &sender) &&
1059 !sender.send_failure_; 1060 !sender.send_failure_;
1060 } 1061 }
1061 1062
1062 } // namespace webrtc 1063 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_packet_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698