zstein | 398c3fd | 2017-07-19 13:38:02 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef PC_RTPTRANSPORTTESTUTIL_H_ |
| 12 | #define PC_RTPTRANSPORTTESTUTIL_H_ |
zstein | 398c3fd | 2017-07-19 13:38:02 -0700 | [diff] [blame] | 13 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 14 | #include "pc/rtptransportinternal.h" |
| 15 | #include "rtc_base/sigslot.h" |
zstein | 398c3fd | 2017-07-19 13:38:02 -0700 | [diff] [blame] | 16 | |
| 17 | namespace webrtc { |
| 18 | |
| 19 | class SignalPacketReceivedCounter : public sigslot::has_slots<> { |
| 20 | public: |
| 21 | explicit SignalPacketReceivedCounter(RtpTransportInternal* transport) { |
| 22 | transport->SignalPacketReceived.connect( |
| 23 | this, &SignalPacketReceivedCounter::OnPacketReceived); |
| 24 | } |
| 25 | int rtcp_count() const { return rtcp_count_; } |
| 26 | int rtp_count() const { return rtp_count_; } |
| 27 | |
| 28 | private: |
| 29 | void OnPacketReceived(bool rtcp, |
| 30 | rtc::CopyOnWriteBuffer*, |
| 31 | const rtc::PacketTime&) { |
| 32 | if (rtcp) { |
| 33 | ++rtcp_count_; |
| 34 | } else { |
| 35 | ++rtp_count_; |
| 36 | } |
| 37 | } |
| 38 | int rtcp_count_ = 0; |
| 39 | int rtp_count_ = 0; |
| 40 | }; |
| 41 | |
| 42 | } // namespace webrtc |
| 43 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 44 | #endif // PC_RTPTRANSPORTTESTUTIL_H_ |