@@ -35,6 +35,7 @@ void StatsObserverRffi::OnStatsDelivered(
3535 this ->video_sender_statistics_ .clear ();
3636 this ->audio_receiver_statistics_ .clear ();
3737 this ->video_receiver_statistics_ .clear ();
38+ this ->connection_statistics_ .clear ();
3839
3940 auto outbound_stream_stats =
4041 report->GetStatsOfType <RTCOutboundRtpStreamStats>();
@@ -142,6 +143,10 @@ void StatsObserverRffi::OnStatsDelivered(
142143 stat->jitter_buffer_delay .value_or (0.0 );
143144 audio_receiver.jitter_buffer_emitted_count =
144145 stat->jitter_buffer_emitted_count .value_or (0 );
146+ audio_receiver.jitter_buffer_flushes =
147+ stat->jitter_buffer_flushes .value_or (0 );
148+ audio_receiver.estimated_playout_timestamp =
149+ stat->estimated_playout_timestamp .value_or (0.0 );
145150
146151 this ->audio_receiver_statistics_ .push_back (audio_receiver);
147152 } else if (*stat->kind == " video" &&
@@ -153,31 +158,53 @@ void StatsObserverRffi::OnStatsDelivered(
153158 video_receiver.packets_received = stat->packets_received .value_or (0 );
154159 video_receiver.packets_lost = stat->packets_lost .value_or (0 );
155160 video_receiver.bytes_received = stat->bytes_received .value_or (0 );
161+ video_receiver.frames_received = stat->frames_received .value_or (0 );
156162 video_receiver.frames_decoded = stat->frames_decoded .value_or (0 );
157163 video_receiver.key_frames_decoded = stat->key_frames_decoded .value_or (0 );
158164 video_receiver.total_decode_time = stat->total_decode_time .value_or (0.0 );
159165 video_receiver.frame_width = stat->frame_width .value_or (0 );
160166 video_receiver.frame_height = stat->frame_height .value_or (0 );
167+ video_receiver.jitter = stat->jitter .value_or (0.0 );
168+ video_receiver.jitter_buffer_delay =
169+ stat->jitter_buffer_delay .value_or (0.0 );
170+ video_receiver.jitter_buffer_emitted_count =
171+ stat->jitter_buffer_emitted_count .value_or (0 );
172+ video_receiver.jitter_buffer_flushes =
173+ stat->jitter_buffer_flushes .value_or (0 );
174+ video_receiver.freeze_count = stat->freeze_count .value_or (0 );
175+ video_receiver.total_freezes_duration =
176+ stat->total_freezes_duration .value_or (0.0 );
177+ video_receiver.estimated_playout_timestamp =
178+ stat->estimated_playout_timestamp .value_or (0.0 );
161179
162180 this ->video_receiver_statistics_ .push_back (video_receiver);
163181 }
164182 }
165183
166- ConnectionStatistics connection_statistics = {0 };
184+ ConnectionStatistics nominated_connection_statistics = {0 };
167185 uint64_t highest_priority = 0 ;
168-
169186 for (const auto & stat : candidate_pair_stats) {
187+ ConnectionStatistics connection_stats = {0 };
188+ connection_stats.raw_candidate_pair_id = stat->id ().c_str ();
189+ connection_stats.current_round_trip_time =
190+ stat->current_round_trip_time .value_or (0.0 );
191+ connection_stats.available_outgoing_bitrate =
192+ stat->available_outgoing_bitrate .value_or (0.0 );
193+ connection_stats.requests_sent = stat->requests_sent .value_or (0 );
194+ connection_stats.responses_received = stat->responses_received .value_or (0 );
195+ connection_stats.requests_received = stat->requests_received .value_or (0 );
196+ connection_stats.responses_sent = stat->responses_sent .value_or (0 );
197+
170198 // We'll only look at the pair that is nominated with the highest priority,
171199 // usually that has useful values (there does not seem to be a 'in_use' type
172200 // of flag).
173201 uint64_t current_priority = stat->priority .value_or (0 );
174202 if (*stat->nominated && stat->priority .value_or (0 ) > highest_priority) {
175203 highest_priority = current_priority;
176- connection_statistics.current_round_trip_time =
177- stat->current_round_trip_time .value_or (0.0 );
178- connection_statistics.available_outgoing_bitrate =
179- stat->available_outgoing_bitrate .value_or (0.0 );
204+ nominated_connection_statistics = connection_stats;
180205 }
206+
207+ this ->connection_statistics_ .push_back (connection_stats);
181208 }
182209
183210 MediaStatistics media_statistics;
@@ -194,11 +221,15 @@ void StatsObserverRffi::OnStatsDelivered(
194221 this ->audio_receiver_statistics_ .size ();
195222 media_statistics.audio_receiver_statistics =
196223 this ->audio_receiver_statistics_ .data ();
197- media_statistics.video_receiver_statistics_count =
224+ media_statistics.video_receiver_statistics_size =
198225 this ->video_receiver_statistics_ .size ();
199226 media_statistics.video_receiver_statistics =
200227 this ->video_receiver_statistics_ .data ();
201- media_statistics.connection_statistics = connection_statistics;
228+ media_statistics.nominated_connection_statistics =
229+ nominated_connection_statistics;
230+ media_statistics.connection_statistics_size =
231+ this ->connection_statistics_ .size ();
232+ media_statistics.connection_statistics = this ->connection_statistics_ .data ();
202233
203234 std::string report_json =
204235 this ->collect_raw_stats_report_ .load () ? report->ToJson () : " " ;
0 commit comments