Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(974)

Unified Diff: webrtc/api/webrtcsession_unittest.cc

Issue 2046173002: Use VoiceChannel/VideoChannel directly from RtpSender/RtpReceiver. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Moving code that needs to execute out of RTC_DCHECKs. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/api/webrtcsession.cc ('k') | webrtc/media/base/fakemediaengine.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/webrtcsession_unittest.cc
diff --git a/webrtc/api/webrtcsession_unittest.cc b/webrtc/api/webrtcsession_unittest.cc
index fab5e1a56fcc4cd1c314fbfe84f8f5aeca06f1eb..ee1d19b23adaee4cf899e28666b294dafc0aa127 100644
--- a/webrtc/api/webrtcsession_unittest.cc
+++ b/webrtc/api/webrtcsession_unittest.cc
@@ -253,11 +253,6 @@ class WebRtcSessionForTest : public webrtc::WebRtcSession {
return rtcp_transport_channel(data_channel());
}
- using webrtc::WebRtcSession::SetAudioPlayout;
- using webrtc::WebRtcSession::SetAudioSend;
- using webrtc::WebRtcSession::SetVideoPlayout;
- using webrtc::WebRtcSession::SetVideoSend;
-
private:
cricket::TransportChannel* rtp_transport_channel(cricket::BaseChannel* ch) {
if (!ch) {
@@ -3392,163 +3387,6 @@ TEST_F(WebRtcSessionTest, TestDisabledRtcpMuxWithBundleEnabled) {
SetLocalDescriptionWithoutError(offer);
}
-TEST_F(WebRtcSessionTest, SetAudioPlayout) {
- Init();
- SendAudioVideoStream1();
- CreateAndSetRemoteOfferAndLocalAnswer();
- cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0);
- ASSERT_TRUE(channel != NULL);
- ASSERT_EQ(1u, channel->recv_streams().size());
- uint32_t receive_ssrc = channel->recv_streams()[0].first_ssrc();
- double volume;
- EXPECT_TRUE(channel->GetOutputVolume(receive_ssrc, &volume));
- EXPECT_EQ(1, volume);
- session_->SetAudioPlayout(receive_ssrc, false);
- EXPECT_TRUE(channel->GetOutputVolume(receive_ssrc, &volume));
- EXPECT_EQ(0, volume);
- session_->SetAudioPlayout(receive_ssrc, true);
- EXPECT_TRUE(channel->GetOutputVolume(receive_ssrc, &volume));
- EXPECT_EQ(1, volume);
-}
-
-TEST_F(WebRtcSessionTest, SetAudioMaxSendBitrate) {
- Init();
- SendAudioVideoStream1();
- CreateAndSetRemoteOfferAndLocalAnswer();
- cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0);
- ASSERT_TRUE(channel != NULL);
- uint32_t send_ssrc = channel->send_streams()[0].first_ssrc();
- EXPECT_EQ(-1, channel->max_bps());
- webrtc::RtpParameters params = session_->GetAudioRtpSendParameters(send_ssrc);
- EXPECT_EQ(1, params.encodings.size());
- EXPECT_EQ(-1, params.encodings[0].max_bitrate_bps);
- params.encodings[0].max_bitrate_bps = 1000;
- EXPECT_TRUE(session_->SetAudioRtpSendParameters(send_ssrc, params));
-
- // Read back the parameters and verify they have been changed.
- params = session_->GetAudioRtpSendParameters(send_ssrc);
- EXPECT_EQ(1, params.encodings.size());
- EXPECT_EQ(1000, params.encodings[0].max_bitrate_bps);
-
- // Verify that the audio channel received the new parameters.
- params = channel->GetRtpSendParameters(send_ssrc);
- EXPECT_EQ(1, params.encodings.size());
- EXPECT_EQ(1000, params.encodings[0].max_bitrate_bps);
-
- // Verify that the global bitrate limit has not been changed.
- EXPECT_EQ(-1, channel->max_bps());
-}
-
-TEST_F(WebRtcSessionTest, SetAudioSend) {
- Init();
- SendAudioVideoStream1();
- CreateAndSetRemoteOfferAndLocalAnswer();
- cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0);
- ASSERT_TRUE(channel != NULL);
- ASSERT_EQ(1u, channel->send_streams().size());
- uint32_t send_ssrc = channel->send_streams()[0].first_ssrc();
- EXPECT_FALSE(channel->IsStreamMuted(send_ssrc));
-
- cricket::AudioOptions options;
- options.echo_cancellation = rtc::Optional<bool>(true);
-
- std::unique_ptr<FakeAudioSource> source(new FakeAudioSource());
- session_->SetAudioSend(send_ssrc, false, options, source.get());
- EXPECT_TRUE(channel->IsStreamMuted(send_ssrc));
- EXPECT_EQ(rtc::Optional<bool>(), channel->options().echo_cancellation);
- EXPECT_TRUE(source->sink() != nullptr);
-
- // This will trigger SetSink(nullptr) to the |source|.
- session_->SetAudioSend(send_ssrc, true, options, nullptr);
- EXPECT_FALSE(channel->IsStreamMuted(send_ssrc));
- EXPECT_EQ(rtc::Optional<bool>(true), channel->options().echo_cancellation);
- EXPECT_TRUE(source->sink() == nullptr);
-}
-
-TEST_F(WebRtcSessionTest, AudioSourceForLocalStream) {
- Init();
- SendAudioVideoStream1();
- CreateAndSetRemoteOfferAndLocalAnswer();
- cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0);
- ASSERT_TRUE(channel != NULL);
- ASSERT_EQ(1u, channel->send_streams().size());
- uint32_t send_ssrc = channel->send_streams()[0].first_ssrc();
-
- std::unique_ptr<FakeAudioSource> source(new FakeAudioSource());
- cricket::AudioOptions options;
- session_->SetAudioSend(send_ssrc, true, options, source.get());
- EXPECT_TRUE(source->sink() != nullptr);
-
- // Delete the |source| and it will trigger OnClose() to the sink, and this
- // will invalidate the |source_| pointer in the sink and prevent getting a
- // SetSink(nullptr) callback afterwards.
- source.reset();
-
- // This will trigger SetSink(nullptr) if no OnClose() callback.
- session_->SetAudioSend(send_ssrc, true, options, nullptr);
-}
-
-TEST_F(WebRtcSessionTest, SetVideoPlayout) {
- Init();
- SendAudioVideoStream1();
- CreateAndSetRemoteOfferAndLocalAnswer();
- cricket::FakeVideoMediaChannel* channel = media_engine_->GetVideoChannel(0);
- ASSERT_TRUE(channel != NULL);
- ASSERT_LT(0u, channel->sinks().size());
- EXPECT_TRUE(channel->sinks().begin()->second == NULL);
- ASSERT_EQ(1u, channel->recv_streams().size());
- uint32_t receive_ssrc = channel->recv_streams()[0].first_ssrc();
- cricket::FakeVideoRenderer renderer;
- session_->SetVideoPlayout(receive_ssrc, true, &renderer);
- EXPECT_TRUE(channel->sinks().begin()->second == &renderer);
- session_->SetVideoPlayout(receive_ssrc, false, &renderer);
- EXPECT_TRUE(channel->sinks().begin()->second == NULL);
-}
-
-TEST_F(WebRtcSessionTest, SetVideoMaxSendBitrate) {
- Init();
- SendAudioVideoStream1();
- CreateAndSetRemoteOfferAndLocalAnswer();
- cricket::FakeVideoMediaChannel* channel = media_engine_->GetVideoChannel(0);
- ASSERT_TRUE(channel != NULL);
- uint32_t send_ssrc = channel->send_streams()[0].first_ssrc();
- EXPECT_EQ(-1, channel->max_bps());
- webrtc::RtpParameters params = session_->GetVideoRtpSendParameters(send_ssrc);
- EXPECT_EQ(1, params.encodings.size());
- EXPECT_EQ(-1, params.encodings[0].max_bitrate_bps);
- params.encodings[0].max_bitrate_bps = 1000;
- EXPECT_TRUE(session_->SetVideoRtpSendParameters(send_ssrc, params));
-
- // Read back the parameters and verify they have been changed.
- params = session_->GetVideoRtpSendParameters(send_ssrc);
- EXPECT_EQ(1, params.encodings.size());
- EXPECT_EQ(1000, params.encodings[0].max_bitrate_bps);
-
- // Verify that the video channel received the new parameters.
- params = channel->GetRtpSendParameters(send_ssrc);
- EXPECT_EQ(1, params.encodings.size());
- EXPECT_EQ(1000, params.encodings[0].max_bitrate_bps);
-
- // Verify that the global bitrate limit has not been changed.
- EXPECT_EQ(-1, channel->max_bps());
-}
-
-TEST_F(WebRtcSessionTest, SetVideoSend) {
- Init();
- SendAudioVideoStream1();
- CreateAndSetRemoteOfferAndLocalAnswer();
- cricket::FakeVideoMediaChannel* channel = media_engine_->GetVideoChannel(0);
- ASSERT_TRUE(channel != NULL);
- ASSERT_EQ(1u, channel->send_streams().size());
- uint32_t send_ssrc = channel->send_streams()[0].first_ssrc();
- EXPECT_FALSE(channel->IsStreamMuted(send_ssrc));
- cricket::VideoOptions* options = NULL;
- session_->SetVideoSend(send_ssrc, false, options, nullptr);
- EXPECT_TRUE(channel->IsStreamMuted(send_ssrc));
- session_->SetVideoSend(send_ssrc, true, options, nullptr);
- EXPECT_FALSE(channel->IsStreamMuted(send_ssrc));
-}
-
TEST_F(WebRtcSessionTest, CanNotInsertDtmf) {
TestCanInsertDtmf(false);
}
« no previous file with comments | « webrtc/api/webrtcsession.cc ('k') | webrtc/media/base/fakemediaengine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698