OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2004 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 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1377 | 1377 |
1378 void VoiceChannel::SetRawAudioSink( | 1378 void VoiceChannel::SetRawAudioSink( |
1379 uint32_t ssrc, | 1379 uint32_t ssrc, |
1380 std::unique_ptr<webrtc::AudioSinkInterface> sink) { | 1380 std::unique_ptr<webrtc::AudioSinkInterface> sink) { |
1381 // We need to work around Bind's lack of support for unique_ptr and ownership | 1381 // We need to work around Bind's lack of support for unique_ptr and ownership |
1382 // passing. So we invoke to our own little routine that gets a pointer to | 1382 // passing. So we invoke to our own little routine that gets a pointer to |
1383 // our local variable. This is OK since we're synchronously invoking. | 1383 // our local variable. This is OK since we're synchronously invoking. |
1384 InvokeOnWorker(Bind(&SetRawAudioSink_w, media_channel(), ssrc, &sink)); | 1384 InvokeOnWorker(Bind(&SetRawAudioSink_w, media_channel(), ssrc, &sink)); |
1385 } | 1385 } |
1386 | 1386 |
| 1387 webrtc::RtpParameters VoiceChannel::GetRtpParameters(uint32_t ssrc) const { |
| 1388 return worker_thread()->Invoke<webrtc::RtpParameters>( |
| 1389 Bind(&VoiceChannel::GetRtpParameters_w, this, ssrc)); |
| 1390 } |
| 1391 |
| 1392 webrtc::RtpParameters VoiceChannel::GetRtpParameters_w(uint32_t ssrc) const { |
| 1393 // Not yet implemented. |
| 1394 // TODO(skvlad): Add support for limiting send bitrate for audio channels. |
| 1395 return webrtc::RtpParameters(); |
| 1396 } |
| 1397 |
| 1398 bool VoiceChannel::SetRtpParameters(uint32_t ssrc, |
| 1399 const webrtc::RtpParameters& parameters) { |
| 1400 return InvokeOnWorker( |
| 1401 Bind(&VoiceChannel::SetRtpParameters_w, this, ssrc, parameters)); |
| 1402 } |
| 1403 |
| 1404 bool VoiceChannel::SetRtpParameters_w(uint32_t ssrc, |
| 1405 webrtc::RtpParameters parameters) { |
| 1406 // Not yet implemented. |
| 1407 // TODO(skvlad): Add support for limiting send bitrate for audio channels. |
| 1408 return false; |
| 1409 } |
| 1410 |
1387 bool VoiceChannel::GetStats(VoiceMediaInfo* stats) { | 1411 bool VoiceChannel::GetStats(VoiceMediaInfo* stats) { |
1388 return InvokeOnWorker(Bind(&VoiceMediaChannel::GetStats, | 1412 return InvokeOnWorker(Bind(&VoiceMediaChannel::GetStats, |
1389 media_channel(), stats)); | 1413 media_channel(), stats)); |
1390 } | 1414 } |
1391 | 1415 |
1392 void VoiceChannel::StartMediaMonitor(int cms) { | 1416 void VoiceChannel::StartMediaMonitor(int cms) { |
1393 media_monitor_.reset(new VoiceMediaMonitor(media_channel(), worker_thread(), | 1417 media_monitor_.reset(new VoiceMediaMonitor(media_channel(), worker_thread(), |
1394 rtc::Thread::Current())); | 1418 rtc::Thread::Current())); |
1395 media_monitor_->SignalUpdate.connect( | 1419 media_monitor_->SignalUpdate.connect( |
1396 this, &VoiceChannel::OnMediaMonitorUpdate); | 1420 this, &VoiceChannel::OnMediaMonitorUpdate); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1529 | 1553 |
1530 if (!SetRtpTransportParameters_w(content, action, CS_REMOTE, error_desc)) { | 1554 if (!SetRtpTransportParameters_w(content, action, CS_REMOTE, error_desc)) { |
1531 return false; | 1555 return false; |
1532 } | 1556 } |
1533 | 1557 |
1534 AudioSendParameters send_params = last_send_params_; | 1558 AudioSendParameters send_params = last_send_params_; |
1535 RtpSendParametersFromMediaDescription(audio, &send_params); | 1559 RtpSendParametersFromMediaDescription(audio, &send_params); |
1536 if (audio->agc_minus_10db()) { | 1560 if (audio->agc_minus_10db()) { |
1537 send_params.options.adjust_agc_delta = rtc::Optional<int>(kAgcMinus10db); | 1561 send_params.options.adjust_agc_delta = rtc::Optional<int>(kAgcMinus10db); |
1538 } | 1562 } |
1539 if (!media_channel()->SetSendParameters(send_params)) { | 1563 |
| 1564 bool parameters_applied = media_channel()->SetSendParameters(send_params); |
| 1565 if (!parameters_applied) { |
1540 SafeSetError("Failed to set remote audio description send parameters.", | 1566 SafeSetError("Failed to set remote audio description send parameters.", |
1541 error_desc); | 1567 error_desc); |
1542 return false; | 1568 return false; |
1543 } | 1569 } |
1544 last_send_params_ = send_params; | 1570 last_send_params_ = send_params; |
1545 | 1571 |
1546 // TODO(pthatcher): Move remote streams into AudioRecvParameters, | 1572 // TODO(pthatcher): Move remote streams into AudioRecvParameters, |
1547 // and only give it to the media channel once we have a local | 1573 // and only give it to the media channel once we have a local |
1548 // description too (without a local description, we won't be able to | 1574 // description too (without a local description, we won't be able to |
1549 // recv them anyway). | 1575 // recv them anyway). |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1654 media_channel(), ssrc, capturer)); | 1680 media_channel(), ssrc, capturer)); |
1655 } | 1681 } |
1656 | 1682 |
1657 bool VideoChannel::SetVideoSend(uint32_t ssrc, | 1683 bool VideoChannel::SetVideoSend(uint32_t ssrc, |
1658 bool mute, | 1684 bool mute, |
1659 const VideoOptions* options) { | 1685 const VideoOptions* options) { |
1660 return InvokeOnWorker(Bind(&VideoMediaChannel::SetVideoSend, media_channel(), | 1686 return InvokeOnWorker(Bind(&VideoMediaChannel::SetVideoSend, media_channel(), |
1661 ssrc, mute, options)); | 1687 ssrc, mute, options)); |
1662 } | 1688 } |
1663 | 1689 |
| 1690 webrtc::RtpParameters VideoChannel::GetRtpParameters(uint32_t ssrc) const { |
| 1691 return worker_thread()->Invoke<webrtc::RtpParameters>( |
| 1692 Bind(&VideoChannel::GetRtpParameters_w, this, ssrc)); |
| 1693 } |
| 1694 |
| 1695 webrtc::RtpParameters VideoChannel::GetRtpParameters_w(uint32_t ssrc) const { |
| 1696 return media_channel()->GetRtpParameters(ssrc); |
| 1697 } |
| 1698 |
| 1699 bool VideoChannel::SetRtpParameters(uint32_t ssrc, |
| 1700 const webrtc::RtpParameters& parameters) { |
| 1701 return InvokeOnWorker( |
| 1702 Bind(&VideoChannel::SetRtpParameters_w, this, ssrc, parameters)); |
| 1703 } |
| 1704 |
| 1705 bool VideoChannel::SetRtpParameters_w(uint32_t ssrc, |
| 1706 webrtc::RtpParameters parameters) { |
| 1707 return media_channel()->SetRtpParameters(ssrc, parameters); |
| 1708 } |
1664 void VideoChannel::ChangeState() { | 1709 void VideoChannel::ChangeState() { |
1665 // Send outgoing data if we're the active call, we have the remote content, | 1710 // Send outgoing data if we're the active call, we have the remote content, |
1666 // and we have had some form of connectivity. | 1711 // and we have had some form of connectivity. |
1667 bool send = IsReadyToSend(); | 1712 bool send = IsReadyToSend(); |
1668 if (!media_channel()->SetSend(send)) { | 1713 if (!media_channel()->SetSend(send)) { |
1669 LOG(LS_ERROR) << "Failed to SetSend on video channel"; | 1714 LOG(LS_ERROR) << "Failed to SetSend on video channel"; |
1670 // TODO(gangji): Report error back to server. | 1715 // TODO(gangji): Report error back to server. |
1671 } | 1716 } |
1672 | 1717 |
1673 LOG(LS_INFO) << "Changing video state, send=" << send; | 1718 LOG(LS_INFO) << "Changing video state, send=" << send; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1761 | 1806 |
1762 if (!SetRtpTransportParameters_w(content, action, CS_REMOTE, error_desc)) { | 1807 if (!SetRtpTransportParameters_w(content, action, CS_REMOTE, error_desc)) { |
1763 return false; | 1808 return false; |
1764 } | 1809 } |
1765 | 1810 |
1766 VideoSendParameters send_params = last_send_params_; | 1811 VideoSendParameters send_params = last_send_params_; |
1767 RtpSendParametersFromMediaDescription(video, &send_params); | 1812 RtpSendParametersFromMediaDescription(video, &send_params); |
1768 if (video->conference_mode()) { | 1813 if (video->conference_mode()) { |
1769 send_params.conference_mode = true; | 1814 send_params.conference_mode = true; |
1770 } | 1815 } |
1771 if (!media_channel()->SetSendParameters(send_params)) { | 1816 |
| 1817 bool parameters_applied = media_channel()->SetSendParameters(send_params); |
| 1818 |
| 1819 if (!parameters_applied) { |
1772 SafeSetError("Failed to set remote video description send parameters.", | 1820 SafeSetError("Failed to set remote video description send parameters.", |
1773 error_desc); | 1821 error_desc); |
1774 return false; | 1822 return false; |
1775 } | 1823 } |
1776 last_send_params_ = send_params; | 1824 last_send_params_ = send_params; |
1777 | 1825 |
1778 // TODO(pthatcher): Move remote streams into VideoRecvParameters, | 1826 // TODO(pthatcher): Move remote streams into VideoRecvParameters, |
1779 // and only give it to the media channel once we have a local | 1827 // and only give it to the media channel once we have a local |
1780 // description too (without a local description, we won't be able to | 1828 // description too (without a local description, we won't be able to |
1781 // recv them anyway). | 1829 // recv them anyway). |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2138 return (data_channel_type_ == DCT_RTP) && BaseChannel::ShouldSetupDtlsSrtp(); | 2186 return (data_channel_type_ == DCT_RTP) && BaseChannel::ShouldSetupDtlsSrtp(); |
2139 } | 2187 } |
2140 | 2188 |
2141 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { | 2189 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { |
2142 rtc::TypedMessageData<uint32_t>* message = | 2190 rtc::TypedMessageData<uint32_t>* message = |
2143 new rtc::TypedMessageData<uint32_t>(sid); | 2191 new rtc::TypedMessageData<uint32_t>(sid); |
2144 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); | 2192 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); |
2145 } | 2193 } |
2146 | 2194 |
2147 } // namespace cricket | 2195 } // namespace cricket |
OLD | NEW |