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 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1396 | 1396 |
1397 void VoiceChannel::SetRawAudioSink( | 1397 void VoiceChannel::SetRawAudioSink( |
1398 uint32_t ssrc, | 1398 uint32_t ssrc, |
1399 std::unique_ptr<webrtc::AudioSinkInterface> sink) { | 1399 std::unique_ptr<webrtc::AudioSinkInterface> sink) { |
1400 // We need to work around Bind's lack of support for unique_ptr and ownership | 1400 // We need to work around Bind's lack of support for unique_ptr and ownership |
1401 // passing. So we invoke to our own little routine that gets a pointer to | 1401 // passing. So we invoke to our own little routine that gets a pointer to |
1402 // our local variable. This is OK since we're synchronously invoking. | 1402 // our local variable. This is OK since we're synchronously invoking. |
1403 InvokeOnWorker(Bind(&SetRawAudioSink_w, media_channel(), ssrc, &sink)); | 1403 InvokeOnWorker(Bind(&SetRawAudioSink_w, media_channel(), ssrc, &sink)); |
1404 } | 1404 } |
1405 | 1405 |
1406 webrtc::RtpParameters VoiceChannel::GetRtpParameters(uint32_t ssrc) const { | 1406 webrtc::RtpParameters VoiceChannel::GetRtpSendParameters(uint32_t ssrc) const { |
1407 return worker_thread()->Invoke<webrtc::RtpParameters>( | 1407 return worker_thread()->Invoke<webrtc::RtpParameters>( |
1408 Bind(&VoiceChannel::GetRtpParameters_w, this, ssrc)); | 1408 Bind(&VoiceChannel::GetRtpSendParameters_w, this, ssrc)); |
1409 } | 1409 } |
1410 | 1410 |
1411 webrtc::RtpParameters VoiceChannel::GetRtpParameters_w(uint32_t ssrc) const { | 1411 webrtc::RtpParameters VoiceChannel::GetRtpSendParameters_w( |
1412 return media_channel()->GetRtpParameters(ssrc); | 1412 uint32_t ssrc) const { |
| 1413 return media_channel()->GetRtpSendParameters(ssrc); |
1413 } | 1414 } |
1414 | 1415 |
1415 bool VoiceChannel::SetRtpParameters(uint32_t ssrc, | 1416 bool VoiceChannel::SetRtpSendParameters( |
1416 const webrtc::RtpParameters& parameters) { | 1417 uint32_t ssrc, |
| 1418 const webrtc::RtpParameters& parameters) { |
1417 return InvokeOnWorker( | 1419 return InvokeOnWorker( |
1418 Bind(&VoiceChannel::SetRtpParameters_w, this, ssrc, parameters)); | 1420 Bind(&VoiceChannel::SetRtpSendParameters_w, this, ssrc, parameters)); |
1419 } | 1421 } |
1420 | 1422 |
1421 bool VoiceChannel::SetRtpParameters_w(uint32_t ssrc, | 1423 bool VoiceChannel::SetRtpSendParameters_w(uint32_t ssrc, |
1422 webrtc::RtpParameters parameters) { | 1424 webrtc::RtpParameters parameters) { |
1423 return media_channel()->SetRtpParameters(ssrc, parameters); | 1425 return media_channel()->SetRtpSendParameters(ssrc, parameters); |
| 1426 } |
| 1427 |
| 1428 webrtc::RtpParameters VoiceChannel::GetRtpReceiveParameters( |
| 1429 uint32_t ssrc) const { |
| 1430 return worker_thread()->Invoke<webrtc::RtpParameters>( |
| 1431 Bind(&VoiceChannel::GetRtpReceiveParameters_w, this, ssrc)); |
| 1432 } |
| 1433 |
| 1434 webrtc::RtpParameters VoiceChannel::GetRtpReceiveParameters_w( |
| 1435 uint32_t ssrc) const { |
| 1436 return media_channel()->GetRtpReceiveParameters(ssrc); |
| 1437 } |
| 1438 |
| 1439 bool VoiceChannel::SetRtpReceiveParameters( |
| 1440 uint32_t ssrc, |
| 1441 const webrtc::RtpParameters& parameters) { |
| 1442 return InvokeOnWorker( |
| 1443 Bind(&VoiceChannel::SetRtpReceiveParameters_w, this, ssrc, parameters)); |
| 1444 } |
| 1445 |
| 1446 bool VoiceChannel::SetRtpReceiveParameters_w(uint32_t ssrc, |
| 1447 webrtc::RtpParameters parameters) { |
| 1448 return media_channel()->SetRtpReceiveParameters(ssrc, parameters); |
1424 } | 1449 } |
1425 | 1450 |
1426 bool VoiceChannel::GetStats(VoiceMediaInfo* stats) { | 1451 bool VoiceChannel::GetStats(VoiceMediaInfo* stats) { |
1427 return InvokeOnWorker(Bind(&VoiceMediaChannel::GetStats, | 1452 return InvokeOnWorker(Bind(&VoiceMediaChannel::GetStats, |
1428 media_channel(), stats)); | 1453 media_channel(), stats)); |
1429 } | 1454 } |
1430 | 1455 |
1431 void VoiceChannel::StartMediaMonitor(int cms) { | 1456 void VoiceChannel::StartMediaMonitor(int cms) { |
1432 media_monitor_.reset(new VoiceMediaMonitor(media_channel(), worker_thread(), | 1457 media_monitor_.reset(new VoiceMediaMonitor(media_channel(), worker_thread(), |
1433 rtc::Thread::Current())); | 1458 rtc::Thread::Current())); |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1697 Bind(&VideoMediaChannel::SetSource, media_channel(), ssrc, source)); | 1722 Bind(&VideoMediaChannel::SetSource, media_channel(), ssrc, source)); |
1698 } | 1723 } |
1699 | 1724 |
1700 bool VideoChannel::SetVideoSend(uint32_t ssrc, | 1725 bool VideoChannel::SetVideoSend(uint32_t ssrc, |
1701 bool mute, | 1726 bool mute, |
1702 const VideoOptions* options) { | 1727 const VideoOptions* options) { |
1703 return InvokeOnWorker(Bind(&VideoMediaChannel::SetVideoSend, media_channel(), | 1728 return InvokeOnWorker(Bind(&VideoMediaChannel::SetVideoSend, media_channel(), |
1704 ssrc, mute, options)); | 1729 ssrc, mute, options)); |
1705 } | 1730 } |
1706 | 1731 |
1707 webrtc::RtpParameters VideoChannel::GetRtpParameters(uint32_t ssrc) const { | 1732 webrtc::RtpParameters VideoChannel::GetRtpSendParameters(uint32_t ssrc) const { |
1708 return worker_thread()->Invoke<webrtc::RtpParameters>( | 1733 return worker_thread()->Invoke<webrtc::RtpParameters>( |
1709 Bind(&VideoChannel::GetRtpParameters_w, this, ssrc)); | 1734 Bind(&VideoChannel::GetRtpSendParameters_w, this, ssrc)); |
1710 } | 1735 } |
1711 | 1736 |
1712 webrtc::RtpParameters VideoChannel::GetRtpParameters_w(uint32_t ssrc) const { | 1737 webrtc::RtpParameters VideoChannel::GetRtpSendParameters_w( |
1713 return media_channel()->GetRtpParameters(ssrc); | 1738 uint32_t ssrc) const { |
| 1739 return media_channel()->GetRtpSendParameters(ssrc); |
1714 } | 1740 } |
1715 | 1741 |
1716 bool VideoChannel::SetRtpParameters(uint32_t ssrc, | 1742 bool VideoChannel::SetRtpSendParameters( |
1717 const webrtc::RtpParameters& parameters) { | 1743 uint32_t ssrc, |
| 1744 const webrtc::RtpParameters& parameters) { |
1718 return InvokeOnWorker( | 1745 return InvokeOnWorker( |
1719 Bind(&VideoChannel::SetRtpParameters_w, this, ssrc, parameters)); | 1746 Bind(&VideoChannel::SetRtpSendParameters_w, this, ssrc, parameters)); |
1720 } | 1747 } |
1721 | 1748 |
1722 bool VideoChannel::SetRtpParameters_w(uint32_t ssrc, | 1749 bool VideoChannel::SetRtpSendParameters_w(uint32_t ssrc, |
1723 webrtc::RtpParameters parameters) { | 1750 webrtc::RtpParameters parameters) { |
1724 return media_channel()->SetRtpParameters(ssrc, parameters); | 1751 return media_channel()->SetRtpSendParameters(ssrc, parameters); |
1725 } | 1752 } |
| 1753 |
| 1754 webrtc::RtpParameters VideoChannel::GetRtpReceiveParameters( |
| 1755 uint32_t ssrc) const { |
| 1756 return worker_thread()->Invoke<webrtc::RtpParameters>( |
| 1757 Bind(&VideoChannel::GetRtpReceiveParameters_w, this, ssrc)); |
| 1758 } |
| 1759 |
| 1760 webrtc::RtpParameters VideoChannel::GetRtpReceiveParameters_w( |
| 1761 uint32_t ssrc) const { |
| 1762 return media_channel()->GetRtpReceiveParameters(ssrc); |
| 1763 } |
| 1764 |
| 1765 bool VideoChannel::SetRtpReceiveParameters( |
| 1766 uint32_t ssrc, |
| 1767 const webrtc::RtpParameters& parameters) { |
| 1768 return InvokeOnWorker( |
| 1769 Bind(&VideoChannel::SetRtpReceiveParameters_w, this, ssrc, parameters)); |
| 1770 } |
| 1771 |
| 1772 bool VideoChannel::SetRtpReceiveParameters_w(uint32_t ssrc, |
| 1773 webrtc::RtpParameters parameters) { |
| 1774 return media_channel()->SetRtpReceiveParameters(ssrc, parameters); |
| 1775 } |
| 1776 |
1726 void VideoChannel::ChangeState() { | 1777 void VideoChannel::ChangeState() { |
1727 // Send outgoing data if we're the active call, we have the remote content, | 1778 // Send outgoing data if we're the active call, we have the remote content, |
1728 // and we have had some form of connectivity. | 1779 // and we have had some form of connectivity. |
1729 bool send = IsReadyToSend(); | 1780 bool send = IsReadyToSend(); |
1730 if (!media_channel()->SetSend(send)) { | 1781 if (!media_channel()->SetSend(send)) { |
1731 LOG(LS_ERROR) << "Failed to SetSend on video channel"; | 1782 LOG(LS_ERROR) << "Failed to SetSend on video channel"; |
1732 // TODO(gangji): Report error back to server. | 1783 // TODO(gangji): Report error back to server. |
1733 } | 1784 } |
1734 | 1785 |
1735 LOG(LS_INFO) << "Changing video state, send=" << send; | 1786 LOG(LS_INFO) << "Changing video state, send=" << send; |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2203 return (data_channel_type_ == DCT_RTP) && BaseChannel::ShouldSetupDtlsSrtp(); | 2254 return (data_channel_type_ == DCT_RTP) && BaseChannel::ShouldSetupDtlsSrtp(); |
2204 } | 2255 } |
2205 | 2256 |
2206 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { | 2257 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { |
2207 rtc::TypedMessageData<uint32_t>* message = | 2258 rtc::TypedMessageData<uint32_t>* message = |
2208 new rtc::TypedMessageData<uint32_t>(sid); | 2259 new rtc::TypedMessageData<uint32_t>(sid); |
2209 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); | 2260 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); |
2210 } | 2261 } |
2211 | 2262 |
2212 } // namespace cricket | 2263 } // namespace cricket |
OLD | NEW |