Implement legacy offer_to_receive options for Unified Plan
This implements the WebRTC specification for handling the legacy offer options offer_to_receive_audio and offer_to_receive_video. They are not implemented for CreateAnswer. With Unified Plan semantics, clients should switch to the RtpTransceiver API for ensuring the correct media sections are offered. Bug: webrtc:7600 Change-Id: I6ced00b86b165a352bd0ca3d64b48fadcfd12235 Reviewed-on: https://webrtc-review.googlesource.com/41341 Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Commit-Queue: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21784}
This commit is contained in:
@ -8,16 +8,24 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <tuple>
|
||||
|
||||
#include "pc/rtpmediautils.h"
|
||||
#include "test/gtest.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
using ::testing::Bool;
|
||||
using ::testing::Combine;
|
||||
using ::testing::Values;
|
||||
using ::testing::ValuesIn;
|
||||
|
||||
RtpTransceiverDirection kAllDirections[] = {
|
||||
RtpTransceiverDirection::kSendRecv, RtpTransceiverDirection::kSendOnly,
|
||||
RtpTransceiverDirection::kRecvOnly, RtpTransceiverDirection::kInactive};
|
||||
|
||||
class EnumerateAllDirectionsTest
|
||||
: public ::testing::Test,
|
||||
public ::testing::WithParamInterface<RtpTransceiverDirection> {};
|
||||
: public ::testing::TestWithParam<RtpTransceiverDirection> {};
|
||||
|
||||
// Test that converting the direction to send/recv and back again results in the
|
||||
// same direction.
|
||||
@ -51,9 +59,38 @@ TEST_P(EnumerateAllDirectionsTest, TestReversedIdentity) {
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(RtpTransceiverDirectionTest,
|
||||
EnumerateAllDirectionsTest,
|
||||
Values(RtpTransceiverDirection::kSendRecv,
|
||||
RtpTransceiverDirection::kSendOnly,
|
||||
RtpTransceiverDirection::kRecvOnly,
|
||||
RtpTransceiverDirection::kInactive));
|
||||
ValuesIn(kAllDirections));
|
||||
|
||||
class EnumerateAllDirectionsAndBool
|
||||
: public ::testing::TestWithParam<
|
||||
std::tuple<RtpTransceiverDirection, bool>> {};
|
||||
|
||||
TEST_P(EnumerateAllDirectionsAndBool, TestWithSendSet) {
|
||||
RtpTransceiverDirection direction = std::get<0>(GetParam());
|
||||
bool send = std::get<1>(GetParam());
|
||||
|
||||
RtpTransceiverDirection result =
|
||||
RtpTransceiverDirectionWithSendSet(direction, send);
|
||||
|
||||
EXPECT_EQ(send, RtpTransceiverDirectionHasSend(result));
|
||||
EXPECT_EQ(RtpTransceiverDirectionHasRecv(direction),
|
||||
RtpTransceiverDirectionHasRecv(result));
|
||||
}
|
||||
|
||||
TEST_P(EnumerateAllDirectionsAndBool, TestWithRecvSet) {
|
||||
RtpTransceiverDirection direction = std::get<0>(GetParam());
|
||||
bool recv = std::get<1>(GetParam());
|
||||
|
||||
RtpTransceiverDirection result =
|
||||
RtpTransceiverDirectionWithRecvSet(direction, recv);
|
||||
|
||||
EXPECT_EQ(RtpTransceiverDirectionHasSend(direction),
|
||||
RtpTransceiverDirectionHasSend(result));
|
||||
EXPECT_EQ(recv, RtpTransceiverDirectionHasRecv(result));
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(RtpTransceiverDirectionTest,
|
||||
EnumerateAllDirectionsAndBool,
|
||||
Combine(ValuesIn(kAllDirections), Bool()));
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
Reference in New Issue
Block a user