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