Change Channel::GetRtpRtcp to return only RtpRtcp, not RtpReceiver.

For use in AudiReceiveStream, introduce a new method GetSyncInfo. This
change is analogous to https://webrtc-review.googlesource.com/91123,
doing the same for RtpVideoStreamReceiver. It's a preparation for
bypassing the RtpReceiver class.

Bug: webrtc:7135
Change-Id: I87c1c6f0a1f28b0baebe07c4181f6f0427afa314
Reviewed-on: https://webrtc-review.googlesource.com/93022
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24228}
This commit is contained in:
Niels Möller
2018-08-08 10:49:16 +02:00
committed by Commit Bot
parent 43fa99c0ab
commit 848d6d300e
8 changed files with 43 additions and 40 deletions

View File

@ -257,26 +257,12 @@ int AudioReceiveStream::id() const {
absl::optional<Syncable::Info> AudioReceiveStream::GetInfo() const { absl::optional<Syncable::Info> AudioReceiveStream::GetInfo() const {
RTC_DCHECK_RUN_ON(&module_process_thread_checker_); RTC_DCHECK_RUN_ON(&module_process_thread_checker_);
Syncable::Info info; absl::optional<Syncable::Info> info = channel_proxy_->GetSyncInfo();
RtpRtcp* rtp_rtcp = nullptr; if (!info)
RtpReceiver* rtp_receiver = nullptr;
channel_proxy_->GetRtpRtcp(&rtp_rtcp, &rtp_receiver);
RTC_DCHECK(rtp_rtcp);
RTC_DCHECK(rtp_receiver);
if (!rtp_receiver->GetLatestTimestamps(
&info.latest_received_capture_timestamp,
&info.latest_receive_time_ms)) {
return absl::nullopt; return absl::nullopt;
}
if (rtp_rtcp->RemoteNTP(&info.capture_time_ntp_secs,
&info.capture_time_ntp_frac, nullptr, nullptr,
&info.capture_time_source_clock) != 0) {
return absl::nullopt;
}
info.current_delay_ms = channel_proxy_->GetDelayEstimate(); info->current_delay_ms = channel_proxy_->GetDelayEstimate();
return info; return info;
} }

View File

@ -141,8 +141,7 @@ AudioSendStream::AudioSendStream(
channel_proxy_->SetRtcEventLog(event_log_); channel_proxy_->SetRtcEventLog(event_log_);
channel_proxy_->SetRTCPStatus(true); channel_proxy_->SetRTCPStatus(true);
RtpReceiver* rtpReceiver = nullptr; // Unused, but required for call. rtp_rtcp_module_ = channel_proxy_->GetRtpRtcp();
channel_proxy_->GetRtpRtcp(&rtp_rtcp_module_, &rtpReceiver);
RTC_DCHECK(rtp_rtcp_module_); RTC_DCHECK(rtp_rtcp_module_);
ConfigureStream(this, config, true); ConfigureStream(this, config, true);

View File

@ -189,12 +189,9 @@ struct ConfigHelper {
void SetupDefaultChannelProxy(bool audio_bwe_enabled) { void SetupDefaultChannelProxy(bool audio_bwe_enabled) {
EXPECT_TRUE(channel_proxy_ == nullptr); EXPECT_TRUE(channel_proxy_ == nullptr);
channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>(); channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>();
EXPECT_CALL(*channel_proxy_, GetRtpRtcp(_, _)) EXPECT_CALL(*channel_proxy_, GetRtpRtcp()).WillRepeatedly(Invoke([this]() {
.WillRepeatedly(Invoke( return &this->rtp_rtcp_;
[this](RtpRtcp** rtp_rtcp_module, RtpReceiver** rtp_receiver) { }));
*rtp_rtcp_module = &this->rtp_rtcp_;
*rtp_receiver = nullptr; // Not deemed necessary for tests yet.
}));
EXPECT_CALL(*channel_proxy_, SetRTCPStatus(true)).Times(1); EXPECT_CALL(*channel_proxy_, SetRTCPStatus(true)).Times(1);
EXPECT_CALL(*channel_proxy_, SetLocalSSRC(kSsrc)).Times(1); EXPECT_CALL(*channel_proxy_, SetLocalSSRC(kSsrc)).Times(1);
EXPECT_CALL(*channel_proxy_, SetRTCP_CNAME(StrEq(kCName))).Times(1); EXPECT_CALL(*channel_proxy_, SetRTCP_CNAME(StrEq(kCName))).Times(1);

View File

@ -1342,11 +1342,24 @@ int Channel::GetPlayoutTimestamp(unsigned int& timestamp) {
return 0; return 0;
} }
int Channel::GetRtpRtcp(RtpRtcp** rtpRtcpModule, RtpRtcp* Channel::GetRtpRtcp() const {
RtpReceiver** rtp_receiver) const { return _rtpRtcpModule.get();
*rtpRtcpModule = _rtpRtcpModule.get(); }
*rtp_receiver = rtp_receiver_.get();
return 0; absl::optional<Syncable::Info> Channel::GetSyncInfo() const {
Syncable::Info info;
if (!rtp_receiver_->GetLatestTimestamps(
&info.latest_received_capture_timestamp,
&info.latest_receive_time_ms)) {
return absl::nullopt;
}
if (_rtpRtcpModule->RemoteNTP(&info.capture_time_ntp_secs,
&info.capture_time_ntp_frac, nullptr, nullptr,
&info.capture_time_source_clock) != 0) {
return absl::nullopt;
}
return info;
} }
void Channel::UpdatePlayoutTimestamp(bool rtcp) { void Channel::UpdatePlayoutTimestamp(bool rtcp) {

View File

@ -22,6 +22,7 @@
#include "api/call/audio_sink.h" #include "api/call/audio_sink.h"
#include "api/call/transport.h" #include "api/call/transport.h"
#include "audio/audio_level.h" #include "audio/audio_level.h"
#include "call/syncable.h"
#include "common_types.h" // NOLINT(build/include) #include "common_types.h" // NOLINT(build/include)
#include "modules/audio_coding/include/audio_coding_module.h" #include "modules/audio_coding/include/audio_coding_module.h"
#include "modules/audio_processing/rms_level.h" #include "modules/audio_processing/rms_level.h"
@ -209,8 +210,12 @@ class Channel
uint32_t GetDelayEstimate() const; uint32_t GetDelayEstimate() const;
int SetMinimumPlayoutDelay(int delayMs); int SetMinimumPlayoutDelay(int delayMs);
int GetPlayoutTimestamp(unsigned int& timestamp); // NOLINT int GetPlayoutTimestamp(unsigned int& timestamp); // NOLINT
int GetRtpRtcp(RtpRtcp** rtpRtcpModule, RtpReceiver** rtp_receiver) const;
// Used by AudioSendStream.
RtpRtcp* GetRtpRtcp() const;
// Produces the transport-related timestamps; current_delay_ms is left unset.
absl::optional<Syncable::Info> GetSyncInfo() const;
// DTMF. // DTMF.
int SendTelephoneEventOutband(int event, int duration_ms); int SendTelephoneEventOutband(int event, int duration_ms);
int SetSendTelephoneEventPayloadType(int payload_type, int payload_frequency); int SetSendTelephoneEventPayloadType(int payload_type, int payload_frequency);

View File

@ -265,13 +265,14 @@ void ChannelProxy::DisassociateSendChannel() {
channel_->SetAssociatedSendChannel(nullptr); channel_->SetAssociatedSendChannel(nullptr);
} }
void ChannelProxy::GetRtpRtcp(RtpRtcp** rtp_rtcp, RtpRtcp* ChannelProxy::GetRtpRtcp() const {
RtpReceiver** rtp_receiver) const {
RTC_DCHECK(module_process_thread_checker_.CalledOnValidThread()); RTC_DCHECK(module_process_thread_checker_.CalledOnValidThread());
RTC_DCHECK(rtp_rtcp); return channel_->GetRtpRtcp();
RTC_DCHECK(rtp_receiver); }
int error = channel_->GetRtpRtcp(rtp_rtcp, rtp_receiver);
RTC_DCHECK_EQ(0, error); absl::optional<Syncable::Info> ChannelProxy::GetSyncInfo() const {
RTC_DCHECK(module_process_thread_checker_.CalledOnValidThread());
return channel_->GetSyncInfo();
} }
uint32_t ChannelProxy::GetPlayoutTimestamp() const { uint32_t ChannelProxy::GetPlayoutTimestamp() const {

View File

@ -108,7 +108,10 @@ class ChannelProxy : public RtpPacketSinkInterface {
virtual void SetTransportOverhead(int transport_overhead_per_packet); virtual void SetTransportOverhead(int transport_overhead_per_packet);
virtual void AssociateSendChannel(const ChannelProxy& send_channel_proxy); virtual void AssociateSendChannel(const ChannelProxy& send_channel_proxy);
virtual void DisassociateSendChannel(); virtual void DisassociateSendChannel();
virtual void GetRtpRtcp(RtpRtcp** rtp_rtcp, RtpReceiver** rtp_receiver) const; virtual RtpRtcp* GetRtpRtcp() const;
// Produces the transport-related timestamps; current_delay_ms is left unset.
absl::optional<Syncable::Info> GetSyncInfo() const;
virtual uint32_t GetPlayoutTimestamp() const; virtual uint32_t GetPlayoutTimestamp() const;
virtual void SetMinimumPlayoutDelay(int delay_ms); virtual void SetMinimumPlayoutDelay(int delay_ms);
virtual bool GetRecCodec(CodecInst* codec_inst) const; virtual bool GetRecCodec(CodecInst* codec_inst) const;

View File

@ -83,8 +83,7 @@ class MockVoEChannelProxy : public voe::ChannelProxy {
MOCK_METHOD1(AssociateSendChannel, MOCK_METHOD1(AssociateSendChannel,
void(const ChannelProxy& send_channel_proxy)); void(const ChannelProxy& send_channel_proxy));
MOCK_METHOD0(DisassociateSendChannel, void()); MOCK_METHOD0(DisassociateSendChannel, void());
MOCK_CONST_METHOD2(GetRtpRtcp, MOCK_CONST_METHOD0(GetRtpRtcp, RtpRtcp*());
void(RtpRtcp** rtp_rtcp, RtpReceiver** rtp_receiver));
MOCK_CONST_METHOD0(GetPlayoutTimestamp, uint32_t()); MOCK_CONST_METHOD0(GetPlayoutTimestamp, uint32_t());
MOCK_METHOD1(SetMinimumPlayoutDelay, void(int delay_ms)); MOCK_METHOD1(SetMinimumPlayoutDelay, void(int delay_ms));
MOCK_CONST_METHOD1(GetRecCodec, bool(CodecInst* codec_inst)); MOCK_CONST_METHOD1(GetRecCodec, bool(CodecInst* codec_inst));