Report histograms in dtor of UlpfecReceiver.

The data that's used to report the histograms is owned by UlpfecReceiver
and moving the reporting there, simplifies things as configuration
changes happen in RtpVideoStreamReceiver2 (which currently require all
receive streams to be deleted+reconstructed).

Additional updates:
* Consistently using `Clock` for timestamps. Before there was
  a mix of Clock and rtc::TimeMillis.
* Update code to use Timestamp and TimeDelta.

Bug: none
Change-Id: I89ca28ec7067a49d6b357315ae733b04e7c5a2e3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/271027
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37729}
This commit is contained in:
Tommi
2022-08-10 07:45:43 +02:00
committed by WebRTC LUCI CQ
parent 39c90e08f9
commit 7fbab87b60
6 changed files with 73 additions and 57 deletions

View File

@ -23,6 +23,7 @@
#include "modules/rtp_rtcp/source/forward_error_correction.h"
#include "modules/rtp_rtcp/source/rtp_packet_received.h"
#include "rtc_base/system/no_unique_address.h"
#include "system_wrappers/include/clock.h"
namespace webrtc {
@ -33,18 +34,22 @@ struct FecPacketCounter {
size_t num_fec_packets = 0; // Number of received FEC packets.
size_t num_recovered_packets =
0; // Number of recovered media packets using FEC.
int64_t first_packet_time_ms = -1; // Time when first packet is received.
// Time when first packet is received.
Timestamp first_packet_time = Timestamp::MinusInfinity();
};
class UlpfecReceiver {
public:
UlpfecReceiver(uint32_t ssrc,
int ulpfec_payload_type,
RecoveredPacketReceiver* callback,
rtc::ArrayView<const RtpExtension> extensions);
rtc::ArrayView<const RtpExtension> extensions,
Clock* clock);
~UlpfecReceiver();
bool AddReceivedRedPacket(const RtpPacketReceived& rtp_packet,
uint8_t ulpfec_payload_type);
int ulpfec_payload_type() const { return ulpfec_payload_type_; }
bool AddReceivedRedPacket(const RtpPacketReceived& rtp_packet);
void ProcessReceivedFec();
@ -54,6 +59,8 @@ class UlpfecReceiver {
private:
const uint32_t ssrc_;
const int ulpfec_payload_type_;
Clock* const clock_;
RtpHeaderExtensionMap extensions_ RTC_GUARDED_BY(&sequence_checker_);
RTC_NO_UNIQUE_ADDRESS SequenceChecker sequence_checker_;