Receiving multiple codecs in a SDP answer does not work

Assigned to



WebRTC: Audio/Video
a year ago
2 days ago


(Reporter: Shyam, Assigned: drno, NeedInfo)


51 Branch
Mac OS X

Firefox Tracking Flags

(Not tracked)


(Whiteboard: [need info reporter 2017-1-27])

MozReview Requests


Submitter Diff Changes Open Issues Last Updated
Error loading review requests:


(2 attachments)



a year ago
Created attachment 8830464 [details]

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36

Steps to reproduce:

I have been working on a app which tries to use VP9 for webrtc video calls. Using Firefox on OSX 10.12.1.
When making a call from my app to Firefox, things work fine and VP9 gets used both ways. 
But when we make call from Firefox to my mobile app, I see that Firefox offers video codecs : VP8, VP9.
My app answers with VP9, VP8. Answer contains both codecs.
I can see the video in my app, but Firefox shows black video. 
Firefox is encoding to VP9 and my app can decode is properly.
My app is encoding to VP8 and firefox fails to display the video. I think firefox is expecting VP9 instead of VP8.
The same app works fine with Chrome and the order of codecs in SDPs is same in Chrome (offer: VP8,VP9, answer:VP9,VP8).  Stream going from app -> chrome is vp8 and from chrome -> app is VP9.
To me this looks like a bug in Firefox's implementation of WebRTC stack.
Attached is the file with SDPs and logs from Firefox.

Actual results:

Video on Firefox side shows black.

Expected results:

Video stream should be decoded properly and displayed correctly as in Chrome.


a year ago
Component: Untriaged → WebRTC: Audio/Video
OS: Unspecified → Mac OS X
Product: Firefox → Core
Hardware: Unspecified → x86

Comment 1

a year ago
Few more clarifications: Does FireFox assume that the video codec has to be same for send and receive? 
Chrome seems to work fine with mixed codec. When making call from Firefox to VP9Client, Firefox will offer SDP with (VP8, VP9); VP9Client will answer with SDP (VP9, VP8) (note the order is switched). When the connection is setup, Firefox encodes to VP9 and VP9Client is able to decode and see the video properly.
However VP9Client is encoding to VP8 and sending to Firefox, Firefox shows black video, I suspect its failing to decode, which could be because Firefox might be expecting VP9. 
The exact same scenario works with Chrome.
Can you verify the if the described scenario does not work in firefox?
Flags: needinfo?(drno)
Whiteboard: [need info drno 2017-1-27]

Comment 3

a year ago
Yes, I have been using Firefox beta which has VP9 support and the scenario does not work completely. The video is not decoded/displayed in Firefox beta, on the other side things are fine. Local preview is fine on the Firefox side, but the remote video is not decoded/displayed. I suspect Firefox is expecting VP9 instead of VP8 and hence the decode fails.
On the app side, both preview and remote videos show up correctly.
Shyam: Can you try in Developer Edition or Nightly (53 or 54)?  Major changes to how codec configuration landed in 53.

Also: a log generated with NSPR_LOG_MODULES=signaling:5 NSPR_LOG_FILE=some_temp_log_file would help a bunch.  (those are env vars; if in windows, use the 'set' command from a shell then start firefox from the shell.

about:webrtc will also have some useful information
Flags: needinfo?(shyamsadhwani)
Flags: needinfo?(docfaraday)
Whiteboard: [need info drno 2017-1-27] → [need info drno and reporter 2017-1-27]

Comment 5

a year ago
I don't know how to repro this, beside hacking Firefox into behaving like the described endpoint in this scenario.
I think the log file is hopefully the way easier solution to get an idea of what is going on here.
Flags: needinfo?(drno)


a year ago
Whiteboard: [need info drno and reporter 2017-1-27] → [need info reporter 2017-1-27]


a year ago
Flags: needinfo?(docfaraday)
Comment hidden (mozreview-request)


a year ago
backlog: --- → webrtc/webaudio+
Rank: 19
Ever confirmed: true
Priority: -- → P1
Summary: Firefox 51.0b14 (64-bit) does now work properly for VP9 video calls → Receiving multiple codecs in a SDP answer does not work

Comment 7

a year ago
Shyam I would like to ask you to test a try build with my patch once build has finished (I'll post a link to the executable in here).


a year ago
Assignee: nobody → drno

Comment 8

a year ago
Based on your initial bug report I assume you would want to test the Mac binaries:

Shyam could you download the build above and let me know if it fixes your problem?


a year ago
Attachment #8832359 - Flags: review?(rjesup)

Comment 9

a year ago
Comment on attachment 8832359 [details]
Bug 1333879: permit receiving multiple codecs.

::: media/webrtc/signaling/src/jsep/JsepTrack.cpp:414
(Diff revision 1)
> -  // answer.  For now, remove all but the first codec unless the red codec
> +  // answer where we build the answer. If we received an answer we 
> +  // For now, remove all but the first codec unless the red codec

Remove "For now"?
Attachment #8832359 - Flags: review+

Comment 10

a year ago
Thanks for providing the fix, unfortunately I am not able to run this app, I get error : “Nightly” is damaged and can’t be opened. You should eject the disk image.
I am on 10.12.1 macOS Sierra MacBook Pro (Retina, 13-inch, Early 2015)
nils - can we land this?  and how far can we uplift it?  It looks to be a pretty simple patch.

we could probably add a test by munging the offer to be vp8/vp9, then mung the response from vp8 to vp9 vp8, so one side will send in vp9, and the other side will send in vp8.  then verify the side receiving vp8 gets video.
Flags: needinfo?(drno)

Comment 12

a year ago
Unfortunately no. Unit tests are screaming left and right with my last patch. And I remember that I did not see an easy solution to that back then.
Flags: needinfo?(drno)
Mass change P1->P2 to align with new Mozilla triage process
Priority: P1 → P2

Comment 14

4 days ago
My team has run into this recently. We have an SFU that bridges Firefox and Safari. The leg between Firefox and the SFU negotiates an m=video line that will transmit VP8 or H.264. Firefox offers first with support for VP8 and H.264; then, the SFU answers with support for VP8 and H.264; finally, in a subsequent round of negotiation, the SFU offers (again with VP8 and H.264); but, Firefox answers only with support for VP8.

I have two JSFiddles demonstrating this, one for Firefox and one for Chrome:

* Firefox:
* Chrome:

In the JSFiddle, I see Firefox 58 and 59 first offer VP8 and H.264, then only VP8. Chrome continues offering H.264 and VP8.

Comment 15

2 days ago
Hello everybody!!
It is also easily reproducible just running
You can see that the PeerConnection answerer only adds the preferred cocec in the SDP answer.
I hope this can help to test the issue in an easy way ;).
You need to log in before you can comment on or make changes to this bug.