Replace MediaContentDirection with RtpTransceiverDirection
Bug: webrtc:8558
Change-Id: I410d17cce235e0b42038cf0b125fd916010f50ae
Reviewed-on: https://webrtc-review.googlesource.com/24745
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Peter Thatcher <pthatcher@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20922}
diff --git a/pc/channel.cc b/pc/channel.cc
index 8bb37d1..b976cc0 100644
--- a/pc/channel.cc
+++ b/pc/channel.cc
@@ -31,6 +31,7 @@
#include "media/engine/webrtcvoiceengine.h" // nogncheck
#include "p2p/base/packettransportinternal.h"
#include "pc/channelmanager.h"
+#include "pc/rtpmediautils.h"
#include "pc/rtptransport.h"
#include "pc/srtptransport.h"
@@ -103,14 +104,6 @@
return packet && IsValidRtpRtcpPacketSize(rtcp, packet->size());
}
-static bool IsReceiveContentDirection(MediaContentDirection direction) {
- return direction == MD_SENDRECV || direction == MD_RECVONLY;
-}
-
-static bool IsSendContentDirection(MediaContentDirection direction) {
- return direction == MD_SENDRECV || direction == MD_SENDONLY;
-}
-
template <class Codec>
void RtpParametersFromMediaDescription(
const MediaContentDescriptionImpl<Codec>* desc,
@@ -510,7 +503,8 @@
bool BaseChannel::IsReadyToReceiveMedia_w() const {
// Receive data if we are enabled and have local content,
- return enabled() && IsReceiveContentDirection(local_content_direction_);
+ return enabled() &&
+ webrtc::RtpTransceiverDirectionHasRecv(local_content_direction_);
}
bool BaseChannel::IsReadyToSendMedia_w() const {
@@ -522,8 +516,9 @@
bool BaseChannel::IsReadyToSendMedia_n() const {
// Send outgoing data if we are enabled, have local and remote content,
// and we have had some form of connectivity.
- return enabled() && IsReceiveContentDirection(remote_content_direction_) &&
- IsSendContentDirection(local_content_direction_) &&
+ return enabled() &&
+ webrtc::RtpTransceiverDirectionHasRecv(remote_content_direction_) &&
+ webrtc::RtpTransceiverDirectionHasSend(local_content_direction_) &&
was_ever_writable() && (srtp_active() || !ShouldSetupDtlsSrtp_n());
}