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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 | 434 |
435 bool BaseChannel::Enable(bool enable) { | 435 bool BaseChannel::Enable(bool enable) { |
436 worker_thread_->Invoke<void>( | 436 worker_thread_->Invoke<void>( |
437 RTC_FROM_HERE, | 437 RTC_FROM_HERE, |
438 Bind(enable ? &BaseChannel::EnableMedia_w : &BaseChannel::DisableMedia_w, | 438 Bind(enable ? &BaseChannel::EnableMedia_w : &BaseChannel::DisableMedia_w, |
439 this)); | 439 this)); |
440 return true; | 440 return true; |
441 } | 441 } |
442 | 442 |
443 bool BaseChannel::AddRecvStream(const StreamParams& sp) { | 443 bool BaseChannel::AddRecvStream(const StreamParams& sp) { |
444 return InvokeOnWorker(RTC_FROM_HERE, | 444 return InvokeOnWorker<bool>(RTC_FROM_HERE, |
445 Bind(&BaseChannel::AddRecvStream_w, this, sp)); | 445 Bind(&BaseChannel::AddRecvStream_w, this, sp)); |
446 } | 446 } |
447 | 447 |
448 bool BaseChannel::RemoveRecvStream(uint32_t ssrc) { | 448 bool BaseChannel::RemoveRecvStream(uint32_t ssrc) { |
449 return InvokeOnWorker(RTC_FROM_HERE, | 449 return InvokeOnWorker<bool>( |
450 Bind(&BaseChannel::RemoveRecvStream_w, this, ssrc)); | 450 RTC_FROM_HERE, Bind(&BaseChannel::RemoveRecvStream_w, this, ssrc)); |
451 } | 451 } |
452 | 452 |
453 bool BaseChannel::AddSendStream(const StreamParams& sp) { | 453 bool BaseChannel::AddSendStream(const StreamParams& sp) { |
454 return InvokeOnWorker( | 454 return InvokeOnWorker<bool>( |
455 RTC_FROM_HERE, Bind(&MediaChannel::AddSendStream, media_channel(), sp)); | 455 RTC_FROM_HERE, Bind(&MediaChannel::AddSendStream, media_channel(), sp)); |
456 } | 456 } |
457 | 457 |
458 bool BaseChannel::RemoveSendStream(uint32_t ssrc) { | 458 bool BaseChannel::RemoveSendStream(uint32_t ssrc) { |
459 return InvokeOnWorker(RTC_FROM_HERE, Bind(&MediaChannel::RemoveSendStream, | 459 return InvokeOnWorker<bool>( |
460 media_channel(), ssrc)); | 460 RTC_FROM_HERE, |
| 461 Bind(&MediaChannel::RemoveSendStream, media_channel(), ssrc)); |
461 } | 462 } |
462 | 463 |
463 bool BaseChannel::SetLocalContent(const MediaContentDescription* content, | 464 bool BaseChannel::SetLocalContent(const MediaContentDescription* content, |
464 ContentAction action, | 465 ContentAction action, |
465 std::string* error_desc) { | 466 std::string* error_desc) { |
466 TRACE_EVENT0("webrtc", "BaseChannel::SetLocalContent"); | 467 TRACE_EVENT0("webrtc", "BaseChannel::SetLocalContent"); |
467 return InvokeOnWorker(RTC_FROM_HERE, Bind(&BaseChannel::SetLocalContent_w, | 468 return InvokeOnWorker<bool>( |
468 this, content, action, error_desc)); | 469 RTC_FROM_HERE, |
| 470 Bind(&BaseChannel::SetLocalContent_w, this, content, action, error_desc)); |
469 } | 471 } |
470 | 472 |
471 bool BaseChannel::SetRemoteContent(const MediaContentDescription* content, | 473 bool BaseChannel::SetRemoteContent(const MediaContentDescription* content, |
472 ContentAction action, | 474 ContentAction action, |
473 std::string* error_desc) { | 475 std::string* error_desc) { |
474 TRACE_EVENT0("webrtc", "BaseChannel::SetRemoteContent"); | 476 TRACE_EVENT0("webrtc", "BaseChannel::SetRemoteContent"); |
475 return InvokeOnWorker(RTC_FROM_HERE, Bind(&BaseChannel::SetRemoteContent_w, | 477 return InvokeOnWorker<bool>( |
476 this, content, action, error_desc)); | 478 RTC_FROM_HERE, Bind(&BaseChannel::SetRemoteContent_w, this, content, |
| 479 action, error_desc)); |
477 } | 480 } |
478 | 481 |
479 void BaseChannel::StartConnectionMonitor(int cms) { | 482 void BaseChannel::StartConnectionMonitor(int cms) { |
480 // We pass in the BaseChannel instead of the rtp_dtls_transport_ | 483 // We pass in the BaseChannel instead of the rtp_dtls_transport_ |
481 // because if the rtp_dtls_transport_ changes, the ConnectionMonitor | 484 // because if the rtp_dtls_transport_ changes, the ConnectionMonitor |
482 // would be pointing to the wrong TransportChannel. | 485 // would be pointing to the wrong TransportChannel. |
483 // We pass in the network thread because on that thread connection monitor | 486 // We pass in the network thread because on that thread connection monitor |
484 // will call BaseChannel::GetConnectionStats which must be called on the | 487 // will call BaseChannel::GetConnectionStats which must be called on the |
485 // network thread. | 488 // network thread. |
486 connection_monitor_.reset( | 489 connection_monitor_.reset( |
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1460 StopMediaMonitor(); | 1463 StopMediaMonitor(); |
1461 // this can't be done in the base class, since it calls a virtual | 1464 // this can't be done in the base class, since it calls a virtual |
1462 DisableMedia_w(); | 1465 DisableMedia_w(); |
1463 Deinit(); | 1466 Deinit(); |
1464 } | 1467 } |
1465 | 1468 |
1466 bool VoiceChannel::SetAudioSend(uint32_t ssrc, | 1469 bool VoiceChannel::SetAudioSend(uint32_t ssrc, |
1467 bool enable, | 1470 bool enable, |
1468 const AudioOptions* options, | 1471 const AudioOptions* options, |
1469 AudioSource* source) { | 1472 AudioSource* source) { |
1470 return InvokeOnWorker(RTC_FROM_HERE, | 1473 return InvokeOnWorker<bool>( |
1471 Bind(&VoiceMediaChannel::SetAudioSend, media_channel(), | 1474 RTC_FROM_HERE, Bind(&VoiceMediaChannel::SetAudioSend, media_channel(), |
1472 ssrc, enable, options, source)); | 1475 ssrc, enable, options, source)); |
1473 } | 1476 } |
1474 | 1477 |
1475 // TODO(juberti): Handle early media the right way. We should get an explicit | 1478 // TODO(juberti): Handle early media the right way. We should get an explicit |
1476 // ringing message telling us to start playing local ringback, which we cancel | 1479 // ringing message telling us to start playing local ringback, which we cancel |
1477 // if any early media actually arrives. For now, we do the opposite, which is | 1480 // if any early media actually arrives. For now, we do the opposite, which is |
1478 // to wait 1 second for early media, and start playing local ringback if none | 1481 // to wait 1 second for early media, and start playing local ringback if none |
1479 // arrives. | 1482 // arrives. |
1480 void VoiceChannel::SetEarlyMedia(bool enable) { | 1483 void VoiceChannel::SetEarlyMedia(bool enable) { |
1481 if (enable) { | 1484 if (enable) { |
1482 // Start the early media timeout | 1485 // Start the early media timeout |
1483 worker_thread()->PostDelayed(RTC_FROM_HERE, kEarlyMediaTimeout, this, | 1486 worker_thread()->PostDelayed(RTC_FROM_HERE, kEarlyMediaTimeout, this, |
1484 MSG_EARLYMEDIATIMEOUT); | 1487 MSG_EARLYMEDIATIMEOUT); |
1485 } else { | 1488 } else { |
1486 // Stop the timeout if currently going. | 1489 // Stop the timeout if currently going. |
1487 worker_thread()->Clear(this, MSG_EARLYMEDIATIMEOUT); | 1490 worker_thread()->Clear(this, MSG_EARLYMEDIATIMEOUT); |
1488 } | 1491 } |
1489 } | 1492 } |
1490 | 1493 |
1491 bool VoiceChannel::CanInsertDtmf() { | 1494 bool VoiceChannel::CanInsertDtmf() { |
1492 return InvokeOnWorker( | 1495 return InvokeOnWorker<bool>( |
1493 RTC_FROM_HERE, Bind(&VoiceMediaChannel::CanInsertDtmf, media_channel())); | 1496 RTC_FROM_HERE, Bind(&VoiceMediaChannel::CanInsertDtmf, media_channel())); |
1494 } | 1497 } |
1495 | 1498 |
1496 bool VoiceChannel::InsertDtmf(uint32_t ssrc, | 1499 bool VoiceChannel::InsertDtmf(uint32_t ssrc, |
1497 int event_code, | 1500 int event_code, |
1498 int duration) { | 1501 int duration) { |
1499 return InvokeOnWorker(RTC_FROM_HERE, Bind(&VoiceChannel::InsertDtmf_w, this, | 1502 return InvokeOnWorker<bool>( |
1500 ssrc, event_code, duration)); | 1503 RTC_FROM_HERE, |
| 1504 Bind(&VoiceChannel::InsertDtmf_w, this, ssrc, event_code, duration)); |
1501 } | 1505 } |
1502 | 1506 |
1503 bool VoiceChannel::SetOutputVolume(uint32_t ssrc, double volume) { | 1507 bool VoiceChannel::SetOutputVolume(uint32_t ssrc, double volume) { |
1504 return InvokeOnWorker(RTC_FROM_HERE, Bind(&VoiceMediaChannel::SetOutputVolume, | 1508 return InvokeOnWorker<bool>( |
1505 media_channel(), ssrc, volume)); | 1509 RTC_FROM_HERE, |
| 1510 Bind(&VoiceMediaChannel::SetOutputVolume, media_channel(), ssrc, volume)); |
1506 } | 1511 } |
1507 | 1512 |
1508 void VoiceChannel::SetRawAudioSink( | 1513 void VoiceChannel::SetRawAudioSink( |
1509 uint32_t ssrc, | 1514 uint32_t ssrc, |
1510 std::unique_ptr<webrtc::AudioSinkInterface> sink) { | 1515 std::unique_ptr<webrtc::AudioSinkInterface> sink) { |
1511 // We need to work around Bind's lack of support for unique_ptr and ownership | 1516 // We need to work around Bind's lack of support for unique_ptr and ownership |
1512 // passing. So we invoke to our own little routine that gets a pointer to | 1517 // passing. So we invoke to our own little routine that gets a pointer to |
1513 // our local variable. This is OK since we're synchronously invoking. | 1518 // our local variable. This is OK since we're synchronously invoking. |
1514 InvokeOnWorker(RTC_FROM_HERE, | 1519 InvokeOnWorker<bool>(RTC_FROM_HERE, |
1515 Bind(&SetRawAudioSink_w, media_channel(), ssrc, &sink)); | 1520 Bind(&SetRawAudioSink_w, media_channel(), ssrc, &sink)); |
1516 } | 1521 } |
1517 | 1522 |
1518 webrtc::RtpParameters VoiceChannel::GetRtpSendParameters(uint32_t ssrc) const { | 1523 webrtc::RtpParameters VoiceChannel::GetRtpSendParameters(uint32_t ssrc) const { |
1519 return worker_thread()->Invoke<webrtc::RtpParameters>( | 1524 return worker_thread()->Invoke<webrtc::RtpParameters>( |
1520 RTC_FROM_HERE, Bind(&VoiceChannel::GetRtpSendParameters_w, this, ssrc)); | 1525 RTC_FROM_HERE, Bind(&VoiceChannel::GetRtpSendParameters_w, this, ssrc)); |
1521 } | 1526 } |
1522 | 1527 |
1523 webrtc::RtpParameters VoiceChannel::GetRtpSendParameters_w( | 1528 webrtc::RtpParameters VoiceChannel::GetRtpSendParameters_w( |
1524 uint32_t ssrc) const { | 1529 uint32_t ssrc) const { |
1525 return media_channel()->GetRtpSendParameters(ssrc); | 1530 return media_channel()->GetRtpSendParameters(ssrc); |
1526 } | 1531 } |
1527 | 1532 |
1528 bool VoiceChannel::SetRtpSendParameters( | 1533 bool VoiceChannel::SetRtpSendParameters( |
1529 uint32_t ssrc, | 1534 uint32_t ssrc, |
1530 const webrtc::RtpParameters& parameters) { | 1535 const webrtc::RtpParameters& parameters) { |
1531 return InvokeOnWorker( | 1536 return InvokeOnWorker<bool>( |
1532 RTC_FROM_HERE, | 1537 RTC_FROM_HERE, |
1533 Bind(&VoiceChannel::SetRtpSendParameters_w, this, ssrc, parameters)); | 1538 Bind(&VoiceChannel::SetRtpSendParameters_w, this, ssrc, parameters)); |
1534 } | 1539 } |
1535 | 1540 |
1536 bool VoiceChannel::SetRtpSendParameters_w(uint32_t ssrc, | 1541 bool VoiceChannel::SetRtpSendParameters_w(uint32_t ssrc, |
1537 webrtc::RtpParameters parameters) { | 1542 webrtc::RtpParameters parameters) { |
1538 return media_channel()->SetRtpSendParameters(ssrc, parameters); | 1543 return media_channel()->SetRtpSendParameters(ssrc, parameters); |
1539 } | 1544 } |
1540 | 1545 |
1541 webrtc::RtpParameters VoiceChannel::GetRtpReceiveParameters( | 1546 webrtc::RtpParameters VoiceChannel::GetRtpReceiveParameters( |
1542 uint32_t ssrc) const { | 1547 uint32_t ssrc) const { |
1543 return worker_thread()->Invoke<webrtc::RtpParameters>( | 1548 return worker_thread()->Invoke<webrtc::RtpParameters>( |
1544 RTC_FROM_HERE, | 1549 RTC_FROM_HERE, |
1545 Bind(&VoiceChannel::GetRtpReceiveParameters_w, this, ssrc)); | 1550 Bind(&VoiceChannel::GetRtpReceiveParameters_w, this, ssrc)); |
1546 } | 1551 } |
1547 | 1552 |
1548 webrtc::RtpParameters VoiceChannel::GetRtpReceiveParameters_w( | 1553 webrtc::RtpParameters VoiceChannel::GetRtpReceiveParameters_w( |
1549 uint32_t ssrc) const { | 1554 uint32_t ssrc) const { |
1550 return media_channel()->GetRtpReceiveParameters(ssrc); | 1555 return media_channel()->GetRtpReceiveParameters(ssrc); |
1551 } | 1556 } |
1552 | 1557 |
1553 bool VoiceChannel::SetRtpReceiveParameters( | 1558 bool VoiceChannel::SetRtpReceiveParameters( |
1554 uint32_t ssrc, | 1559 uint32_t ssrc, |
1555 const webrtc::RtpParameters& parameters) { | 1560 const webrtc::RtpParameters& parameters) { |
1556 return InvokeOnWorker( | 1561 return InvokeOnWorker<bool>( |
1557 RTC_FROM_HERE, | 1562 RTC_FROM_HERE, |
1558 Bind(&VoiceChannel::SetRtpReceiveParameters_w, this, ssrc, parameters)); | 1563 Bind(&VoiceChannel::SetRtpReceiveParameters_w, this, ssrc, parameters)); |
1559 } | 1564 } |
1560 | 1565 |
1561 bool VoiceChannel::SetRtpReceiveParameters_w(uint32_t ssrc, | 1566 bool VoiceChannel::SetRtpReceiveParameters_w(uint32_t ssrc, |
1562 webrtc::RtpParameters parameters) { | 1567 webrtc::RtpParameters parameters) { |
1563 return media_channel()->SetRtpReceiveParameters(ssrc, parameters); | 1568 return media_channel()->SetRtpReceiveParameters(ssrc, parameters); |
1564 } | 1569 } |
1565 | 1570 |
1566 bool VoiceChannel::GetStats(VoiceMediaInfo* stats) { | 1571 bool VoiceChannel::GetStats(VoiceMediaInfo* stats) { |
1567 return InvokeOnWorker(RTC_FROM_HERE, Bind(&VoiceMediaChannel::GetStats, | 1572 return InvokeOnWorker<bool>(RTC_FROM_HERE, Bind(&VoiceMediaChannel::GetStats, |
1568 media_channel(), stats)); | 1573 media_channel(), stats)); |
1569 } | 1574 } |
1570 | 1575 |
1571 std::vector<webrtc::RtpSource> VoiceChannel::GetSources(uint32_t ssrc) const { | 1576 std::vector<webrtc::RtpSource> VoiceChannel::GetSources(uint32_t ssrc) const { |
1572 return worker_thread()->Invoke<std::vector<webrtc::RtpSource>>( | 1577 return worker_thread()->Invoke<std::vector<webrtc::RtpSource>>( |
1573 RTC_FROM_HERE, | 1578 RTC_FROM_HERE, |
1574 Bind(&WebRtcVoiceMediaChannel::GetSources, | 1579 Bind(&WebRtcVoiceMediaChannel::GetSources, |
1575 static_cast<WebRtcVoiceMediaChannel*>(media_channel()), ssrc)); | 1580 static_cast<WebRtcVoiceMediaChannel*>(media_channel()), ssrc)); |
1576 } | 1581 } |
1577 | 1582 |
1578 void VoiceChannel::StartMediaMonitor(int cms) { | 1583 void VoiceChannel::StartMediaMonitor(int cms) { |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1875 RTC_FROM_HERE, | 1880 RTC_FROM_HERE, |
1876 Bind(&VideoMediaChannel::SetSink, media_channel(), ssrc, sink)); | 1881 Bind(&VideoMediaChannel::SetSink, media_channel(), ssrc, sink)); |
1877 return true; | 1882 return true; |
1878 } | 1883 } |
1879 | 1884 |
1880 bool VideoChannel::SetVideoSend( | 1885 bool VideoChannel::SetVideoSend( |
1881 uint32_t ssrc, | 1886 uint32_t ssrc, |
1882 bool mute, | 1887 bool mute, |
1883 const VideoOptions* options, | 1888 const VideoOptions* options, |
1884 rtc::VideoSourceInterface<webrtc::VideoFrame>* source) { | 1889 rtc::VideoSourceInterface<webrtc::VideoFrame>* source) { |
1885 return InvokeOnWorker(RTC_FROM_HERE, | 1890 return InvokeOnWorker<bool>( |
1886 Bind(&VideoMediaChannel::SetVideoSend, media_channel(), | 1891 RTC_FROM_HERE, Bind(&VideoMediaChannel::SetVideoSend, media_channel(), |
1887 ssrc, mute, options, source)); | 1892 ssrc, mute, options, source)); |
1888 } | 1893 } |
1889 | 1894 |
1890 webrtc::RtpParameters VideoChannel::GetRtpSendParameters(uint32_t ssrc) const { | 1895 webrtc::RtpParameters VideoChannel::GetRtpSendParameters(uint32_t ssrc) const { |
1891 return worker_thread()->Invoke<webrtc::RtpParameters>( | 1896 return worker_thread()->Invoke<webrtc::RtpParameters>( |
1892 RTC_FROM_HERE, Bind(&VideoChannel::GetRtpSendParameters_w, this, ssrc)); | 1897 RTC_FROM_HERE, Bind(&VideoChannel::GetRtpSendParameters_w, this, ssrc)); |
1893 } | 1898 } |
1894 | 1899 |
1895 webrtc::RtpParameters VideoChannel::GetRtpSendParameters_w( | 1900 webrtc::RtpParameters VideoChannel::GetRtpSendParameters_w( |
1896 uint32_t ssrc) const { | 1901 uint32_t ssrc) const { |
1897 return media_channel()->GetRtpSendParameters(ssrc); | 1902 return media_channel()->GetRtpSendParameters(ssrc); |
1898 } | 1903 } |
1899 | 1904 |
1900 bool VideoChannel::SetRtpSendParameters( | 1905 bool VideoChannel::SetRtpSendParameters( |
1901 uint32_t ssrc, | 1906 uint32_t ssrc, |
1902 const webrtc::RtpParameters& parameters) { | 1907 const webrtc::RtpParameters& parameters) { |
1903 return InvokeOnWorker( | 1908 return InvokeOnWorker<bool>( |
1904 RTC_FROM_HERE, | 1909 RTC_FROM_HERE, |
1905 Bind(&VideoChannel::SetRtpSendParameters_w, this, ssrc, parameters)); | 1910 Bind(&VideoChannel::SetRtpSendParameters_w, this, ssrc, parameters)); |
1906 } | 1911 } |
1907 | 1912 |
1908 bool VideoChannel::SetRtpSendParameters_w(uint32_t ssrc, | 1913 bool VideoChannel::SetRtpSendParameters_w(uint32_t ssrc, |
1909 webrtc::RtpParameters parameters) { | 1914 webrtc::RtpParameters parameters) { |
1910 return media_channel()->SetRtpSendParameters(ssrc, parameters); | 1915 return media_channel()->SetRtpSendParameters(ssrc, parameters); |
1911 } | 1916 } |
1912 | 1917 |
1913 webrtc::RtpParameters VideoChannel::GetRtpReceiveParameters( | 1918 webrtc::RtpParameters VideoChannel::GetRtpReceiveParameters( |
1914 uint32_t ssrc) const { | 1919 uint32_t ssrc) const { |
1915 return worker_thread()->Invoke<webrtc::RtpParameters>( | 1920 return worker_thread()->Invoke<webrtc::RtpParameters>( |
1916 RTC_FROM_HERE, | 1921 RTC_FROM_HERE, |
1917 Bind(&VideoChannel::GetRtpReceiveParameters_w, this, ssrc)); | 1922 Bind(&VideoChannel::GetRtpReceiveParameters_w, this, ssrc)); |
1918 } | 1923 } |
1919 | 1924 |
1920 webrtc::RtpParameters VideoChannel::GetRtpReceiveParameters_w( | 1925 webrtc::RtpParameters VideoChannel::GetRtpReceiveParameters_w( |
1921 uint32_t ssrc) const { | 1926 uint32_t ssrc) const { |
1922 return media_channel()->GetRtpReceiveParameters(ssrc); | 1927 return media_channel()->GetRtpReceiveParameters(ssrc); |
1923 } | 1928 } |
1924 | 1929 |
1925 bool VideoChannel::SetRtpReceiveParameters( | 1930 bool VideoChannel::SetRtpReceiveParameters( |
1926 uint32_t ssrc, | 1931 uint32_t ssrc, |
1927 const webrtc::RtpParameters& parameters) { | 1932 const webrtc::RtpParameters& parameters) { |
1928 return InvokeOnWorker( | 1933 return InvokeOnWorker<bool>( |
1929 RTC_FROM_HERE, | 1934 RTC_FROM_HERE, |
1930 Bind(&VideoChannel::SetRtpReceiveParameters_w, this, ssrc, parameters)); | 1935 Bind(&VideoChannel::SetRtpReceiveParameters_w, this, ssrc, parameters)); |
1931 } | 1936 } |
1932 | 1937 |
1933 bool VideoChannel::SetRtpReceiveParameters_w(uint32_t ssrc, | 1938 bool VideoChannel::SetRtpReceiveParameters_w(uint32_t ssrc, |
1934 webrtc::RtpParameters parameters) { | 1939 webrtc::RtpParameters parameters) { |
1935 return media_channel()->SetRtpReceiveParameters(ssrc, parameters); | 1940 return media_channel()->SetRtpReceiveParameters(ssrc, parameters); |
1936 } | 1941 } |
1937 | 1942 |
1938 void VideoChannel::UpdateMediaSendRecvState_w() { | 1943 void VideoChannel::UpdateMediaSendRecvState_w() { |
1939 // Send outgoing data if we're the active call, we have the remote content, | 1944 // Send outgoing data if we're the active call, we have the remote content, |
1940 // and we have had some form of connectivity. | 1945 // and we have had some form of connectivity. |
1941 bool send = IsReadyToSendMedia_w(); | 1946 bool send = IsReadyToSendMedia_w(); |
1942 if (!media_channel()->SetSend(send)) { | 1947 if (!media_channel()->SetSend(send)) { |
1943 LOG(LS_ERROR) << "Failed to SetSend on video channel"; | 1948 LOG(LS_ERROR) << "Failed to SetSend on video channel"; |
1944 // TODO(gangji): Report error back to server. | 1949 // TODO(gangji): Report error back to server. |
1945 } | 1950 } |
1946 | 1951 |
1947 LOG(LS_INFO) << "Changing video state, send=" << send; | 1952 LOG(LS_INFO) << "Changing video state, send=" << send; |
1948 } | 1953 } |
1949 | 1954 |
| 1955 void VideoChannel::FillBitrateInfo(BandwidthEstimationInfo* bwe_info) { |
| 1956 InvokeOnWorker<void>(RTC_FROM_HERE, Bind(&VideoMediaChannel::FillBitrateInfo, |
| 1957 media_channel(), bwe_info)); |
| 1958 } |
| 1959 |
1950 bool VideoChannel::GetStats(VideoMediaInfo* stats) { | 1960 bool VideoChannel::GetStats(VideoMediaInfo* stats) { |
1951 return InvokeOnWorker(RTC_FROM_HERE, Bind(&VideoMediaChannel::GetStats, | 1961 return InvokeOnWorker<bool>(RTC_FROM_HERE, Bind(&VideoMediaChannel::GetStats, |
1952 media_channel(), stats)); | 1962 media_channel(), stats)); |
1953 } | 1963 } |
1954 | 1964 |
1955 void VideoChannel::StartMediaMonitor(int cms) { | 1965 void VideoChannel::StartMediaMonitor(int cms) { |
1956 media_monitor_.reset(new VideoMediaMonitor(media_channel(), worker_thread(), | 1966 media_monitor_.reset(new VideoMediaMonitor(media_channel(), worker_thread(), |
1957 rtc::Thread::Current())); | 1967 rtc::Thread::Current())); |
1958 media_monitor_->SignalUpdate.connect( | 1968 media_monitor_->SignalUpdate.connect( |
1959 this, &VideoChannel::OnMediaMonitorUpdate); | 1969 this, &VideoChannel::OnMediaMonitorUpdate); |
1960 media_monitor_->Start(cms); | 1970 media_monitor_->Start(cms); |
1961 } | 1971 } |
1962 | 1972 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2132 media_channel()->SignalDataReceived.connect(this, | 2142 media_channel()->SignalDataReceived.connect(this, |
2133 &RtpDataChannel::OnDataReceived); | 2143 &RtpDataChannel::OnDataReceived); |
2134 media_channel()->SignalReadyToSend.connect( | 2144 media_channel()->SignalReadyToSend.connect( |
2135 this, &RtpDataChannel::OnDataChannelReadyToSend); | 2145 this, &RtpDataChannel::OnDataChannelReadyToSend); |
2136 return true; | 2146 return true; |
2137 } | 2147 } |
2138 | 2148 |
2139 bool RtpDataChannel::SendData(const SendDataParams& params, | 2149 bool RtpDataChannel::SendData(const SendDataParams& params, |
2140 const rtc::CopyOnWriteBuffer& payload, | 2150 const rtc::CopyOnWriteBuffer& payload, |
2141 SendDataResult* result) { | 2151 SendDataResult* result) { |
2142 return InvokeOnWorker( | 2152 return InvokeOnWorker<bool>( |
2143 RTC_FROM_HERE, Bind(&DataMediaChannel::SendData, media_channel(), params, | 2153 RTC_FROM_HERE, Bind(&DataMediaChannel::SendData, media_channel(), params, |
2144 payload, result)); | 2154 payload, result)); |
2145 } | 2155 } |
2146 | 2156 |
2147 const ContentInfo* RtpDataChannel::GetFirstContent( | 2157 const ContentInfo* RtpDataChannel::GetFirstContent( |
2148 const SessionDescription* sdesc) { | 2158 const SessionDescription* sdesc) { |
2149 return GetFirstDataContent(sdesc); | 2159 return GetFirstDataContent(sdesc); |
2150 } | 2160 } |
2151 | 2161 |
2152 bool RtpDataChannel::CheckDataChannelTypeFromContent( | 2162 bool RtpDataChannel::CheckDataChannelTypeFromContent( |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2360 | 2370 |
2361 void RtpDataChannel::OnDataChannelReadyToSend(bool writable) { | 2371 void RtpDataChannel::OnDataChannelReadyToSend(bool writable) { |
2362 // This is usded for congestion control to indicate that the stream is ready | 2372 // This is usded for congestion control to indicate that the stream is ready |
2363 // to send by the MediaChannel, as opposed to OnReadyToSend, which indicates | 2373 // to send by the MediaChannel, as opposed to OnReadyToSend, which indicates |
2364 // that the transport channel is ready. | 2374 // that the transport channel is ready. |
2365 signaling_thread()->Post(RTC_FROM_HERE, this, MSG_READYTOSENDDATA, | 2375 signaling_thread()->Post(RTC_FROM_HERE, this, MSG_READYTOSENDDATA, |
2366 new DataChannelReadyToSendMessageData(writable)); | 2376 new DataChannelReadyToSendMessageData(writable)); |
2367 } | 2377 } |
2368 | 2378 |
2369 } // namespace cricket | 2379 } // namespace cricket |
OLD | NEW |