Check that PC is configured for media before doing media operations.

If media_engine is not passed in init parameters, the PC can't handle
media, but can be used for datachannels. This CL adds testing that
datachannels work without media engine, and adds failure returns
to PeerConnection APIs that manipulate media when media engine is
not present.

Bug: webrtc:13931
Change-Id: Iecdf17a0a0bb89e0ad39eb74d6ed077303b875c2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/261246
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36778}
This commit is contained in:
Harald Alvestrand
2022-05-05 07:37:41 +00:00
committed by WebRTC LUCI CQ
parent 3c2359c663
commit 35ba0c5cd5
5 changed files with 79 additions and 12 deletions

View File

@ -3675,6 +3675,13 @@ TEST_P(PeerConnectionIntegrationTest, NewTracksDoNotCauseNewCandidates) {
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
}
TEST_P(PeerConnectionIntegrationTest, MediaCallWithoutMediaEngineFails) {
ASSERT_TRUE(CreatePeerConnectionWrappersWithoutMediaEngine());
// AddTrack should fail.
EXPECT_FALSE(
caller()->pc()->AddTrack(caller()->CreateLocalAudioTrack(), {}).ok());
}
INSTANTIATE_TEST_SUITE_P(
PeerConnectionIntegrationTest,
PeerConnectionIntegrationInteropTest,