blob: 48050de3d886865b1f632203d1708b8c0c089595 [file] [log] [blame]
henrike@webrtc.org28e20752013-07-10 00:45:361/*
kjellander65c7f672016-02-12 08:05:012 * Copyright 2004 The WebRTC project authors. All Rights Reserved.
henrike@webrtc.org28e20752013-07-10 00:45:363 *
kjellander65c7f672016-02-12 08:05:014 * 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.
henrike@webrtc.org28e20752013-07-10 00:45:369 */
10
Steve Anton10542f22019-01-11 17:11:0011#ifndef PC_RTCP_MUX_FILTER_H_
12#define PC_RTCP_MUX_FILTER_H_
henrike@webrtc.org28e20752013-07-10 00:45:3613
Steve Anton10542f22019-01-11 17:11:0014#include "pc/session_description.h"
henrike@webrtc.org28e20752013-07-10 00:45:3615
16namespace cricket {
17
18// RTCP Muxer, as defined in RFC 5761 (http://tools.ietf.org/html/rfc5761)
19class RtcpMuxFilter {
20 public:
21 RtcpMuxFilter();
22
deadbeef23d947d2016-08-22 23:00:3023 // Whether RTCP mux has been negotiated with a final answer (not provisional).
24 bool IsFullyActive() const;
25
26 // Whether RTCP mux has been negotiated with a provisional answer; this means
27 // a later answer could disable RTCP mux, and so the RTCP transport should
28 // not be disposed yet.
29 bool IsProvisionallyActive() const;
30
31 // Whether the filter is active, i.e. has RTCP mux been properly negotiated,
32 // either with a final or provisional answer.
henrike@webrtc.org28e20752013-07-10 00:45:3633 bool IsActive() const;
34
deadbeef23d947d2016-08-22 23:00:3035 // Make the filter active (fully, not provisionally) regardless of the
36 // current state. This should be used when an endpoint *requires* RTCP mux.
Peter Thatcheraf55ccc2015-05-21 14:48:4137 void SetActive();
38
henrike@webrtc.org28e20752013-07-10 00:45:3639 // Specifies whether the offer indicates the use of RTCP mux.
40 bool SetOffer(bool offer_enable, ContentSource src);
41
42 // Specifies whether the provisional answer indicates the use of RTCP mux.
43 bool SetProvisionalAnswer(bool answer_enable, ContentSource src);
44
45 // Specifies whether the answer indicates the use of RTCP mux.
46 bool SetAnswer(bool answer_enable, ContentSource src);
47
henrike@webrtc.org28e20752013-07-10 00:45:3648 private:
49 bool ExpectOffer(bool offer_enable, ContentSource source);
50 bool ExpectAnswer(ContentSource source);
51 enum State {
52 // RTCP mux filter unused.
53 ST_INIT,
54 // Offer with RTCP mux enabled received.
55 // RTCP mux filter is not active.
56 ST_RECEIVEDOFFER,
57 // Offer with RTCP mux enabled sent.
58 // RTCP mux filter can demux incoming packets but is not active.
59 ST_SENTOFFER,
60 // RTCP mux filter is active but the sent answer is only provisional.
61 // When the final answer is set, the state transitions to ST_ACTIVE or
62 // ST_INIT.
63 ST_SENTPRANSWER,
64 // RTCP mux filter is active but the received answer is only provisional.
65 // When the final answer is set, the state transitions to ST_ACTIVE or
66 // ST_INIT.
67 ST_RECEIVEDPRANSWER,
68 // Offer and answer set, RTCP mux enabled. It is not possible to de-activate
69 // the filter.
70 ST_ACTIVE
71 };
72 State state_;
73 bool offer_enable_;
74};
75
76} // namespace cricket
77
Steve Anton10542f22019-01-11 17:11:0078#endif // PC_RTCP_MUX_FILTER_H_