Skip to content

Commit

Permalink
Use track id in get_stats (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
roznawsk authored Dec 3, 2024
1 parent 3fc9cd0 commit abcf8d3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/ex_webrtc/rtp_receiver.ex
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ defmodule ExWebRTC.RTPReceiver do

%{
id: id,
track_identifier: id,
rid: rid,
codec: codec,
type: :inbound_rtp,
Expand Down
1 change: 1 addition & 0 deletions lib/ex_webrtc/rtp_sender.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions test/ex_webrtc/rtp_receiver_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions test/ex_webrtc/rtp_sender_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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),
Expand All @@ -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),
Expand Down

0 comments on commit abcf8d3

Please sign in to comment.