henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 | [diff] [blame] | 1 | /* |
kjellander | 65c7f67 | 2016-02-12 08:05:01 | [diff] [blame] | 2 | * Copyright 2004 The WebRTC project authors. All Rights Reserved. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 | [diff] [blame] | 3 | * |
kjellander | 65c7f67 | 2016-02-12 08:05:01 | [diff] [blame] | 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. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 | [diff] [blame] | 9 | */ |
| 10 | |
Steve Anton | 10542f2 | 2019-01-11 17:11:00 | [diff] [blame] | 11 | #ifndef PC_RTCP_MUX_FILTER_H_ |
| 12 | #define PC_RTCP_MUX_FILTER_H_ |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 | [diff] [blame] | 13 | |
Steve Anton | 10542f2 | 2019-01-11 17:11:00 | [diff] [blame] | 14 | #include "pc/session_description.h" |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 | [diff] [blame] | 15 | |
| 16 | namespace cricket { |
| 17 | |
| 18 | // RTCP Muxer, as defined in RFC 5761 (http://tools.ietf.org/html/rfc5761) |
| 19 | class RtcpMuxFilter { |
| 20 | public: |
| 21 | RtcpMuxFilter(); |
| 22 | |
deadbeef | 23d947d | 2016-08-22 23:00:30 | [diff] [blame] | 23 | // 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.org | 28e2075 | 2013-07-10 00:45:36 | [diff] [blame] | 33 | bool IsActive() const; |
| 34 | |
deadbeef | 23d947d | 2016-08-22 23:00:30 | [diff] [blame] | 35 | // Make the filter active (fully, not provisionally) regardless of the |
| 36 | // current state. This should be used when an endpoint *requires* RTCP mux. |
Peter Thatcher | af55ccc | 2015-05-21 14:48:41 | [diff] [blame] | 37 | void SetActive(); |
| 38 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 | [diff] [blame] | 39 | // 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.org | 28e2075 | 2013-07-10 00:45:36 | [diff] [blame] | 48 | 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 Anton | 10542f2 | 2019-01-11 17:11:00 | [diff] [blame] | 78 | #endif // PC_RTCP_MUX_FILTER_H_ |