blob: c2bdaad23e7544e53f946192646265d092e53d4a [file] [log] [blame]
zstein398c3fd2017-07-19 13:38:02 -07001/*
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 Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef PC_RTPTRANSPORTTESTUTIL_H_
12#define PC_RTPTRANSPORTTESTUTIL_H_
zstein398c3fd2017-07-19 13:38:02 -070013
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020014#include "pc/rtptransportinternal.h"
15#include "rtc_base/sigslot.h"
zstein398c3fd2017-07-19 13:38:02 -070016
17namespace webrtc {
18
19class 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 Bonadei92ea95e2017-09-15 06:47:31 +020044#endif // PC_RTPTRANSPORTTESTUTIL_H_