From abcf8d38438f4e256c4f5707300d781fdbbb1bf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Ro=C5=BCnawski?= <48837433+roznawsk@users.noreply.github.com> Date: Tue, 3 Dec 2024 17:36:31 +0100 Subject: [PATCH] Use track id in get_stats (#176) --- lib/ex_webrtc/rtp_receiver.ex | 1 + lib/ex_webrtc/rtp_sender.ex | 1 + test/ex_webrtc/rtp_receiver_test.exs | 2 ++ test/ex_webrtc/rtp_sender_test.exs | 3 +++ 4 files changed, 7 insertions(+) diff --git a/lib/ex_webrtc/rtp_receiver.ex b/lib/ex_webrtc/rtp_receiver.ex index 6ce9be0..57b7264 100644 --- a/lib/ex_webrtc/rtp_receiver.ex +++ b/lib/ex_webrtc/rtp_receiver.ex @@ -262,6 +262,7 @@ defmodule ExWebRTC.RTPReceiver do %{ id: id, + track_identifier: id, rid: rid, codec: codec, type: :inbound_rtp, diff --git a/lib/ex_webrtc/rtp_sender.ex b/lib/ex_webrtc/rtp_sender.ex index 04779df..a4d1c1c 100644 --- a/lib/ex_webrtc/rtp_sender.ex +++ b/lib/ex_webrtc/rtp_sender.ex @@ -226,6 +226,7 @@ defmodule ExWebRTC.RTPSender do timestamp: timestamp, type: :outbound_rtp, id: sender.id, + track_identifier: if sender.track, do: sender.track.id, ssrc: sender.ssrc, packets_sent: sender.packets_sent, bytes_sent: sender.bytes_sent, diff --git a/test/ex_webrtc/rtp_receiver_test.exs b/test/ex_webrtc/rtp_receiver_test.exs index d1ac282..185f5d4 100644 --- a/test/ex_webrtc/rtp_receiver_test.exs +++ b/test/ex_webrtc/rtp_receiver_test.exs @@ -22,6 +22,7 @@ defmodule ExWebRTC.RTPReceiverTest do assert [ %{ id: receiver.track.id, + track_identifier: receiver.track.id, rid: nil, type: :inbound_rtp, timestamp: timestamp, @@ -42,6 +43,7 @@ defmodule ExWebRTC.RTPReceiverTest do assert [ %{ id: receiver.track.id, + track_identifier: receiver.track.id, rid: nil, type: :inbound_rtp, timestamp: timestamp, diff --git a/test/ex_webrtc/rtp_sender_test.exs b/test/ex_webrtc/rtp_sender_test.exs index c56dcd6..b6eae87 100644 --- a/test/ex_webrtc/rtp_sender_test.exs +++ b/test/ex_webrtc/rtp_sender_test.exs @@ -61,6 +61,7 @@ defmodule ExWebRTC.RTPSenderTest do timestamp: timestamp, type: :outbound_rtp, id: sender.id, + track_identifier: sender.track.id, ssrc: sender.ssrc, packets_sent: 0, bytes_sent: 0, @@ -78,6 +79,7 @@ defmodule ExWebRTC.RTPSenderTest do timestamp: timestamp, type: :outbound_rtp, id: sender.id, + track_identifier: sender.track.id, ssrc: sender.ssrc, packets_sent: 1, bytes_sent: byte_size(data1), @@ -95,6 +97,7 @@ defmodule ExWebRTC.RTPSenderTest do timestamp: timestamp, type: :outbound_rtp, id: sender.id, + track_identifier: sender.track.id, ssrc: sender.ssrc, packets_sent: 2, bytes_sent: byte_size(data1) + byte_size(data2),