webrtc icon indicating copy to clipboard operation
webrtc copied to clipboard

Issue accessing ICECandidatePairStats

Open danjenkins opened this issue 8 months ago • 2 comments

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 avatar May 30 '24 10:05 danjenkins