Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue accessing ICECandidatePairStats #2779

Open
danjenkins opened this issue May 30, 2024 · 2 comments
Open

Issue accessing ICECandidatePairStats #2779

danjenkins opened this issue May 30, 2024 · 2 comments
Labels
bug Something isn't working difficulty:easy

Comments

@danjenkins
Copy link

Your environment.

  • Version: 4 beta 19
  • Browser: n/a

What did you do?

go and grab the candidate pair from the SCTP transport.
use that candidate pair to get stats on it

What did you expect?

an ok result and some stats

What happened?

a non ok response and no stats

when you print out what c.statsID is from a candidate pair gathered from pc.SCTP().Transport().ICETransport().GetSelectedCandidatePair() you get no statsID

using this blank statsID results in obviously no data retrieved from the stats report.

However... even if I go and remake the candidate pair stats ID I still get no results...

func (r StatsReport) GetICECandidatePairStats(c *ICECandidatePair) (ICECandidatePairStats, bool) {
	//statsID := c.statsID

	statsID := newICECandidatePairStatsID(c.Local.statsID, c.Remote.statsID)

	fmt.Printf("A-B: %+v\n", statsID)

	stats, ok := r[statsID]
	if !ok {
		fmt.Printf("Stats ID doesnt exist in Stats\n")

		return ICECandidatePairStats{}, false
	}

	candidateStats, ok := stats.(ICECandidatePairStats)
	if !ok {
		return ICECandidatePairStats{}, false
	}
	return candidateStats, true
}

Something isn't right... I know its in the StatsReport

StatsID was created candidate:lVBDYOJqfkVwKbIM/L5ecWIjLzWJ0Fvv-candidate:JbxBaOLbcbgaqbkIV7O/MUFkN54kCH/f

INFO[0002] Offerer Stats                           statsKey="candidate:lVBDYOJqfkVwKbIM/L5ecWIjLzWJ0Fvv-candidate:JbxBaOLbcbgaqbkIV7O/MUFkN54kCH/f" statsValue="{1.717063734593e+12 candidate-pair candidate:lVBDYOJqfkVwKbIM/L5ecWIjLzWJ0Fvv-candidate:JbxBaOLbcbgaqbkIV7O/MUFkN54kCH/f  candidate:lVBDYOJqfkVwKbIM/L5ecWIjLzWJ0Fvv candidate:JbxBaOLbcbgaqbkIV7O/MUFkN54kCH/f succeeded true 0 0 0 0 -6.795364578871e+12 -6.795364578871e+12 -6.795364578871e+12 -6.795364578871e+12 -6.795364578871e+12 0 0 0 0 0 0 0 0 0 0 0 0 -6.795364578871e+12}"

Other than adding some debugging to stats_go.go I haven't gone much further with this yet.

theres two issues here.... the statsID in a candidatePair doesn't seem to get stored properly.
When you do have a statsID you still can't retrieve the stat

@danjenkins
Copy link
Author

Looking into this a bit more...

If I go get the stats and loop through them...

stats := pc.GetStats()

	for _, report := range stats {
		if candidatePairStats, ok := report.(webrtc.ICECandidatePairStats); ok {
			// Check if this candidate pair is the selected one
			// if candidatePairStats.Nominated {
			fmt.Printf("Candidate Pair %+v\n", candidatePairStats)
			//			}
		}
	}

I end up with stats that don't change... and have no BytesSent/Received etc.

Candidate Pair {Timestamp:1.723193118292e+12 Type:candidate-pair ID:candidate:8P1w36kyIljTeMqueMkM6hdTTDTDdAl8-candidate:utpvQgEY0b4+QBQIb+mLNYNNCHDK1aV6 TransportID: LocalCandidateID:candidate:8P1w36kyIljTeMqueMkM6hdTTDTDdAl8 RemoteCandidateID:candidate:utpvQgEY0b4+QBQIb+mLNYNNCHDK1aV6 State:succeeded Nominated:true PacketsSent:0 PacketsReceived:0 BytesSent:0 BytesReceived:0 LastPacketSentTimestamp:-6.795364578871e+12 LastPacketReceivedTimestamp:-6.795364578871e+12 FirstRequestTimestamp:-6.795364578871e+12 LastRequestTimestamp:-6.795364578871e+12 LastResponseTimestamp:-6.795364578871e+12 TotalRoundTripTime:0 CurrentRoundTripTime:0 AvailableOutgoingBitrate:0 AvailableIncomingBitrate:0 CircuitBreakerTriggerCount:0 RequestsReceived:0 RequestsSent:0 ResponsesReceived:0 ResponsesSent:0 RetransmissionsReceived:0 RetransmissionsSent:0 ConsentRequestsSent:0 ConsentExpiredTimestamp:-6.795364578871e+12}

Are CandidatePairStats even implemented properly?

@danjenkins
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working difficulty:easy
Development

No branches or pull requests

2 participants