diff --git a/call/video_receive_stream.h b/call/video_receive_stream.h index 48a1ad0758..12f6bf60c8 100644 --- a/call/video_receive_stream.h +++ b/call/video_receive_stream.h @@ -88,7 +88,7 @@ class VideoReceiveStreamInterface : public MediaReceiveStreamInterface { uint32_t frames_rendered = 0; // Decoder stats. - std::string decoder_implementation_name = "unknown"; + absl::optional decoder_implementation_name; absl::optional power_efficient_decoder; FrameCounts frame_counts; int decode_ms = 0; diff --git a/call/video_send_stream.h b/call/video_send_stream.h index 431c267e1e..5fde44a719 100644 --- a/call/video_send_stream.h +++ b/call/video_send_stream.h @@ -101,7 +101,7 @@ class VideoSendStream { Stats(); ~Stats(); std::string ToString(int64_t time_ms) const; - std::string encoder_implementation_name = "unknown"; + absl::optional encoder_implementation_name; double input_frame_rate = 0; int encode_frame_rate = 0; int avg_encode_time_ms = 0; diff --git a/media/base/media_channel.h b/media/base/media_channel.h index dee53bb5ca..3fd37b34aa 100644 --- a/media/base/media_channel.h +++ b/media/base/media_channel.h @@ -559,7 +559,7 @@ struct VideoSenderInfo : public MediaSenderInfo { VideoSenderInfo(); ~VideoSenderInfo(); std::vector ssrc_groups; - std::string encoder_implementation_name; + absl::optional 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 ssrc_groups; - std::string decoder_implementation_name; + absl::optional decoder_implementation_name; absl::optional power_efficient_decoder; int packets_concealed = 0; int firs_sent = 0; diff --git a/pc/legacy_stats_collector.cc b/pc/legacy_stats_collector.cc index 6533fc3068..3bc65ee3ee 100644 --- a/pc/legacy_stats_collector.cc +++ b/pc/legacy_stats_collector.cc @@ -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, diff --git a/pc/rtc_stats_collector.cc b/pc/rtc_stats_collector.cc index f717d9da18..334c76f6d4 100644 --- a/pc/rtc_stats_collector.cc +++ b/pc/rtc_stats_collector.cc @@ -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; diff --git a/pc/rtc_stats_collector_unittest.cc b/pc/rtc_stats_collector_unittest.cc index bbc6d10ef1..8781b323d6 100644 --- a/pc/rtc_stats_collector_unittest.cc +++ b/pc/rtc_stats_collector_unittest.cc @@ -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; diff --git a/video/receive_statistics_proxy_unittest.cc b/video/receive_statistics_proxy_unittest.cc index ec6dd0c420..c989115af5 100644 --- a/video/receive_statistics_proxy_unittest.cc +++ b/video/receive_statistics_proxy_unittest.cc @@ -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{ diff --git a/video/send_statistics_proxy.cc b/video/send_statistics_proxy.cc index fd576bb38b..8605771cd3 100644 --- a/video/send_statistics_proxy.cc +++ b/video/send_statistics_proxy.cc @@ -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; }