WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
158191
WebRTC: Update RTCPeerConnection.addTrack() to create (or reuse) an RTCRtpTransceiver
https://bugs.webkit.org/show_bug.cgi?id=158191
Summary
WebRTC: Update RTCPeerConnection.addTrack() to create (or reuse) an RTCRtpTra...
Adam Bergkvist
Reported
2016-05-29 01:48:55 PDT
When addTrack is called, there might be an existing RTCRtpTransceiver with an RTCRtpSender that can be reused. This procedure is described at [1]. [1]
https://w3c.github.io/webrtc-pc/archives/20160513/webrtc.html#dom-rtcpeerconnection-addtrack
Attachments
Proposed patch
(15.13 KB, patch)
2016-06-01 11:47 PDT
,
Adam Bergkvist
no flags
Details
Formatted Diff
Diff
Updated patch
(15.98 KB, patch)
2016-06-01 22:59 PDT
,
Adam Bergkvist
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Adam Bergkvist
Comment 1
2016-06-01 11:47:23 PDT
Created
attachment 280254
[details]
Proposed patch
Eric Carlson
Comment 2
2016-06-01 12:39:51 PDT
Comment on
attachment 280254
[details]
Proposed patch View in context:
https://bugs.webkit.org/attachment.cgi?id=280254&action=review
> Source/WebCore/Modules/mediastream/RTCPeerConnection.h:67 > + Vector<RefPtr<RTCRtpSender>> getSenders() const override { return m_transceiverSet->getSenders(); } > + Vector<RefPtr<RTCRtpReceiver>> getReceivers() const { return m_transceiverSet->getReceivers(); }
Can these return a reference to a const Vector: "const Vector<RefPtr<...>>&"?
> Source/WebCore/Modules/mediastream/RTCPeerConnection.h:68 > + const Vector<RefPtr<RTCRtpTransceiver>>& getTransceivers() const override { return m_transceiverSet->list(); }
Can this be final instead of override?
Adam Bergkvist
Comment 3
2016-06-01 13:05:10 PDT
(In reply to
comment #2
)
> Comment on
attachment 280254
[details]
> Proposed patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=280254&action=review
> > > Source/WebCore/Modules/mediastream/RTCPeerConnection.h:67 > > + Vector<RefPtr<RTCRtpSender>> getSenders() const override { return m_transceiverSet->getSenders(); } > > + Vector<RefPtr<RTCRtpReceiver>> getReceivers() const { return m_transceiverSet->getReceivers(); } > > Can these return a reference to a const Vector: "const Vector<RefPtr<...>>&"?
Yes they can; and probably should :). createOfferTask uses getSenders() and modifies the resulting vector, but it can create a new vector from the const ref for its special purpose.
> > Source/WebCore/Modules/mediastream/RTCPeerConnection.h:68 > > + const Vector<RefPtr<RTCRtpTransceiver>>& getTransceivers() const override { return m_transceiverSet->list(); } > > Can this be final instead of override?
Seems to work. I'm a bit unsure what the result is being that the entire class is final.
Adam Bergkvist
Comment 4
2016-06-01 22:59:29 PDT
Created
attachment 280309
[details]
Updated patch Made getSenders/Receivers() return a const Vector ref. Kept 'override' on getTransceivers() since, to my understanding, final doesn't provide any extra functionality when the class is final already. I may be wrong on this though.
Adam Bergkvist
Comment 5
2016-06-02 10:26:44 PDT
Comment on
attachment 280309
[details]
Updated patch Thanks for reviewing Eric!
WebKit Commit Bot
Comment 6
2016-06-02 10:49:06 PDT
Comment on
attachment 280309
[details]
Updated patch Clearing flags on attachment: 280309 Committed
r201601
: <
http://trac.webkit.org/changeset/201601
>
WebKit Commit Bot
Comment 7
2016-06-02 10:49:09 PDT
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 8
2016-06-02 11:00:38 PDT
Comment on
attachment 280309
[details]
Updated patch View in context:
https://bugs.webkit.org/attachment.cgi?id=280309&action=review
> Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp:135 > + RtpSenderVector senders = RtpSenderVector(m_client->getSenders());
I don’t think we need to state the class name twice. Default behavior when receiving a const& is to make a copy, in fact, this should work: auto senders = m_client->getSenders(); But we need a comment explaining why we need a copy rather than using the reference. The copy is expensive.
Adam Bergkvist
Comment 9
2016-06-03 02:52:31 PDT
Comment on
attachment 280309
[details]
Updated patch View in context:
https://bugs.webkit.org/attachment.cgi?id=280309&action=review
>> Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp:135 >> + RtpSenderVector senders = RtpSenderVector(m_client->getSenders()); > > I don’t think we need to state the class name twice. Default behavior when receiving a const& is to make a copy, in fact, this should work: > > auto senders = m_client->getSenders(); > > But we need a comment explaining why we need a copy rather than using the reference. The copy is expensive.
The content of this function is replaced in
https://bugs.webkit.org/show_bug.cgi?id=158203
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug