Closed Bug 1071026 Opened 11 years ago Closed 11 years ago

Expose codecs used in a session via TB library for Loop Mobile Client

Categories

(Firefox OS Graveyard :: Gaia::Loop, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1065161

People

(Reporter: oteo, Unassigned)

References

Details

This is required in order to send telemetry reports about the codecs used in every session. We are already working on obtaining this metric in Gecko in bug 1065161, but it would be better that Tokbox could handle it. See also bug 1065161 for tracking this measurement in Desktop.
Blocks: 1071007
See Also: → 1065161
To find the codec for a webrtc call: 1) Take the answer.sdp 2) search for m=video 3) take the number from the end of that line (should be only one number at the end) 4) search for a=rtpmap:<that number> In theory, you should only search between the m=video and the next m= line, but in practice this doesn't matter 5) the a=rtpmap line will have video/H264 or video/VP8 on it Simpler versions for Firefox to Firefox only calls (may break talking to Chrome or other interop scenarios): 4) if <that number> == 120, it's VP8; == 126 or 97 == H264 or 2) search sdp for VP8 and H264; if you find only one you know the codec. (this is slightly risky, but only slightly)
Note: you must somehow get the answer SDP. You may be able to get a workable approximation of it from the peerconnection's localDescription/remoteDescription, though note those aren't exactly what the passed-in SDP was.
(In reply to Randell Jesup [:jesup] from comment #2) > Note: you must somehow get the answer SDP. You may be able to get a > workable approximation of it from the peerconnection's > localDescription/remoteDescription, though note those aren't exactly what > the passed-in SDP was. Randell, is that the approach that Oscar implemented in bug 1065161?
Flags: needinfo?(rjesup)
(In reply to Maria Angeles Oteo (:oteo) from comment #3) > (In reply to Randell Jesup [:jesup] from comment #2) > > Note: you must somehow get the answer SDP. You may be able to get a > > workable approximation of it from the peerconnection's > > localDescription/remoteDescription, though note those aren't exactly what > > the passed-in SDP was. > > Randell, is that the approach that Oscar implemented in bug 1065161? No; that was much more invasive. My approach is all doable today using the JS apis - get the answer SDP (or retrieve it from local/remote description), then look at it. My approach does not tell you the width and height, though those should be available from the <video> element.
Flags: needinfo?(rjesup)
I was able to successfully query the format by doing something like this after a succesful connection: if (peerConnection.localDescription.sdp.indexOf('a=rtpmap:126 H264') != -1) { console.log('WebRTC is using an H.264 video format'); } else if (peerConnection.localDescription.sdp.indexOf('a=rtpmap:120 VP8') != -1) { console.log('WebRTC is using a VP8 video format'); } else { console.log('WebRTC is using an unknown video format'); }
Thanks both for your help! Yes, peerConnection object has access to answer/offer sdp, the problem is that loop uses tokbox library, and it doesn't expose peerConnection so I don't have a direct access to the sdp. That's why I tried Gecko's approach. I will try to find a way to get at least the sdp from the tokbox library
(In reply to Diego Wilson [:diego] from comment #5) > I was able to successfully query the format by doing something like this > after a succesful connection: > > if (peerConnection.localDescription.sdp.indexOf('a=rtpmap:126 H264') != -1) > { > console.log('WebRTC is using an H.264 video format'); > } > else if (peerConnection.localDescription.sdp.indexOf('a=rtpmap:120 VP8') != > -1) { > console.log('WebRTC is using a VP8 video format'); > } > else { > console.log('WebRTC is using an unknown video format'); > } I would suggest first matching on the answer (not offer) m=video line (get the first codec after SAVPF) and then look for the a=rtpmap:<value> line, then index the line for H264 or VP8/etc.
Blocks: 1065161
It seems that Oscar has resolved this issue in bug 1065161, so resolving it as duplicated and removing some dependencies
No longer blocks: 1071007, 1065161
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.