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:
@ -257,26 +257,12 @@ int AudioReceiveStream::id() const {
|
||||
|
||||
absl::optional<Syncable::Info> AudioReceiveStream::GetInfo() const {
|
||||
RTC_DCHECK_RUN_ON(&module_process_thread_checker_);
|
||||
Syncable::Info info;
|
||||
absl::optional<Syncable::Info> info = channel_proxy_->GetSyncInfo();
|
||||
|
||||
RtpRtcp* rtp_rtcp = nullptr;
|
||||
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)) {
|
||||
if (!info)
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@ -141,8 +141,7 @@ AudioSendStream::AudioSendStream(
|
||||
|
||||
channel_proxy_->SetRtcEventLog(event_log_);
|
||||
channel_proxy_->SetRTCPStatus(true);
|
||||
RtpReceiver* rtpReceiver = nullptr; // Unused, but required for call.
|
||||
channel_proxy_->GetRtpRtcp(&rtp_rtcp_module_, &rtpReceiver);
|
||||
rtp_rtcp_module_ = channel_proxy_->GetRtpRtcp();
|
||||
RTC_DCHECK(rtp_rtcp_module_);
|
||||
|
||||
ConfigureStream(this, config, true);
|
||||
|
||||
@ -189,12 +189,9 @@ struct ConfigHelper {
|
||||
void SetupDefaultChannelProxy(bool audio_bwe_enabled) {
|
||||
EXPECT_TRUE(channel_proxy_ == nullptr);
|
||||
channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>();
|
||||
EXPECT_CALL(*channel_proxy_, GetRtpRtcp(_, _))
|
||||
.WillRepeatedly(Invoke(
|
||||
[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_, GetRtpRtcp()).WillRepeatedly(Invoke([this]() {
|
||||
return &this->rtp_rtcp_;
|
||||
}));
|
||||
EXPECT_CALL(*channel_proxy_, SetRTCPStatus(true)).Times(1);
|
||||
EXPECT_CALL(*channel_proxy_, SetLocalSSRC(kSsrc)).Times(1);
|
||||
EXPECT_CALL(*channel_proxy_, SetRTCP_CNAME(StrEq(kCName))).Times(1);
|
||||
|
||||
@ -1342,11 +1342,24 @@ int Channel::GetPlayoutTimestamp(unsigned int& timestamp) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Channel::GetRtpRtcp(RtpRtcp** rtpRtcpModule,
|
||||
RtpReceiver** rtp_receiver) const {
|
||||
*rtpRtcpModule = _rtpRtcpModule.get();
|
||||
*rtp_receiver = rtp_receiver_.get();
|
||||
return 0;
|
||||
RtpRtcp* Channel::GetRtpRtcp() const {
|
||||
return _rtpRtcpModule.get();
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
#include "api/call/audio_sink.h"
|
||||
#include "api/call/transport.h"
|
||||
#include "audio/audio_level.h"
|
||||
#include "call/syncable.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "modules/audio_coding/include/audio_coding_module.h"
|
||||
#include "modules/audio_processing/rms_level.h"
|
||||
@ -209,8 +210,12 @@ class Channel
|
||||
uint32_t GetDelayEstimate() const;
|
||||
int SetMinimumPlayoutDelay(int delayMs);
|
||||
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.
|
||||
int SendTelephoneEventOutband(int event, int duration_ms);
|
||||
int SetSendTelephoneEventPayloadType(int payload_type, int payload_frequency);
|
||||
|
||||
@ -265,13 +265,14 @@ void ChannelProxy::DisassociateSendChannel() {
|
||||
channel_->SetAssociatedSendChannel(nullptr);
|
||||
}
|
||||
|
||||
void ChannelProxy::GetRtpRtcp(RtpRtcp** rtp_rtcp,
|
||||
RtpReceiver** rtp_receiver) const {
|
||||
RtpRtcp* ChannelProxy::GetRtpRtcp() const {
|
||||
RTC_DCHECK(module_process_thread_checker_.CalledOnValidThread());
|
||||
RTC_DCHECK(rtp_rtcp);
|
||||
RTC_DCHECK(rtp_receiver);
|
||||
int error = channel_->GetRtpRtcp(rtp_rtcp, rtp_receiver);
|
||||
RTC_DCHECK_EQ(0, error);
|
||||
return channel_->GetRtpRtcp();
|
||||
}
|
||||
|
||||
absl::optional<Syncable::Info> ChannelProxy::GetSyncInfo() const {
|
||||
RTC_DCHECK(module_process_thread_checker_.CalledOnValidThread());
|
||||
return channel_->GetSyncInfo();
|
||||
}
|
||||
|
||||
uint32_t ChannelProxy::GetPlayoutTimestamp() const {
|
||||
|
||||
@ -108,7 +108,10 @@ class ChannelProxy : public RtpPacketSinkInterface {
|
||||
virtual void SetTransportOverhead(int transport_overhead_per_packet);
|
||||
virtual void AssociateSendChannel(const ChannelProxy& send_channel_proxy);
|
||||
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 void SetMinimumPlayoutDelay(int delay_ms);
|
||||
virtual bool GetRecCodec(CodecInst* codec_inst) const;
|
||||
|
||||
@ -83,8 +83,7 @@ class MockVoEChannelProxy : public voe::ChannelProxy {
|
||||
MOCK_METHOD1(AssociateSendChannel,
|
||||
void(const ChannelProxy& send_channel_proxy));
|
||||
MOCK_METHOD0(DisassociateSendChannel, void());
|
||||
MOCK_CONST_METHOD2(GetRtpRtcp,
|
||||
void(RtpRtcp** rtp_rtcp, RtpReceiver** rtp_receiver));
|
||||
MOCK_CONST_METHOD0(GetRtpRtcp, RtpRtcp*());
|
||||
MOCK_CONST_METHOD0(GetPlayoutTimestamp, uint32_t());
|
||||
MOCK_METHOD1(SetMinimumPlayoutDelay, void(int delay_ms));
|
||||
MOCK_CONST_METHOD1(GetRecCodec, bool(CodecInst* codec_inst));
|
||||
|
||||
Reference in New Issue
Block a user