Allow streams to be sent without |source_| being initially set
This makes it consistent with how things are done in webrtc_video_engine.cc This will improve the JS code by not having to initialize an audio track every time frames need to be sent over, especially from another peer connection in case of encoded transforms. Bug: chromium:1477192 Change-Id: I3f938ad812ff377599a3799d4c2d2cd85149189e Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/322702 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Tony Herre <herre@google.com> Commit-Queue: Palak Agarwal <agpalak@google.com> Cr-Commit-Position: refs/heads/main@{#40917}
This commit is contained in:
parent
5f4efcf303
commit
af74dff19e
@ -1105,9 +1105,10 @@ class WebRtcVoiceSendChannel::WebRtcAudioSendStream : public AudioSource::Sink {
|
||||
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
|
||||
RTC_DCHECK(stream_);
|
||||
RTC_DCHECK_EQ(1UL, rtp_parameters_.encodings.size());
|
||||
if (send_ && source_ != nullptr && rtp_parameters_.encodings[0].active) {
|
||||
// Stream can be started without |source_| being set.
|
||||
if (send_ && rtp_parameters_.encodings[0].active) {
|
||||
stream_->Start();
|
||||
} else { // !send || source_ = nullptr
|
||||
} else {
|
||||
stream_->Stop();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2248,20 +2248,6 @@ TEST_P(WebRtcVoiceEngineTestFake, Send) {
|
||||
EXPECT_FALSE(GetSendStream(kSsrcX).IsSending());
|
||||
}
|
||||
|
||||
// Test that a channel will send if and only if it has a source and is enabled
|
||||
// for sending.
|
||||
TEST_P(WebRtcVoiceEngineTestFake, SendStateWithAndWithoutSource) {
|
||||
EXPECT_TRUE(SetupSendStream());
|
||||
SetSenderParameters(send_parameters_);
|
||||
SetAudioSend(kSsrcX, true, nullptr);
|
||||
SetSend(true);
|
||||
EXPECT_FALSE(GetSendStream(kSsrcX).IsSending());
|
||||
SetAudioSend(kSsrcX, true, &fake_source_);
|
||||
EXPECT_TRUE(GetSendStream(kSsrcX).IsSending());
|
||||
SetAudioSend(kSsrcX, true, nullptr);
|
||||
EXPECT_FALSE(GetSendStream(kSsrcX).IsSending());
|
||||
}
|
||||
|
||||
// Test that a channel is muted/unmuted.
|
||||
TEST_P(WebRtcVoiceEngineTestFake, SendStateMuteUnmute) {
|
||||
EXPECT_TRUE(SetupSendStream());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user