diff --git a/pc/channel.cc b/pc/channel.cc index e6c8da7ec3..9d7bf86afc 100644 --- a/pc/channel.cc +++ b/pc/channel.cc @@ -47,8 +47,7 @@ struct SendPacketMessageData : public rtc::MessageData { } // namespace enum { - MSG_EARLYMEDIATIMEOUT = 1, - MSG_SEND_RTP_PACKET, + MSG_SEND_RTP_PACKET = 1, MSG_SEND_RTCP_PACKET, MSG_READYTOSENDDATA, MSG_DATARECEIVED, @@ -1155,47 +1154,6 @@ VoiceChannel::~VoiceChannel() { Deinit(); } -bool VoiceChannel::SetAudioSend(uint32_t ssrc, - bool enable, - const AudioOptions* options, - AudioSource* source) { - return InvokeOnWorker( - RTC_FROM_HERE, Bind(&VoiceMediaChannel::SetAudioSend, media_channel(), - ssrc, enable, options, source)); -} - -// TODO(juberti): Handle early media the right way. We should get an explicit -// ringing message telling us to start playing local ringback, which we cancel -// if any early media actually arrives. For now, we do the opposite, which is -// to wait 1 second for early media, and start playing local ringback if none -// arrives. -void VoiceChannel::SetEarlyMedia(bool enable) { - if (enable) { - // Start the early media timeout - worker_thread()->PostDelayed(RTC_FROM_HERE, kEarlyMediaTimeout, this, - MSG_EARLYMEDIATIMEOUT); - } else { - // Stop the timeout if currently going. - worker_thread()->Clear(this, MSG_EARLYMEDIATIMEOUT); - } -} - -bool VoiceChannel::GetStats(VoiceMediaInfo* stats) { - return InvokeOnWorker(RTC_FROM_HERE, Bind(&VoiceMediaChannel::GetStats, - media_channel(), stats)); -} - -void VoiceChannel::OnPacketReceived(bool rtcp, - rtc::CopyOnWriteBuffer* packet, - const rtc::PacketTime& packet_time) { - BaseChannel::OnPacketReceived(rtcp, packet, packet_time); - // Set a flag when we've received an RTP packet. If we're waiting for early - // media, this will disable the timeout. - if (!received_media_ && !rtcp) { - received_media_ = true; - } -} - void BaseChannel::UpdateMediaSendRecvState() { RTC_DCHECK(network_thread_->IsCurrent()); invoker_.AsyncInvoke( @@ -1319,25 +1277,6 @@ bool VoiceChannel::SetRemoteContent_w(const MediaContentDescription* content, return true; } -void VoiceChannel::HandleEarlyMediaTimeout() { - // This occurs on the main thread, not the worker thread. - if (!received_media_) { - RTC_LOG(LS_INFO) << "No early media received before timeout"; - SignalEarlyMediaTimeout(this); - } -} - -void VoiceChannel::OnMessage(rtc::Message *pmsg) { - switch (pmsg->message_id) { - case MSG_EARLYMEDIATIMEOUT: - HandleEarlyMediaTimeout(); - break; - default: - BaseChannel::OnMessage(pmsg); - break; - } -} - VideoChannel::VideoChannel(rtc::Thread* worker_thread, rtc::Thread* network_thread, rtc::Thread* signaling_thread, @@ -1378,11 +1317,6 @@ void VideoChannel::FillBitrateInfo(BandwidthEstimationInfo* bwe_info) { media_channel(), bwe_info)); } -bool VideoChannel::GetStats(VideoMediaInfo* stats) { - return InvokeOnWorker(RTC_FROM_HERE, Bind(&VideoMediaChannel::GetStats, - media_channel(), stats)); -} - bool VideoChannel::SetLocalContent_w(const MediaContentDescription* content, SdpType type, std::string* error_desc) { diff --git a/pc/channel.h b/pc/channel.h index 339c785024..9ba0492e5d 100644 --- a/pc/channel.h +++ b/pc/channel.h @@ -265,9 +265,9 @@ class BaseChannel void HandlePacket(bool rtcp, rtc::CopyOnWriteBuffer* packet, const rtc::PacketTime& packet_time); // TODO(zstein): packet can be const once the RtpTransport handles protection. - virtual void OnPacketReceived(bool rtcp, - rtc::CopyOnWriteBuffer* packet, - const rtc::PacketTime& packet_time); + void OnPacketReceived(bool rtcp, + rtc::CopyOnWriteBuffer* packet, + const rtc::PacketTime& packet_time); void ProcessPacket(bool rtcp, const rtc::CopyOnWriteBuffer& packet, const rtc::PacketTime& packet_time); @@ -450,27 +450,11 @@ class VoiceChannel : public BaseChannel { bool srtp_required); ~VoiceChannel(); - // Configure sending media on the stream with SSRC |ssrc| - // If there is only one sending stream SSRC 0 can be used. - bool SetAudioSend(uint32_t ssrc, - bool enable, - const AudioOptions* options, - AudioSource* source); - // downcasts a MediaChannel VoiceMediaChannel* media_channel() const override { return static_cast(BaseChannel::media_channel()); } - void SetEarlyMedia(bool enable); - // This signal is emitted when we have gone a period of time without - // receiving early media. When received, a UI should start playing its - // own ringing sound - sigslot::signal1 SignalEarlyMediaTimeout; - - // Get statistics about the current media session. - bool GetStats(VoiceMediaInfo* stats); - webrtc::RtpParameters GetRtpSendParameters_w(uint32_t ssrc) const; webrtc::RTCError SetRtpSendParameters_w(uint32_t ssrc, webrtc::RtpParameters parameters); @@ -478,9 +462,6 @@ class VoiceChannel : public BaseChannel { private: // overrides from BaseChannel - void OnPacketReceived(bool rtcp, - rtc::CopyOnWriteBuffer* packet, - const rtc::PacketTime& packet_time) override; void UpdateMediaSendRecvState_w() override; bool SetLocalContent_w(const MediaContentDescription* content, webrtc::SdpType type, @@ -488,12 +469,6 @@ class VoiceChannel : public BaseChannel { bool SetRemoteContent_w(const MediaContentDescription* content, webrtc::SdpType type, std::string* error_desc) override; - void HandleEarlyMediaTimeout(); - - void OnMessage(rtc::Message* pmsg) override; - - static const int kEarlyMediaTimeout = 1000; - bool received_media_ = false; // Last AudioSendParameters sent down to the media_channel() via // SetSendParameters. @@ -521,8 +496,6 @@ class VideoChannel : public BaseChannel { } void FillBitrateInfo(BandwidthEstimationInfo* bwe_info); - // Get statistics about the current media session. - bool GetStats(VideoMediaInfo* stats); cricket::MediaType media_type() override { return cricket::MEDIA_TYPE_VIDEO; } @@ -535,7 +508,6 @@ class VideoChannel : public BaseChannel { bool SetRemoteContent_w(const MediaContentDescription* content, webrtc::SdpType type, std::string* error_desc) override; - bool GetStats_w(VideoMediaInfo* stats); // Last VideoSendParameters sent down to the media_channel() via // SetSendParameters. diff --git a/pc/channel_unittest.cc b/pc/channel_unittest.cc index 92d3b24450..7ee35013ac 100644 --- a/pc/channel_unittest.cc +++ b/pc/channel_unittest.cc @@ -2166,28 +2166,6 @@ TEST_F(VoiceChannelSingleThreadTest, TestPlayoutAndSendingStates) { Base::TestPlayoutAndSendingStates(); } -TEST_F(VoiceChannelSingleThreadTest, TestMuteStream) { - CreateChannels(0, 0); - // Test that we can Mute the default channel even though the sending SSRC - // is unknown. - EXPECT_FALSE(media_channel1_->IsStreamMuted(0)); - EXPECT_TRUE(channel1_->SetAudioSend(0, false, nullptr, nullptr)); - EXPECT_TRUE(media_channel1_->IsStreamMuted(0)); - EXPECT_TRUE(channel1_->SetAudioSend(0, true, nullptr, nullptr)); - EXPECT_FALSE(media_channel1_->IsStreamMuted(0)); - - // Test that we can not mute an unknown SSRC. - EXPECT_FALSE(channel1_->SetAudioSend(kSsrc1, false, nullptr, nullptr)); - - SendInitiate(); - // After the local session description has been set, we can mute a stream - // with its SSRC. - EXPECT_TRUE(channel1_->SetAudioSend(kSsrc1, false, nullptr, nullptr)); - EXPECT_TRUE(media_channel1_->IsStreamMuted(kSsrc1)); - EXPECT_TRUE(channel1_->SetAudioSend(kSsrc1, true, nullptr, nullptr)); - EXPECT_FALSE(media_channel1_->IsStreamMuted(kSsrc1)); -} - TEST_F(VoiceChannelSingleThreadTest, TestMediaContentDirection) { Base::TestMediaContentDirection(); } @@ -2427,28 +2405,6 @@ TEST_F(VoiceChannelDoubleThreadTest, TestPlayoutAndSendingStates) { Base::TestPlayoutAndSendingStates(); } -TEST_F(VoiceChannelDoubleThreadTest, TestMuteStream) { - CreateChannels(0, 0); - // Test that we can Mute the default channel even though the sending SSRC - // is unknown. - EXPECT_FALSE(media_channel1_->IsStreamMuted(0)); - EXPECT_TRUE(channel1_->SetAudioSend(0, false, nullptr, nullptr)); - EXPECT_TRUE(media_channel1_->IsStreamMuted(0)); - EXPECT_TRUE(channel1_->SetAudioSend(0, true, nullptr, nullptr)); - EXPECT_FALSE(media_channel1_->IsStreamMuted(0)); - - // Test that we can not mute an unknown SSRC. - EXPECT_FALSE(channel1_->SetAudioSend(kSsrc1, false, nullptr, nullptr)); - - SendInitiate(); - // After the local session description has been set, we can mute a stream - // with its SSRC. - EXPECT_TRUE(channel1_->SetAudioSend(kSsrc1, false, nullptr, nullptr)); - EXPECT_TRUE(media_channel1_->IsStreamMuted(kSsrc1)); - EXPECT_TRUE(channel1_->SetAudioSend(kSsrc1, true, nullptr, nullptr)); - EXPECT_FALSE(media_channel1_->IsStreamMuted(kSsrc1)); -} - TEST_F(VoiceChannelDoubleThreadTest, TestMediaContentDirection) { Base::TestMediaContentDirection(); }