Bug 1271669 - Remove wallpaper constraints to the MediaStream argument to RTCPeerConnection.addTrack(). r=jib

This change RTCPeerConnection.addTrack() to allow any MediaStream as argument.

The MediaStream is in the end used as an identifier of how the tracks will be
grouped together on the receiving side of the peer connection.

MozReview-Commit-ID: 9wDPOmMHYDc

--HG--
extra : rebase_source : 5fd59853c2d207cbcdaa1e4a767b3c4de20a1beb
extra : histedit_source : 2b88e899a329df07a46c1f12e449956d59645cf7
This commit is contained in:
Andreas Pehrson 2016-05-19 15:32:56 +02:00
Родитель 59ed044326
Коммит 5c1742c0d9
2 изменённых файлов: 1 добавлений и 20 удалений

Просмотреть файл

@ -1045,10 +1045,6 @@ RTCPeerConnection.prototype = {
if (stream.currentTime === undefined) {
throw new this._win.DOMException("invalid stream.", "InvalidParameterError");
}
if (stream.getTracks().indexOf(track) < 0) {
throw new this._win.DOMException("track is not in stream.",
"InvalidParameterError");
}
this._checkClosed();
this._senders.forEach(sender => {
if (sender.track == track) {
@ -1056,13 +1052,7 @@ RTCPeerConnection.prototype = {
"InvalidParameterError");
}
});
try {
this._impl.addTrack(track, stream);
} catch (e if (e.result == Cr.NS_ERROR_NOT_IMPLEMENTED)) {
throw new this._win.DOMException(
"track in constructed stream not yet supported (see Bug 1259236).",
"NotSupportedError");
}
this._impl.addTrack(track, stream);
let sender = this._win.RTCRtpSender._create(this._win,
new RTCRtpSender(this, track,
stream));

Просмотреть файл

@ -2264,15 +2264,6 @@ nsresult
PeerConnectionImpl::AddTrack(MediaStreamTrack& aTrack,
DOMMediaStream& aMediaStream)
{
if (!aMediaStream.HasTrack(aTrack)) {
CSFLogError(logTag, "%s: Track is not in stream", __FUNCTION__);
return NS_ERROR_FAILURE;
}
if (!aMediaStream.OwnsTrack(aTrack)) {
CSFLogError(logTag, "%s: Track is not in owned stream (Bug 1259236)", __FUNCTION__);
return NS_ERROR_NOT_IMPLEMENTED;
}
std::string streamId = PeerConnectionImpl::GetStreamId(aMediaStream);
std::string trackId = PeerConnectionImpl::GetTrackId(aTrack);
nsresult res = mMedia->AddTrack(aMediaStream, streamId, aTrack, trackId);