OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1548 // which will connect the sender to the underlying transport. This can | 1548 // which will connect the sender to the underlying transport. This can |
1549 // occur if a local session description that contains the ID of the sender | 1549 // occur if a local session description that contains the ID of the sender |
1550 // is set before AddStream is called. It can also occur if the local | 1550 // is set before AddStream is called. It can also occur if the local |
1551 // session description is not changed and RemoveStream is called, and | 1551 // session description is not changed and RemoveStream is called, and |
1552 // later AddStream is called again with the same stream. | 1552 // later AddStream is called again with the same stream. |
1553 const TrackInfo* track_info = | 1553 const TrackInfo* track_info = |
1554 FindTrackInfo(local_audio_tracks_, stream->label(), track->id()); | 1554 FindTrackInfo(local_audio_tracks_, stream->label(), track->id()); |
1555 if (track_info) { | 1555 if (track_info) { |
1556 new_sender->internal()->SetSsrc(track_info->ssrc); | 1556 new_sender->internal()->SetSsrc(track_info->ssrc); |
1557 } | 1557 } |
| 1558 observer_->OnRenegotiationNeeded(); |
1558 } | 1559 } |
1559 | 1560 |
1560 // TODO(deadbeef): Don't destroy RtpSenders here; they should be kept around | 1561 // TODO(deadbeef): Don't destroy RtpSenders here; they should be kept around |
1561 // indefinitely, when we have unified plan SDP. | 1562 // indefinitely, when we have unified plan SDP. |
1562 void PeerConnection::OnAudioTrackRemoved(AudioTrackInterface* track, | 1563 void PeerConnection::OnAudioTrackRemoved(AudioTrackInterface* track, |
1563 MediaStreamInterface* stream) { | 1564 MediaStreamInterface* stream) { |
1564 if (IsClosed()) { | 1565 if (IsClosed()) { |
1565 return; | 1566 return; |
1566 } | 1567 } |
1567 auto sender = FindSenderForTrack(track); | 1568 auto sender = FindSenderForTrack(track); |
1568 if (sender == senders_.end()) { | 1569 if (sender == senders_.end()) { |
1569 LOG(LS_WARNING) << "RtpSender for track with id " << track->id() | 1570 LOG(LS_WARNING) << "RtpSender for track with id " << track->id() |
1570 << " doesn't exist."; | 1571 << " doesn't exist."; |
1571 return; | 1572 return; |
1572 } | 1573 } |
1573 (*sender)->internal()->Stop(); | 1574 (*sender)->internal()->Stop(); |
1574 senders_.erase(sender); | 1575 senders_.erase(sender); |
| 1576 observer_->OnRenegotiationNeeded(); |
1575 } | 1577 } |
1576 | 1578 |
1577 void PeerConnection::OnVideoTrackAdded(VideoTrackInterface* track, | 1579 void PeerConnection::OnVideoTrackAdded(VideoTrackInterface* track, |
1578 MediaStreamInterface* stream) { | 1580 MediaStreamInterface* stream) { |
1579 if (IsClosed()) { | 1581 if (IsClosed()) { |
1580 return; | 1582 return; |
1581 } | 1583 } |
1582 auto sender = FindSenderForTrack(track); | 1584 auto sender = FindSenderForTrack(track); |
1583 if (sender != senders_.end()) { | 1585 if (sender != senders_.end()) { |
1584 // We already have a sender for this track, so just change the stream_id | 1586 // We already have a sender for this track, so just change the stream_id |
1585 // so that it's correct in the next call to CreateOffer. | 1587 // so that it's correct in the next call to CreateOffer. |
1586 (*sender)->internal()->set_stream_id(stream->label()); | 1588 (*sender)->internal()->set_stream_id(stream->label()); |
1587 return; | 1589 return; |
1588 } | 1590 } |
1589 | 1591 |
1590 // Normal case; we've never seen this track before. | 1592 // Normal case; we've never seen this track before. |
1591 rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>> new_sender = | 1593 rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>> new_sender = |
1592 RtpSenderProxyWithInternal<RtpSenderInternal>::Create( | 1594 RtpSenderProxyWithInternal<RtpSenderInternal>::Create( |
1593 signaling_thread(), new VideoRtpSender(track, stream->label(), | 1595 signaling_thread(), new VideoRtpSender(track, stream->label(), |
1594 session_->video_channel())); | 1596 session_->video_channel())); |
1595 senders_.push_back(new_sender); | 1597 senders_.push_back(new_sender); |
1596 const TrackInfo* track_info = | 1598 const TrackInfo* track_info = |
1597 FindTrackInfo(local_video_tracks_, stream->label(), track->id()); | 1599 FindTrackInfo(local_video_tracks_, stream->label(), track->id()); |
1598 if (track_info) { | 1600 if (track_info) { |
1599 new_sender->internal()->SetSsrc(track_info->ssrc); | 1601 new_sender->internal()->SetSsrc(track_info->ssrc); |
1600 } | 1602 } |
| 1603 observer_->OnRenegotiationNeeded(); |
1601 } | 1604 } |
1602 | 1605 |
1603 void PeerConnection::OnVideoTrackRemoved(VideoTrackInterface* track, | 1606 void PeerConnection::OnVideoTrackRemoved(VideoTrackInterface* track, |
1604 MediaStreamInterface* stream) { | 1607 MediaStreamInterface* stream) { |
1605 if (IsClosed()) { | 1608 if (IsClosed()) { |
1606 return; | 1609 return; |
1607 } | 1610 } |
1608 auto sender = FindSenderForTrack(track); | 1611 auto sender = FindSenderForTrack(track); |
1609 if (sender == senders_.end()) { | 1612 if (sender == senders_.end()) { |
1610 LOG(LS_WARNING) << "RtpSender for track with id " << track->id() | 1613 LOG(LS_WARNING) << "RtpSender for track with id " << track->id() |
1611 << " doesn't exist."; | 1614 << " doesn't exist."; |
1612 return; | 1615 return; |
1613 } | 1616 } |
1614 (*sender)->internal()->Stop(); | 1617 (*sender)->internal()->Stop(); |
1615 senders_.erase(sender); | 1618 senders_.erase(sender); |
| 1619 observer_->OnRenegotiationNeeded(); |
1616 } | 1620 } |
1617 | 1621 |
1618 void PeerConnection::PostSetSessionDescriptionFailure( | 1622 void PeerConnection::PostSetSessionDescriptionFailure( |
1619 SetSessionDescriptionObserver* observer, | 1623 SetSessionDescriptionObserver* observer, |
1620 const std::string& error) { | 1624 const std::string& error) { |
1621 SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer); | 1625 SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer); |
1622 msg->error = error; | 1626 msg->error = error; |
1623 signaling_thread()->Post(RTC_FROM_HERE, this, | 1627 signaling_thread()->Post(RTC_FROM_HERE, this, |
1624 MSG_SET_SESSIONDESCRIPTION_FAILED, msg); | 1628 MSG_SET_SESSIONDESCRIPTION_FAILED, msg); |
1625 } | 1629 } |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2368 return event_log_->StartLogging(file, max_size_bytes); | 2372 return event_log_->StartLogging(file, max_size_bytes); |
2369 } | 2373 } |
2370 | 2374 |
2371 void PeerConnection::StopRtcEventLog_w() { | 2375 void PeerConnection::StopRtcEventLog_w() { |
2372 if (event_log_) { | 2376 if (event_log_) { |
2373 event_log_->StopLogging(); | 2377 event_log_->StopLogging(); |
2374 } | 2378 } |
2375 } | 2379 } |
2376 | 2380 |
2377 } // namespace webrtc | 2381 } // namespace webrtc |
OLD | NEW |