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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 | 436 |
437 bool BaseChannel::Enable(bool enable) { | 437 bool BaseChannel::Enable(bool enable) { |
438 worker_thread_->Invoke<void>( | 438 worker_thread_->Invoke<void>( |
439 RTC_FROM_HERE, | 439 RTC_FROM_HERE, |
440 Bind(enable ? &BaseChannel::EnableMedia_w : &BaseChannel::DisableMedia_w, | 440 Bind(enable ? &BaseChannel::EnableMedia_w : &BaseChannel::DisableMedia_w, |
441 this)); | 441 this)); |
442 return true; | 442 return true; |
443 } | 443 } |
444 | 444 |
445 bool BaseChannel::AddRecvStream(const StreamParams& sp) { | 445 bool BaseChannel::AddRecvStream(const StreamParams& sp) { |
446 return InvokeOnWorker<bool>(RTC_FROM_HERE, | 446 return InvokeOnWorker(RTC_FROM_HERE, |
447 Bind(&BaseChannel::AddRecvStream_w, this, sp)); | 447 Bind(&BaseChannel::AddRecvStream_w, this, sp)); |
448 } | 448 } |
449 | 449 |
450 bool BaseChannel::RemoveRecvStream(uint32_t ssrc) { | 450 bool BaseChannel::RemoveRecvStream(uint32_t ssrc) { |
451 return InvokeOnWorker<bool>( | 451 return InvokeOnWorker(RTC_FROM_HERE, |
452 RTC_FROM_HERE, Bind(&BaseChannel::RemoveRecvStream_w, this, ssrc)); | 452 Bind(&BaseChannel::RemoveRecvStream_w, this, ssrc)); |
453 } | 453 } |
454 | 454 |
455 bool BaseChannel::AddSendStream(const StreamParams& sp) { | 455 bool BaseChannel::AddSendStream(const StreamParams& sp) { |
456 return InvokeOnWorker<bool>( | 456 return InvokeOnWorker( |
457 RTC_FROM_HERE, Bind(&MediaChannel::AddSendStream, media_channel(), sp)); | 457 RTC_FROM_HERE, Bind(&MediaChannel::AddSendStream, media_channel(), sp)); |
458 } | 458 } |
459 | 459 |
460 bool BaseChannel::RemoveSendStream(uint32_t ssrc) { | 460 bool BaseChannel::RemoveSendStream(uint32_t ssrc) { |
461 return InvokeOnWorker<bool>( | 461 return InvokeOnWorker(RTC_FROM_HERE, Bind(&MediaChannel::RemoveSendStream, |
462 RTC_FROM_HERE, | 462 media_channel(), ssrc)); |
463 Bind(&MediaChannel::RemoveSendStream, media_channel(), ssrc)); | |
464 } | 463 } |
465 | 464 |
466 bool BaseChannel::SetLocalContent(const MediaContentDescription* content, | 465 bool BaseChannel::SetLocalContent(const MediaContentDescription* content, |
467 ContentAction action, | 466 ContentAction action, |
468 std::string* error_desc) { | 467 std::string* error_desc) { |
469 TRACE_EVENT0("webrtc", "BaseChannel::SetLocalContent"); | 468 TRACE_EVENT0("webrtc", "BaseChannel::SetLocalContent"); |
470 return InvokeOnWorker<bool>( | 469 return InvokeOnWorker(RTC_FROM_HERE, Bind(&BaseChannel::SetLocalContent_w, |
471 RTC_FROM_HERE, | 470 this, content, action, error_desc)); |
472 Bind(&BaseChannel::SetLocalContent_w, this, content, action, error_desc)); | |
473 } | 471 } |
474 | 472 |
475 bool BaseChannel::SetRemoteContent(const MediaContentDescription* content, | 473 bool BaseChannel::SetRemoteContent(const MediaContentDescription* content, |
476 ContentAction action, | 474 ContentAction action, |
477 std::string* error_desc) { | 475 std::string* error_desc) { |
478 TRACE_EVENT0("webrtc", "BaseChannel::SetRemoteContent"); | 476 TRACE_EVENT0("webrtc", "BaseChannel::SetRemoteContent"); |
479 return InvokeOnWorker<bool>( | 477 return InvokeOnWorker(RTC_FROM_HERE, Bind(&BaseChannel::SetRemoteContent_w, |
480 RTC_FROM_HERE, Bind(&BaseChannel::SetRemoteContent_w, this, content, | 478 this, content, action, error_desc)); |
481 action, error_desc)); | |
482 } | 479 } |
483 | 480 |
484 void BaseChannel::StartConnectionMonitor(int cms) { | 481 void BaseChannel::StartConnectionMonitor(int cms) { |
485 // We pass in the BaseChannel instead of the rtp_dtls_transport_ | 482 // We pass in the BaseChannel instead of the rtp_dtls_transport_ |
486 // because if the rtp_dtls_transport_ changes, the ConnectionMonitor | 483 // because if the rtp_dtls_transport_ changes, the ConnectionMonitor |
487 // would be pointing to the wrong TransportChannel. | 484 // would be pointing to the wrong TransportChannel. |
488 // We pass in the network thread because on that thread connection monitor | 485 // We pass in the network thread because on that thread connection monitor |
489 // will call BaseChannel::GetConnectionStats which must be called on the | 486 // will call BaseChannel::GetConnectionStats which must be called on the |
490 // network thread. | 487 // network thread. |
491 connection_monitor_.reset( | 488 connection_monitor_.reset( |
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1501 StopMediaMonitor(); | 1498 StopMediaMonitor(); |
1502 // this can't be done in the base class, since it calls a virtual | 1499 // this can't be done in the base class, since it calls a virtual |
1503 DisableMedia_w(); | 1500 DisableMedia_w(); |
1504 Deinit(); | 1501 Deinit(); |
1505 } | 1502 } |
1506 | 1503 |
1507 bool VoiceChannel::SetAudioSend(uint32_t ssrc, | 1504 bool VoiceChannel::SetAudioSend(uint32_t ssrc, |
1508 bool enable, | 1505 bool enable, |
1509 const AudioOptions* options, | 1506 const AudioOptions* options, |
1510 AudioSource* source) { | 1507 AudioSource* source) { |
1511 return InvokeOnWorker<bool>( | 1508 return InvokeOnWorker(RTC_FROM_HERE, |
1512 RTC_FROM_HERE, Bind(&VoiceMediaChannel::SetAudioSend, media_channel(), | 1509 Bind(&VoiceMediaChannel::SetAudioSend, media_channel(), |
1513 ssrc, enable, options, source)); | 1510 ssrc, enable, options, source)); |
1514 } | 1511 } |
1515 | 1512 |
1516 // TODO(juberti): Handle early media the right way. We should get an explicit | 1513 // TODO(juberti): Handle early media the right way. We should get an explicit |
1517 // ringing message telling us to start playing local ringback, which we cancel | 1514 // ringing message telling us to start playing local ringback, which we cancel |
1518 // if any early media actually arrives. For now, we do the opposite, which is | 1515 // if any early media actually arrives. For now, we do the opposite, which is |
1519 // to wait 1 second for early media, and start playing local ringback if none | 1516 // to wait 1 second for early media, and start playing local ringback if none |
1520 // arrives. | 1517 // arrives. |
1521 void VoiceChannel::SetEarlyMedia(bool enable) { | 1518 void VoiceChannel::SetEarlyMedia(bool enable) { |
1522 if (enable) { | 1519 if (enable) { |
1523 // Start the early media timeout | 1520 // Start the early media timeout |
1524 worker_thread()->PostDelayed(RTC_FROM_HERE, kEarlyMediaTimeout, this, | 1521 worker_thread()->PostDelayed(RTC_FROM_HERE, kEarlyMediaTimeout, this, |
1525 MSG_EARLYMEDIATIMEOUT); | 1522 MSG_EARLYMEDIATIMEOUT); |
1526 } else { | 1523 } else { |
1527 // Stop the timeout if currently going. | 1524 // Stop the timeout if currently going. |
1528 worker_thread()->Clear(this, MSG_EARLYMEDIATIMEOUT); | 1525 worker_thread()->Clear(this, MSG_EARLYMEDIATIMEOUT); |
1529 } | 1526 } |
1530 } | 1527 } |
1531 | 1528 |
1532 bool VoiceChannel::CanInsertDtmf() { | 1529 bool VoiceChannel::CanInsertDtmf() { |
1533 return InvokeOnWorker<bool>( | 1530 return InvokeOnWorker( |
1534 RTC_FROM_HERE, Bind(&VoiceMediaChannel::CanInsertDtmf, media_channel())); | 1531 RTC_FROM_HERE, Bind(&VoiceMediaChannel::CanInsertDtmf, media_channel())); |
1535 } | 1532 } |
1536 | 1533 |
1537 bool VoiceChannel::InsertDtmf(uint32_t ssrc, | 1534 bool VoiceChannel::InsertDtmf(uint32_t ssrc, |
1538 int event_code, | 1535 int event_code, |
1539 int duration) { | 1536 int duration) { |
1540 return InvokeOnWorker<bool>( | 1537 return InvokeOnWorker(RTC_FROM_HERE, Bind(&VoiceChannel::InsertDtmf_w, this, |
1541 RTC_FROM_HERE, | 1538 ssrc, event_code, duration)); |
1542 Bind(&VoiceChannel::InsertDtmf_w, this, ssrc, event_code, duration)); | |
1543 } | 1539 } |
1544 | 1540 |
1545 bool VoiceChannel::SetOutputVolume(uint32_t ssrc, double volume) { | 1541 bool VoiceChannel::SetOutputVolume(uint32_t ssrc, double volume) { |
1546 return InvokeOnWorker<bool>( | 1542 return InvokeOnWorker(RTC_FROM_HERE, Bind(&VoiceMediaChannel::SetOutputVolume, |
1547 RTC_FROM_HERE, | 1543 media_channel(), ssrc, volume)); |
1548 Bind(&VoiceMediaChannel::SetOutputVolume, media_channel(), ssrc, volume)); | |
1549 } | 1544 } |
1550 | 1545 |
1551 void VoiceChannel::SetRawAudioSink( | 1546 void VoiceChannel::SetRawAudioSink( |
1552 uint32_t ssrc, | 1547 uint32_t ssrc, |
1553 std::unique_ptr<webrtc::AudioSinkInterface> sink) { | 1548 std::unique_ptr<webrtc::AudioSinkInterface> sink) { |
1554 // We need to work around Bind's lack of support for unique_ptr and ownership | 1549 // We need to work around Bind's lack of support for unique_ptr and ownership |
1555 // passing. So we invoke to our own little routine that gets a pointer to | 1550 // passing. So we invoke to our own little routine that gets a pointer to |
1556 // our local variable. This is OK since we're synchronously invoking. | 1551 // our local variable. This is OK since we're synchronously invoking. |
1557 InvokeOnWorker<bool>(RTC_FROM_HERE, | 1552 InvokeOnWorker(RTC_FROM_HERE, |
1558 Bind(&SetRawAudioSink_w, media_channel(), ssrc, &sink)); | 1553 Bind(&SetRawAudioSink_w, media_channel(), ssrc, &sink)); |
1559 } | 1554 } |
1560 | 1555 |
1561 webrtc::RtpParameters VoiceChannel::GetRtpSendParameters(uint32_t ssrc) const { | 1556 webrtc::RtpParameters VoiceChannel::GetRtpSendParameters(uint32_t ssrc) const { |
1562 return worker_thread()->Invoke<webrtc::RtpParameters>( | 1557 return worker_thread()->Invoke<webrtc::RtpParameters>( |
1563 RTC_FROM_HERE, Bind(&VoiceChannel::GetRtpSendParameters_w, this, ssrc)); | 1558 RTC_FROM_HERE, Bind(&VoiceChannel::GetRtpSendParameters_w, this, ssrc)); |
1564 } | 1559 } |
1565 | 1560 |
1566 webrtc::RtpParameters VoiceChannel::GetRtpSendParameters_w( | 1561 webrtc::RtpParameters VoiceChannel::GetRtpSendParameters_w( |
1567 uint32_t ssrc) const { | 1562 uint32_t ssrc) const { |
1568 return media_channel()->GetRtpSendParameters(ssrc); | 1563 return media_channel()->GetRtpSendParameters(ssrc); |
1569 } | 1564 } |
1570 | 1565 |
1571 bool VoiceChannel::SetRtpSendParameters( | 1566 bool VoiceChannel::SetRtpSendParameters( |
1572 uint32_t ssrc, | 1567 uint32_t ssrc, |
1573 const webrtc::RtpParameters& parameters) { | 1568 const webrtc::RtpParameters& parameters) { |
1574 return InvokeOnWorker<bool>( | 1569 return InvokeOnWorker( |
1575 RTC_FROM_HERE, | 1570 RTC_FROM_HERE, |
1576 Bind(&VoiceChannel::SetRtpSendParameters_w, this, ssrc, parameters)); | 1571 Bind(&VoiceChannel::SetRtpSendParameters_w, this, ssrc, parameters)); |
1577 } | 1572 } |
1578 | 1573 |
1579 bool VoiceChannel::SetRtpSendParameters_w(uint32_t ssrc, | 1574 bool VoiceChannel::SetRtpSendParameters_w(uint32_t ssrc, |
1580 webrtc::RtpParameters parameters) { | 1575 webrtc::RtpParameters parameters) { |
1581 return media_channel()->SetRtpSendParameters(ssrc, parameters); | 1576 return media_channel()->SetRtpSendParameters(ssrc, parameters); |
1582 } | 1577 } |
1583 | 1578 |
1584 webrtc::RtpParameters VoiceChannel::GetRtpReceiveParameters( | 1579 webrtc::RtpParameters VoiceChannel::GetRtpReceiveParameters( |
1585 uint32_t ssrc) const { | 1580 uint32_t ssrc) const { |
1586 return worker_thread()->Invoke<webrtc::RtpParameters>( | 1581 return worker_thread()->Invoke<webrtc::RtpParameters>( |
1587 RTC_FROM_HERE, | 1582 RTC_FROM_HERE, |
1588 Bind(&VoiceChannel::GetRtpReceiveParameters_w, this, ssrc)); | 1583 Bind(&VoiceChannel::GetRtpReceiveParameters_w, this, ssrc)); |
1589 } | 1584 } |
1590 | 1585 |
1591 webrtc::RtpParameters VoiceChannel::GetRtpReceiveParameters_w( | 1586 webrtc::RtpParameters VoiceChannel::GetRtpReceiveParameters_w( |
1592 uint32_t ssrc) const { | 1587 uint32_t ssrc) const { |
1593 return media_channel()->GetRtpReceiveParameters(ssrc); | 1588 return media_channel()->GetRtpReceiveParameters(ssrc); |
1594 } | 1589 } |
1595 | 1590 |
1596 bool VoiceChannel::SetRtpReceiveParameters( | 1591 bool VoiceChannel::SetRtpReceiveParameters( |
1597 uint32_t ssrc, | 1592 uint32_t ssrc, |
1598 const webrtc::RtpParameters& parameters) { | 1593 const webrtc::RtpParameters& parameters) { |
1599 return InvokeOnWorker<bool>( | 1594 return InvokeOnWorker( |
1600 RTC_FROM_HERE, | 1595 RTC_FROM_HERE, |
1601 Bind(&VoiceChannel::SetRtpReceiveParameters_w, this, ssrc, parameters)); | 1596 Bind(&VoiceChannel::SetRtpReceiveParameters_w, this, ssrc, parameters)); |
1602 } | 1597 } |
1603 | 1598 |
1604 bool VoiceChannel::SetRtpReceiveParameters_w(uint32_t ssrc, | 1599 bool VoiceChannel::SetRtpReceiveParameters_w(uint32_t ssrc, |
1605 webrtc::RtpParameters parameters) { | 1600 webrtc::RtpParameters parameters) { |
1606 return media_channel()->SetRtpReceiveParameters(ssrc, parameters); | 1601 return media_channel()->SetRtpReceiveParameters(ssrc, parameters); |
1607 } | 1602 } |
1608 | 1603 |
1609 bool VoiceChannel::GetStats(VoiceMediaInfo* stats) { | 1604 bool VoiceChannel::GetStats(VoiceMediaInfo* stats) { |
1610 return InvokeOnWorker<bool>(RTC_FROM_HERE, Bind(&VoiceMediaChannel::GetStats, | 1605 return InvokeOnWorker(RTC_FROM_HERE, Bind(&VoiceMediaChannel::GetStats, |
1611 media_channel(), stats)); | 1606 media_channel(), stats)); |
1612 } | 1607 } |
1613 | 1608 |
1614 std::vector<webrtc::RtpSource> VoiceChannel::GetSources(uint32_t ssrc) const { | 1609 std::vector<webrtc::RtpSource> VoiceChannel::GetSources(uint32_t ssrc) const { |
1615 return worker_thread()->Invoke<std::vector<webrtc::RtpSource>>( | 1610 return worker_thread()->Invoke<std::vector<webrtc::RtpSource>>( |
1616 RTC_FROM_HERE, | 1611 RTC_FROM_HERE, |
1617 Bind(&WebRtcVoiceMediaChannel::GetSources, | 1612 Bind(&WebRtcVoiceMediaChannel::GetSources, |
1618 static_cast<WebRtcVoiceMediaChannel*>(media_channel()), ssrc)); | 1613 static_cast<WebRtcVoiceMediaChannel*>(media_channel()), ssrc)); |
1619 } | 1614 } |
1620 | 1615 |
1621 void VoiceChannel::StartMediaMonitor(int cms) { | 1616 void VoiceChannel::StartMediaMonitor(int cms) { |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1920 RTC_FROM_HERE, | 1915 RTC_FROM_HERE, |
1921 Bind(&VideoMediaChannel::SetSink, media_channel(), ssrc, sink)); | 1916 Bind(&VideoMediaChannel::SetSink, media_channel(), ssrc, sink)); |
1922 return true; | 1917 return true; |
1923 } | 1918 } |
1924 | 1919 |
1925 bool VideoChannel::SetVideoSend( | 1920 bool VideoChannel::SetVideoSend( |
1926 uint32_t ssrc, | 1921 uint32_t ssrc, |
1927 bool mute, | 1922 bool mute, |
1928 const VideoOptions* options, | 1923 const VideoOptions* options, |
1929 rtc::VideoSourceInterface<webrtc::VideoFrame>* source) { | 1924 rtc::VideoSourceInterface<webrtc::VideoFrame>* source) { |
1930 return InvokeOnWorker<bool>( | 1925 return InvokeOnWorker(RTC_FROM_HERE, |
1931 RTC_FROM_HERE, Bind(&VideoMediaChannel::SetVideoSend, media_channel(), | 1926 Bind(&VideoMediaChannel::SetVideoSend, media_channel(), |
1932 ssrc, mute, options, source)); | 1927 ssrc, mute, options, source)); |
1933 } | 1928 } |
1934 | 1929 |
1935 webrtc::RtpParameters VideoChannel::GetRtpSendParameters(uint32_t ssrc) const { | 1930 webrtc::RtpParameters VideoChannel::GetRtpSendParameters(uint32_t ssrc) const { |
1936 return worker_thread()->Invoke<webrtc::RtpParameters>( | 1931 return worker_thread()->Invoke<webrtc::RtpParameters>( |
1937 RTC_FROM_HERE, Bind(&VideoChannel::GetRtpSendParameters_w, this, ssrc)); | 1932 RTC_FROM_HERE, Bind(&VideoChannel::GetRtpSendParameters_w, this, ssrc)); |
1938 } | 1933 } |
1939 | 1934 |
1940 webrtc::RtpParameters VideoChannel::GetRtpSendParameters_w( | 1935 webrtc::RtpParameters VideoChannel::GetRtpSendParameters_w( |
1941 uint32_t ssrc) const { | 1936 uint32_t ssrc) const { |
1942 return media_channel()->GetRtpSendParameters(ssrc); | 1937 return media_channel()->GetRtpSendParameters(ssrc); |
1943 } | 1938 } |
1944 | 1939 |
1945 bool VideoChannel::SetRtpSendParameters( | 1940 bool VideoChannel::SetRtpSendParameters( |
1946 uint32_t ssrc, | 1941 uint32_t ssrc, |
1947 const webrtc::RtpParameters& parameters) { | 1942 const webrtc::RtpParameters& parameters) { |
1948 return InvokeOnWorker<bool>( | 1943 return InvokeOnWorker( |
1949 RTC_FROM_HERE, | 1944 RTC_FROM_HERE, |
1950 Bind(&VideoChannel::SetRtpSendParameters_w, this, ssrc, parameters)); | 1945 Bind(&VideoChannel::SetRtpSendParameters_w, this, ssrc, parameters)); |
1951 } | 1946 } |
1952 | 1947 |
1953 bool VideoChannel::SetRtpSendParameters_w(uint32_t ssrc, | 1948 bool VideoChannel::SetRtpSendParameters_w(uint32_t ssrc, |
1954 webrtc::RtpParameters parameters) { | 1949 webrtc::RtpParameters parameters) { |
1955 return media_channel()->SetRtpSendParameters(ssrc, parameters); | 1950 return media_channel()->SetRtpSendParameters(ssrc, parameters); |
1956 } | 1951 } |
1957 | 1952 |
1958 webrtc::RtpParameters VideoChannel::GetRtpReceiveParameters( | 1953 webrtc::RtpParameters VideoChannel::GetRtpReceiveParameters( |
1959 uint32_t ssrc) const { | 1954 uint32_t ssrc) const { |
1960 return worker_thread()->Invoke<webrtc::RtpParameters>( | 1955 return worker_thread()->Invoke<webrtc::RtpParameters>( |
1961 RTC_FROM_HERE, | 1956 RTC_FROM_HERE, |
1962 Bind(&VideoChannel::GetRtpReceiveParameters_w, this, ssrc)); | 1957 Bind(&VideoChannel::GetRtpReceiveParameters_w, this, ssrc)); |
1963 } | 1958 } |
1964 | 1959 |
1965 webrtc::RtpParameters VideoChannel::GetRtpReceiveParameters_w( | 1960 webrtc::RtpParameters VideoChannel::GetRtpReceiveParameters_w( |
1966 uint32_t ssrc) const { | 1961 uint32_t ssrc) const { |
1967 return media_channel()->GetRtpReceiveParameters(ssrc); | 1962 return media_channel()->GetRtpReceiveParameters(ssrc); |
1968 } | 1963 } |
1969 | 1964 |
1970 bool VideoChannel::SetRtpReceiveParameters( | 1965 bool VideoChannel::SetRtpReceiveParameters( |
1971 uint32_t ssrc, | 1966 uint32_t ssrc, |
1972 const webrtc::RtpParameters& parameters) { | 1967 const webrtc::RtpParameters& parameters) { |
1973 return InvokeOnWorker<bool>( | 1968 return InvokeOnWorker( |
1974 RTC_FROM_HERE, | 1969 RTC_FROM_HERE, |
1975 Bind(&VideoChannel::SetRtpReceiveParameters_w, this, ssrc, parameters)); | 1970 Bind(&VideoChannel::SetRtpReceiveParameters_w, this, ssrc, parameters)); |
1976 } | 1971 } |
1977 | 1972 |
1978 bool VideoChannel::SetRtpReceiveParameters_w(uint32_t ssrc, | 1973 bool VideoChannel::SetRtpReceiveParameters_w(uint32_t ssrc, |
1979 webrtc::RtpParameters parameters) { | 1974 webrtc::RtpParameters parameters) { |
1980 return media_channel()->SetRtpReceiveParameters(ssrc, parameters); | 1975 return media_channel()->SetRtpReceiveParameters(ssrc, parameters); |
1981 } | 1976 } |
1982 | 1977 |
1983 void VideoChannel::UpdateMediaSendRecvState_w() { | 1978 void VideoChannel::UpdateMediaSendRecvState_w() { |
1984 // Send outgoing data if we're the active call, we have the remote content, | 1979 // Send outgoing data if we're the active call, we have the remote content, |
1985 // and we have had some form of connectivity. | 1980 // and we have had some form of connectivity. |
1986 bool send = IsReadyToSendMedia_w(); | 1981 bool send = IsReadyToSendMedia_w(); |
1987 if (!media_channel()->SetSend(send)) { | 1982 if (!media_channel()->SetSend(send)) { |
1988 LOG(LS_ERROR) << "Failed to SetSend on video channel"; | 1983 LOG(LS_ERROR) << "Failed to SetSend on video channel"; |
1989 // TODO(gangji): Report error back to server. | 1984 // TODO(gangji): Report error back to server. |
1990 } | 1985 } |
1991 | 1986 |
1992 LOG(LS_INFO) << "Changing video state, send=" << send; | 1987 LOG(LS_INFO) << "Changing video state, send=" << send; |
1993 } | 1988 } |
1994 | 1989 |
1995 void VideoChannel::FillBitrateInfo(BandwidthEstimationInfo* bwe_info) { | |
1996 InvokeOnWorker<void>(RTC_FROM_HERE, Bind(&VideoMediaChannel::FillBitrateInfo, | |
1997 media_channel(), bwe_info)); | |
1998 } | |
1999 | |
2000 bool VideoChannel::GetStats(VideoMediaInfo* stats) { | 1990 bool VideoChannel::GetStats(VideoMediaInfo* stats) { |
2001 return InvokeOnWorker<bool>(RTC_FROM_HERE, Bind(&VideoMediaChannel::GetStats, | 1991 return InvokeOnWorker(RTC_FROM_HERE, Bind(&VideoMediaChannel::GetStats, |
2002 media_channel(), stats)); | 1992 media_channel(), stats)); |
2003 } | 1993 } |
2004 | 1994 |
2005 void VideoChannel::StartMediaMonitor(int cms) { | 1995 void VideoChannel::StartMediaMonitor(int cms) { |
2006 media_monitor_.reset(new VideoMediaMonitor(media_channel(), worker_thread(), | 1996 media_monitor_.reset(new VideoMediaMonitor(media_channel(), worker_thread(), |
2007 rtc::Thread::Current())); | 1997 rtc::Thread::Current())); |
2008 media_monitor_->SignalUpdate.connect( | 1998 media_monitor_->SignalUpdate.connect( |
2009 this, &VideoChannel::OnMediaMonitorUpdate); | 1999 this, &VideoChannel::OnMediaMonitorUpdate); |
2010 media_monitor_->Start(cms); | 2000 media_monitor_->Start(cms); |
2011 } | 2001 } |
2012 | 2002 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2182 media_channel()->SignalDataReceived.connect(this, | 2172 media_channel()->SignalDataReceived.connect(this, |
2183 &RtpDataChannel::OnDataReceived); | 2173 &RtpDataChannel::OnDataReceived); |
2184 media_channel()->SignalReadyToSend.connect( | 2174 media_channel()->SignalReadyToSend.connect( |
2185 this, &RtpDataChannel::OnDataChannelReadyToSend); | 2175 this, &RtpDataChannel::OnDataChannelReadyToSend); |
2186 return true; | 2176 return true; |
2187 } | 2177 } |
2188 | 2178 |
2189 bool RtpDataChannel::SendData(const SendDataParams& params, | 2179 bool RtpDataChannel::SendData(const SendDataParams& params, |
2190 const rtc::CopyOnWriteBuffer& payload, | 2180 const rtc::CopyOnWriteBuffer& payload, |
2191 SendDataResult* result) { | 2181 SendDataResult* result) { |
2192 return InvokeOnWorker<bool>( | 2182 return InvokeOnWorker( |
2193 RTC_FROM_HERE, Bind(&DataMediaChannel::SendData, media_channel(), params, | 2183 RTC_FROM_HERE, Bind(&DataMediaChannel::SendData, media_channel(), params, |
2194 payload, result)); | 2184 payload, result)); |
2195 } | 2185 } |
2196 | 2186 |
2197 const ContentInfo* RtpDataChannel::GetFirstContent( | 2187 const ContentInfo* RtpDataChannel::GetFirstContent( |
2198 const SessionDescription* sdesc) { | 2188 const SessionDescription* sdesc) { |
2199 return GetFirstDataContent(sdesc); | 2189 return GetFirstDataContent(sdesc); |
2200 } | 2190 } |
2201 | 2191 |
2202 bool RtpDataChannel::CheckDataChannelTypeFromContent( | 2192 bool RtpDataChannel::CheckDataChannelTypeFromContent( |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2410 | 2400 |
2411 void RtpDataChannel::OnDataChannelReadyToSend(bool writable) { | 2401 void RtpDataChannel::OnDataChannelReadyToSend(bool writable) { |
2412 // This is usded for congestion control to indicate that the stream is ready | 2402 // This is usded for congestion control to indicate that the stream is ready |
2413 // to send by the MediaChannel, as opposed to OnReadyToSend, which indicates | 2403 // to send by the MediaChannel, as opposed to OnReadyToSend, which indicates |
2414 // that the transport channel is ready. | 2404 // that the transport channel is ready. |
2415 signaling_thread()->Post(RTC_FROM_HERE, this, MSG_READYTOSENDDATA, | 2405 signaling_thread()->Post(RTC_FROM_HERE, this, MSG_READYTOSENDDATA, |
2416 new DataChannelReadyToSendMessageData(writable)); | 2406 new DataChannelReadyToSendMessageData(writable)); |
2417 } | 2407 } |
2418 | 2408 |
2419 } // namespace cricket | 2409 } // namespace cricket |
OLD | NEW |