Add test for split-mode SSRC callback

And fix bug that prevented it from passing.

Bug: webrtc:13931
Change-Id: I6cbc8e3aad704f6f7e33362efb7ec589ca6e6568
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/306184
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40112}
This commit is contained in:
Harald Alvestrand 2023-05-22 21:34:24 +00:00 committed by WebRTC LUCI CQ
parent 85632b8191
commit 4858a0d9d8
2 changed files with 33 additions and 1 deletions

View File

@ -1877,7 +1877,7 @@ bool WebRtcVoiceMediaChannel::AddSendStream(const StreamParams& sp) {
if (role() == MediaChannel::Role::kBoth) {
// In legacy kBoth mode, the MediaChannel takes the responsibility for
// telling the receiver about the local SSRC.
// In kSend mode, this is the caller's responsibility.
// In kSend mode, this happens via a callback.
// At this point the stream's local SSRC has been updated. If it is the
// first send stream, make sure that all the receive streams are updated
@ -1888,6 +1888,12 @@ bool WebRtcVoiceMediaChannel::AddSendStream(const StreamParams& sp) {
call_->OnLocalSsrcUpdated(kv.second->stream(), ssrc);
}
}
} else if (ssrc_list_changed_callback_) {
std::set<uint32_t> ssrcs_in_use;
for (auto it : send_streams_) {
ssrcs_in_use.insert(it.first);
}
ssrc_list_changed_callback_(ssrcs_in_use);
}
send_streams_[ssrc]->SetSend(send_);

View File

@ -173,6 +173,32 @@ TEST_P(PeerConnectionMediaChannelSplitTest, VideoPacketLossCausesNack) {
EXPECT_TRUE_WAIT(NacksReceivedCount(*caller()) > 0, kDefaultTimeout);
}
// Test that we can get capture start ntp time.
TEST_P(PeerConnectionMediaChannelSplitTest,
GetCaptureStartNtpTimeWithOldStatsApi) {
ASSERT_TRUE(CreatePeerConnectionWrappers());
ConnectFakeSignaling();
caller()->AddAudioTrack();
callee()->AddAudioTrack();
// Do offer/answer, wait for the callee to receive some frames.
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
// Get the remote audio track created on the receiver, so they can be used as
// GetStats filters.
auto receivers = callee()->pc()->GetReceivers();
ASSERT_EQ(1u, receivers.size());
auto remote_audio_track = receivers[0]->track();
// Get the audio output level stats. Note that the level is not available
// until an RTCP packet has been received.
EXPECT_TRUE_WAIT(callee()->OldGetStatsForTrack(remote_audio_track.get())
->CaptureStartNtpTime() > 0,
2 * kMaxWaitForFramesMs);
}
INSTANTIATE_TEST_SUITE_P(PeerConnectionMediaChannelSplitTest,
PeerConnectionMediaChannelSplitTest,
Values("WebRTC-SplitMediaChannel/Disabled/",