Remove PeerConnection voice_channel/video_channel methods

These methods no longer work with Unified Plan and have been
replaced by iterating over RtpTransceivers to get all the
VoiceChannels and VideoChannels.

Bug: webrtc:8587
Change-Id: I66ec282ee9f7eb987c32e30957733c13c6cf45b8
Reviewed-on: https://webrtc-review.googlesource.com/55760
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22110}
This commit is contained in:
Steve Anton 2018-02-20 11:35:37 -08:00 committed by Commit Bot
parent db53f8e604
commit afb0bb73de
6 changed files with 58 additions and 50 deletions

View File

@ -2922,20 +2922,32 @@ void PeerConnection::SetAudioRecording(bool recording) {
std::unique_ptr<rtc::SSLCertificate>
PeerConnection::GetRemoteAudioSSLCertificate() {
if (!voice_channel()) {
auto audio_transceiver = GetFirstAudioTransceiver();
if (!audio_transceiver || !audio_transceiver->internal()->channel()) {
return nullptr;
}
return GetRemoteSSLCertificate(voice_channel()->transport_name());
return GetRemoteSSLCertificate(
audio_transceiver->internal()->channel()->transport_name());
}
std::unique_ptr<rtc::SSLCertChain>
PeerConnection::GetRemoteAudioSSLCertChain() {
if (!voice_channel()) {
auto audio_transceiver = GetFirstAudioTransceiver();
if (!audio_transceiver || !audio_transceiver->internal()->channel()) {
return nullptr;
}
return transport_controller_->GetRemoteSSLCertChain(
voice_channel()->transport_name());
audio_transceiver->internal()->channel()->transport_name());
}
rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>>
PeerConnection::GetFirstAudioTransceiver() const {
for (auto transceiver : transceivers_) {
if (transceiver->media_type() == cricket::MEDIA_TYPE_AUDIO) {
return transceiver;
}
}
return nullptr;
}
bool PeerConnection::StartRtcEventLog(rtc::PlatformFile file,
@ -3073,6 +3085,28 @@ void PeerConnection::OnMessage(rtc::Message* msg) {
}
}
cricket::VoiceMediaChannel* PeerConnection::voice_media_channel() const {
RTC_DCHECK(!IsUnifiedPlan());
auto* voice_channel = static_cast<cricket::VoiceChannel*>(
GetAudioTransceiver()->internal()->channel());
if (voice_channel) {
return voice_channel->media_channel();
} else {
return nullptr;
}
}
cricket::VideoMediaChannel* PeerConnection::video_media_channel() const {
RTC_DCHECK(!IsUnifiedPlan());
auto* video_channel = static_cast<cricket::VideoChannel*>(
GetVideoTransceiver()->internal()->channel());
if (video_channel) {
return video_channel->media_channel();
} else {
return nullptr;
}
}
void PeerConnection::CreateAudioReceiver(
MediaStreamInterface* stream,
const RtpSenderInfo& remote_sender_info) {

View File

@ -203,26 +203,6 @@ class PeerConnection : public PeerConnectionInternal,
return initial_offerer_ && *initial_offerer_;
}
cricket::VoiceChannel* voice_channel() const override {
if (IsUnifiedPlan()) {
// TODO(bugs.webrtc.org/8764): Change stats collection to work with
// transceivers.
return nullptr;
}
return static_cast<cricket::VoiceChannel*>(
GetAudioTransceiver()->internal()->channel());
}
cricket::VideoChannel* video_channel() const override {
if (IsUnifiedPlan()) {
// TODO(bugs.webrtc.org/8764): Change stats collection to work with
// transceivers.
return nullptr;
}
return static_cast<cricket::VideoChannel*>(
GetVideoTransceiver()->internal()->channel());
}
std::vector<
rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>>>
GetTransceiversInternal() const override {
@ -295,13 +275,10 @@ class PeerConnection : public PeerConnectionInternal,
// Implements MessageHandler.
void OnMessage(rtc::Message* msg) override;
cricket::VoiceMediaChannel* voice_media_channel() const {
return voice_channel() ? voice_channel()->media_channel() : nullptr;
}
cricket::VideoMediaChannel* video_media_channel() const {
return video_channel() ? video_channel()->media_channel() : nullptr;
}
// Plan B helpers for getting the voice/video media channels for the single
// audio/video transceiver, if it exists.
cricket::VoiceMediaChannel* voice_media_channel() const;
cricket::VideoMediaChannel* video_media_channel() const;
std::vector<rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>>>
GetSendersInternal() const;
@ -314,6 +291,9 @@ class PeerConnection : public PeerConnectionInternal,
rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>>
GetVideoTransceiver() const;
rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>>
GetFirstAudioTransceiver() const;
void CreateAudioReceiver(MediaStreamInterface* stream,
const RtpSenderInfo& remote_sender_info);

View File

@ -37,10 +37,6 @@ class PeerConnectionInternal : public PeerConnectionInterface {
// Returns true if we were the initial offerer.
virtual bool initial_offerer() const = 0;
// TODO(steveanton): Remove these and replace with GetTransceiversInternal.
virtual cricket::VoiceChannel* voice_channel() const = 0;
virtual cricket::VideoChannel* video_channel() const = 0;
virtual std::vector<
rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>>>
GetTransceiversInternal() const = 0;

View File

@ -835,11 +835,21 @@ void StatsCollector::ExtractBweInfo() {
bwe_info.available_send_bandwidth = call_stats.send_bandwidth_bps;
bwe_info.available_recv_bandwidth = call_stats.recv_bandwidth_bps;
bwe_info.bucket_delay = call_stats.pacer_delay_ms;
// Fill in target encoder bitrate, actual encoder bitrate, rtx bitrate, etc.
// TODO(holmer): Also fill this in for audio.
if (pc_->video_channel()) {
pc_->video_channel()->FillBitrateInfo(&bwe_info);
for (auto transceiver : pc_->GetTransceiversInternal()) {
if (transceiver->media_type() != cricket::MEDIA_TYPE_VIDEO) {
continue;
}
auto* video_channel =
static_cast<cricket::VideoChannel*>(transceiver->internal()->channel());
if (!video_channel) {
continue;
}
video_channel->FillBitrateInfo(&bwe_info);
}
StatsReport::Id report_id(StatsReport::NewBandwidthEstimationId());
StatsReport* report = reports_.FindOrAddNew(report_id);
ExtractStats(bwe_info, stats_gathering_started_, report);

View File

@ -243,10 +243,6 @@ class FakePeerConnectionBase : public PeerConnectionInternal {
bool initial_offerer() const override { return false; }
cricket::VoiceChannel* voice_channel() const override { return nullptr; }
cricket::VideoChannel* video_channel() const override { return nullptr; }
std::vector<
rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>>>
GetTransceiversInternal() const override {

View File

@ -241,14 +241,6 @@ class FakePeerConnectionForStats : public FakePeerConnectionBase {
rtc::Thread* signaling_thread() const override { return signaling_thread_; }
cricket::VoiceChannel* voice_channel() const override {
return voice_channel_.get();
}
cricket::VideoChannel* video_channel() const override {
return video_channel_.get();
}
std::vector<
rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>>>
GetTransceiversInternal() const override {