| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2004 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/pc/rtcpmuxfilter.h" | 11 #include "webrtc/pc/rtcpmuxfilter.h" |
| 12 | 12 |
| 13 #include "webrtc/base/logging.h" | 13 #include "webrtc/base/logging.h" |
| 14 | 14 |
| 15 namespace cricket { | 15 namespace cricket { |
| 16 | 16 |
| 17 RtcpMuxFilter::RtcpMuxFilter() : state_(ST_INIT), offer_enable_(false) { | 17 RtcpMuxFilter::RtcpMuxFilter() : state_(ST_INIT), offer_enable_(false) { |
| 18 } | 18 } |
| 19 | 19 |
| 20 bool RtcpMuxFilter::IsFullyActive() const { |
| 21 return state_ == ST_ACTIVE; |
| 22 } |
| 23 |
| 24 bool RtcpMuxFilter::IsProvisionallyActive() const { |
| 25 return state_ == ST_SENTPRANSWER || state_ == ST_RECEIVEDPRANSWER; |
| 26 } |
| 27 |
| 20 bool RtcpMuxFilter::IsActive() const { | 28 bool RtcpMuxFilter::IsActive() const { |
| 21 return state_ == ST_SENTPRANSWER || | 29 return IsFullyActive() || IsProvisionallyActive(); |
| 22 state_ == ST_RECEIVEDPRANSWER || | |
| 23 state_ == ST_ACTIVE; | |
| 24 } | 30 } |
| 25 | 31 |
| 26 void RtcpMuxFilter::SetActive() { | 32 void RtcpMuxFilter::SetActive() { |
| 27 state_ = ST_ACTIVE; | 33 state_ = ST_ACTIVE; |
| 28 } | 34 } |
| 29 | 35 |
| 30 bool RtcpMuxFilter::SetOffer(bool offer_enable, ContentSource src) { | 36 bool RtcpMuxFilter::SetOffer(bool offer_enable, ContentSource src) { |
| 31 if (state_ == ST_ACTIVE) { | 37 if (state_ == ST_ACTIVE) { |
| 32 // Fail if we try to deactivate and no-op if we try and activate. | 38 // Fail if we try to deactivate and no-op if we try and activate. |
| 33 return offer_enable; | 39 return offer_enable; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 } | 136 } |
| 131 | 137 |
| 132 bool RtcpMuxFilter::ExpectAnswer(ContentSource source) { | 138 bool RtcpMuxFilter::ExpectAnswer(ContentSource source) { |
| 133 return ((state_ == ST_SENTOFFER && source == CS_REMOTE) || | 139 return ((state_ == ST_SENTOFFER && source == CS_REMOTE) || |
| 134 (state_ == ST_RECEIVEDOFFER && source == CS_LOCAL) || | 140 (state_ == ST_RECEIVEDOFFER && source == CS_LOCAL) || |
| 135 (state_ == ST_SENTPRANSWER && source == CS_LOCAL) || | 141 (state_ == ST_SENTPRANSWER && source == CS_LOCAL) || |
| 136 (state_ == ST_RECEIVEDPRANSWER && source == CS_REMOTE)); | 142 (state_ == ST_RECEIVEDPRANSWER && source == CS_REMOTE)); |
| 137 } | 143 } |
| 138 | 144 |
| 139 } // namespace cricket | 145 } // namespace cricket |
| OLD | NEW |