Let StreamStatistician::GetReceiveStreamDataCounters return counters by value
Tbr: ossu@webrtc.org # Trivial update of audio/ call site Bug: None Change-Id: I3763e83f6c0e18be1b696dd7b2ba5841045c9159 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/148820 Reviewed-by: Niels Moller <nisse@webrtc.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#28830}
This commit is contained in:
@ -306,10 +306,10 @@ absl::optional<int> StreamStatisticianImpl::GetFractionLostInPercent() const {
|
||||
return 100 * static_cast<int64_t>(cumulative_loss_) / expected_packets;
|
||||
}
|
||||
|
||||
void StreamStatisticianImpl::GetReceiveStreamDataCounters(
|
||||
StreamDataCounters* data_counters) const {
|
||||
StreamDataCounters StreamStatisticianImpl::GetReceiveStreamDataCounters()
|
||||
const {
|
||||
rtc::CritScope cs(&stream_lock_);
|
||||
*data_counters = receive_counters_;
|
||||
return receive_counters_;
|
||||
}
|
||||
|
||||
uint32_t StreamStatisticianImpl::BitrateReceived() const {
|
||||
|
||||
@ -39,8 +39,7 @@ class StreamStatisticianImpl : public StreamStatistician,
|
||||
void GetDataCounters(size_t* bytes_received,
|
||||
uint32_t* packets_received) const override;
|
||||
absl::optional<int> GetFractionLostInPercent() const override;
|
||||
void GetReceiveStreamDataCounters(
|
||||
StreamDataCounters* data_counters) const override;
|
||||
StreamDataCounters GetReceiveStreamDataCounters() const override;
|
||||
uint32_t BitrateReceived() const override;
|
||||
|
||||
// Implements RtpPacketSinkInterface
|
||||
|
||||
@ -217,13 +217,12 @@ TEST_F(ReceiveStatisticsTest, GetReceiveStreamDataCounters) {
|
||||
receive_statistics_->GetStatistician(kSsrc1);
|
||||
ASSERT_TRUE(statistician != NULL);
|
||||
|
||||
StreamDataCounters counters;
|
||||
statistician->GetReceiveStreamDataCounters(&counters);
|
||||
StreamDataCounters counters = statistician->GetReceiveStreamDataCounters();
|
||||
EXPECT_GT(counters.first_packet_time_ms, -1);
|
||||
EXPECT_EQ(1u, counters.transmitted.packets);
|
||||
|
||||
receive_statistics_->OnRtpPacket(packet1_);
|
||||
statistician->GetReceiveStreamDataCounters(&counters);
|
||||
counters = statistician->GetReceiveStreamDataCounters();
|
||||
EXPECT_GT(counters.first_packet_time_ms, -1);
|
||||
EXPECT_EQ(2u, counters.transmitted.packets);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user