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)
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.
Comment 1•11 years ago
|
||
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)
Comment 2•11 years ago
|
||
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.
Reporter | ||
Comment 3•11 years ago
|
||
(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)
Comment 4•11 years ago
|
||
(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)
![]() |
||
Comment 5•11 years ago
|
||
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');
}
![]() |
||
Comment 6•11 years ago
|
||
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
Comment 7•11 years ago
|
||
(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.
Reporter | ||
Comment 8•11 years ago
|
||
It seems that Oscar has resolved this issue in bug 1065161, so resolving it as duplicated and removing some dependencies
You need to log in
before you can comment on or make changes to this bug.
Description
•