@@ -101,21 +101,6 @@ RTCOutboundRTPStreamStatsWrap cast_to_rtc_outbound_rtp_stream_stats(
101101 track_id->set_value (rust::String (*cast->remote_id ));
102102 }
103103
104- auto frame_width = init_option_u32 ();
105- if (cast->frame_width .has_value ()) {
106- frame_width->set_value (*cast->frame_width );
107- }
108-
109- auto frame_height = init_option_u32 ();
110- if (cast->frame_width .has_value ()) {
111- frame_width->set_value (*cast->frame_width );
112- }
113-
114- auto frames_per_second = init_option_f64 ();
115- if (cast->frames_per_second .has_value ()) {
116- frames_per_second->set_value (*cast->frames_per_second );
117- }
118-
119104 auto bytes_sent = init_option_u64 ();
120105 if (cast->bytes_sent .has_value ()) {
121106 bytes_sent->set_value (*cast->bytes_sent );
@@ -131,7 +116,27 @@ RTCOutboundRTPStreamStatsWrap cast_to_rtc_outbound_rtp_stream_stats(
131116 media_source_id->set_value (rust::String (*cast->media_source_id ));
132117 }
133118
134- MediaKind kind = MediaKind::Video;
119+ auto frame_width = init_option_u32 ();
120+ auto frame_height = init_option_u32 ();
121+ auto frames_per_second = init_option_f64 ();
122+ MediaKind kind;
123+ if (*cast->kind == " audio" ) {
124+ kind = MediaKind::Audio;
125+ } else {
126+ kind = MediaKind::Video;
127+
128+ if (cast->frame_width .has_value ()) {
129+ frame_width->set_value (*cast->frame_width );
130+ }
131+
132+ if (cast->frame_height .has_value ()) {
133+ frame_height->set_value (*cast->frame_height );
134+ }
135+
136+ if (cast->frames_per_second .has_value ()) {
137+ frames_per_second->set_value (*cast->frames_per_second );
138+ }
139+ }
135140
136141 return RTCOutboundRTPStreamStatsWrap{
137142 std::move (track_id), kind,
@@ -246,22 +251,22 @@ RTCInboundRTPStreamStatsWrap cast_to_rtc_inbound_rtp_stream_stats(
246251 if (cast->frames_received .has_value ()) {
247252 frames_received->set_value (*cast->frames_received );
248253 }
254+ }
249255
250- if (cast->bytes_received .has_value ()) {
251- bytes_received->set_value (*cast->bytes_received );
252- }
256+ if (cast->bytes_received .has_value ()) {
257+ bytes_received->set_value (*cast->bytes_received );
258+ }
253259
254- if (cast->packets_received .has_value ()) {
255- packets_received->set_value (*cast->packets_received );
256- }
260+ if (cast->packets_received .has_value ()) {
261+ packets_received->set_value (*cast->packets_received );
262+ }
257263
258- if (cast->total_decode_time .has_value ()) {
259- total_decode_time->set_value (*cast->total_decode_time );
260- }
261- if (cast->jitter_buffer_emitted_count .has_value ()) {
262- jitter_buffer_emitted_count->set_value (
263- *cast->jitter_buffer_emitted_count );
264- }
264+ if (cast->total_decode_time .has_value ()) {
265+ total_decode_time->set_value (*cast->total_decode_time );
266+ }
267+ if (cast->jitter_buffer_emitted_count .has_value ()) {
268+ jitter_buffer_emitted_count->set_value (
269+ *cast->jitter_buffer_emitted_count );
265270 }
266271
267272 return RTCInboundRTPStreamStatsWrap{
0 commit comments