Remove default "unknown" encoderImplementation/decoderImplementation

which means this will not show up in getStats inbound-rtp/outbound-rtp
until the encoder/decoder is known. This has implications in particular
for inbound-rtp where the value is currently "unknown" until video
frames have been received.

This is safe to change as the previous change to gate
decoderImplementation behind getUserMedia access already broke
the assumption that the field is always string.

BUG=webrtc:14906

Change-Id: Ie6040ada3656e80f792c0c32c1b86ad1d6609d3c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/293600
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#40334}
This commit is contained in:
Philipp Hancke 2023-06-22 11:41:35 +02:00 committed by WebRTC LUCI CQ
parent 423faa6067
commit 656817c485
8 changed files with 16 additions and 15 deletions

View File

@ -88,7 +88,7 @@ class VideoReceiveStreamInterface : public MediaReceiveStreamInterface {
uint32_t frames_rendered = 0;
// Decoder stats.
std::string decoder_implementation_name = "unknown";
absl::optional<std::string> decoder_implementation_name;
absl::optional<bool> power_efficient_decoder;
FrameCounts frame_counts;
int decode_ms = 0;

View File

@ -101,7 +101,7 @@ class VideoSendStream {
Stats();
~Stats();
std::string ToString(int64_t time_ms) const;
std::string encoder_implementation_name = "unknown";
absl::optional<std::string> encoder_implementation_name;
double input_frame_rate = 0;
int encode_frame_rate = 0;
int avg_encode_time_ms = 0;

View File

@ -559,7 +559,7 @@ struct VideoSenderInfo : public MediaSenderInfo {
VideoSenderInfo();
~VideoSenderInfo();
std::vector<SsrcGroup> ssrc_groups;
std::string encoder_implementation_name;
absl::optional<std::string> encoder_implementation_name;
int firs_received = 0;
int plis_received = 0;
int send_frame_width = 0;
@ -603,7 +603,7 @@ struct VideoReceiverInfo : public MediaReceiverInfo {
VideoReceiverInfo();
~VideoReceiverInfo();
std::vector<SsrcGroup> ssrc_groups;
std::string decoder_implementation_name;
absl::optional<std::string> decoder_implementation_name;
absl::optional<bool> power_efficient_decoder;
int packets_concealed = 0;
int firs_sent = 0;

View File

@ -301,7 +301,7 @@ void ExtractStats(const cricket::VideoReceiverInfo& info,
bool use_standard_bytes_stats) {
ExtractCommonReceiveProperties(info, report);
report->AddString(StatsReport::kStatsValueNameCodecImplementationName,
info.decoder_implementation_name);
info.decoder_implementation_name.value_or("unknown"));
int64_t bytes_received = info.payload_bytes_received;
if (!use_standard_bytes_stats) {
bytes_received += info.header_and_padding_bytes_received;
@ -366,7 +366,7 @@ void ExtractStats(const cricket::VideoSenderInfo& info,
ExtractCommonSendProperties(info, report, use_standard_bytes_stats);
report->AddString(StatsReport::kStatsValueNameCodecImplementationName,
info.encoder_implementation_name);
info.encoder_implementation_name.value_or("unknown"));
report->AddBoolean(StatsReport::kStatsValueNameBandwidthLimitedResolution,
(info.adapt_reason & 0x2) > 0);
report->AddBoolean(StatsReport::kStatsValueNameCpuLimitedResolution,

View File

@ -669,9 +669,9 @@ CreateInboundRTPStreamStatsFromVideoReceiverInfo(
// support the "unspecified" value.
if (video_receiver_info.content_type == VideoContentType::SCREENSHARE)
inbound_video->content_type = "screenshare";
if (!video_receiver_info.decoder_implementation_name.empty()) {
if (video_receiver_info.decoder_implementation_name.has_value()) {
inbound_video->decoder_implementation =
video_receiver_info.decoder_implementation_name;
*video_receiver_info.decoder_implementation_name;
}
if (video_receiver_info.power_efficient_decoder.has_value()) {
inbound_video->power_efficient_decoder =
@ -811,9 +811,9 @@ CreateOutboundRTPStreamStatsFromVideoSenderInfo(
// optional, support the "unspecified" value.
if (video_sender_info.content_type == VideoContentType::SCREENSHARE)
outbound_video->content_type = "screenshare";
if (!video_sender_info.encoder_implementation_name.empty()) {
if (video_sender_info.encoder_implementation_name.has_value()) {
outbound_video->encoder_implementation =
video_sender_info.encoder_implementation_name;
*video_sender_info.encoder_implementation_name;
}
if (video_sender_info.rid.has_value()) {
outbound_video->rid = *video_sender_info.rid;

View File

@ -2361,7 +2361,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCInboundRtpStreamStats_Video) {
video_media_info.receivers[0].content_type = VideoContentType::UNSPECIFIED;
video_media_info.receivers[0].estimated_playout_ntp_timestamp_ms =
absl::nullopt;
video_media_info.receivers[0].decoder_implementation_name = "";
video_media_info.receivers[0].decoder_implementation_name = absl::nullopt;
video_media_info.receivers[0].min_playout_delay_ms = 50;
video_media_info.receivers[0].power_efficient_decoder = false;
video_media_info.receivers[0].retransmitted_packets_received = 17;
@ -2620,7 +2620,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRtpStreamStats_Video) {
video_media_info.senders[0].quality_limitation_resolution_changes = 56u;
video_media_info.senders[0].qp_sum = absl::nullopt;
video_media_info.senders[0].content_type = VideoContentType::UNSPECIFIED;
video_media_info.senders[0].encoder_implementation_name = "";
video_media_info.senders[0].encoder_implementation_name = absl::nullopt;
video_media_info.senders[0].power_efficient_encoder = false;
video_media_info.senders[0].send_frame_width = 200;
video_media_info.senders[0].send_frame_height = 100;

View File

@ -524,7 +524,7 @@ TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsIncomingPayloadType) {
TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsDecoderInfo) {
auto init_stats = statistics_proxy_->GetStats();
EXPECT_EQ(init_stats.decoder_implementation_name, "unknown");
EXPECT_EQ(init_stats.decoder_implementation_name, absl::nullopt);
EXPECT_EQ(init_stats.power_efficient_decoder, absl::nullopt);
const VideoDecoder::DecoderInfo decoder_info{

View File

@ -1054,8 +1054,9 @@ void SendStatisticsProxy::OnSendEncodedImage(
void SendStatisticsProxy::OnEncoderImplementationChanged(
EncoderImplementation implementation) {
MutexLock lock(&mutex_);
encoder_changed_ = EncoderChangeEvent{stats_.encoder_implementation_name,
implementation.name};
encoder_changed_ =
EncoderChangeEvent{stats_.encoder_implementation_name.value_or("unknown"),
implementation.name};
stats_.encoder_implementation_name = implementation.name;
stats_.power_efficient_encoder = implementation.is_hardware_accelerated;
}