OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 1667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1678 | 1678 |
1679 Deinit(); | 1679 Deinit(); |
1680 } | 1680 } |
1681 | 1681 |
1682 bool VideoChannel::SetRenderer(uint32_t ssrc, VideoRenderer* renderer) { | 1682 bool VideoChannel::SetRenderer(uint32_t ssrc, VideoRenderer* renderer) { |
1683 worker_thread()->Invoke<void>(Bind( | 1683 worker_thread()->Invoke<void>(Bind( |
1684 &VideoMediaChannel::SetRenderer, media_channel(), ssrc, renderer)); | 1684 &VideoMediaChannel::SetRenderer, media_channel(), ssrc, renderer)); |
1685 return true; | 1685 return true; |
1686 } | 1686 } |
1687 | 1687 |
1688 bool VideoChannel::ApplyViewRequest(const ViewRequest& request) { | |
1689 return InvokeOnWorker(Bind(&VideoChannel::ApplyViewRequest_w, this, request)); | |
1690 } | |
1691 | |
1692 bool VideoChannel::AddScreencast(uint32_t ssrc, VideoCapturer* capturer) { | 1688 bool VideoChannel::AddScreencast(uint32_t ssrc, VideoCapturer* capturer) { |
1693 return worker_thread()->Invoke<bool>(Bind( | 1689 return worker_thread()->Invoke<bool>(Bind( |
1694 &VideoChannel::AddScreencast_w, this, ssrc, capturer)); | 1690 &VideoChannel::AddScreencast_w, this, ssrc, capturer)); |
1695 } | 1691 } |
1696 | 1692 |
1697 bool VideoChannel::SetCapturer(uint32_t ssrc, VideoCapturer* capturer) { | 1693 bool VideoChannel::SetCapturer(uint32_t ssrc, VideoCapturer* capturer) { |
1698 return InvokeOnWorker(Bind(&VideoMediaChannel::SetCapturer, | 1694 return InvokeOnWorker(Bind(&VideoMediaChannel::SetCapturer, |
1699 media_channel(), ssrc, capturer)); | 1695 media_channel(), ssrc, capturer)); |
1700 } | 1696 } |
1701 | 1697 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1839 | 1835 |
1840 if (video->rtp_header_extensions_set()) { | 1836 if (video->rtp_header_extensions_set()) { |
1841 MaybeCacheRtpAbsSendTimeHeaderExtension(video->rtp_header_extensions()); | 1837 MaybeCacheRtpAbsSendTimeHeaderExtension(video->rtp_header_extensions()); |
1842 } | 1838 } |
1843 | 1839 |
1844 set_remote_content_direction(content->direction()); | 1840 set_remote_content_direction(content->direction()); |
1845 ChangeState(); | 1841 ChangeState(); |
1846 return true; | 1842 return true; |
1847 } | 1843 } |
1848 | 1844 |
1849 bool VideoChannel::ApplyViewRequest_w(const ViewRequest& request) { | |
1850 bool ret = true; | |
1851 // Set the send format for each of the local streams. If the view request | |
1852 // does not contain a local stream, set its send format to 0x0, which will | |
1853 // drop all frames. | |
1854 for (std::vector<StreamParams>::const_iterator it = local_streams().begin(); | |
1855 it != local_streams().end(); ++it) { | |
1856 VideoFormat format(0, 0, 0, cricket::FOURCC_I420); | |
1857 StaticVideoViews::const_iterator view; | |
1858 for (view = request.static_video_views.begin(); | |
1859 view != request.static_video_views.end(); ++view) { | |
1860 if (view->selector.Matches(*it)) { | |
1861 format.width = view->width; | |
1862 format.height = view->height; | |
1863 format.interval = cricket::VideoFormat::FpsToInterval(view->framerate); | |
1864 break; | |
1865 } | |
1866 } | |
1867 | |
1868 ret &= media_channel()->SetSendStreamFormat(it->first_ssrc(), format); | |
1869 } | |
1870 | |
1871 // Check if the view request has invalid streams. | |
1872 for (StaticVideoViews::const_iterator it = request.static_video_views.begin(); | |
1873 it != request.static_video_views.end(); ++it) { | |
1874 if (!GetStream(local_streams(), it->selector)) { | |
1875 LOG(LS_WARNING) << "View request for (" | |
1876 << it->selector.ssrc << ", '" | |
1877 << it->selector.groupid << "', '" | |
1878 << it->selector.streamid << "'" | |
1879 << ") is not in the local streams."; | |
1880 } | |
1881 } | |
1882 | |
1883 return ret; | |
1884 } | |
1885 | |
1886 bool VideoChannel::AddScreencast_w(uint32_t ssrc, VideoCapturer* capturer) { | 1845 bool VideoChannel::AddScreencast_w(uint32_t ssrc, VideoCapturer* capturer) { |
1887 if (screencast_capturers_.find(ssrc) != screencast_capturers_.end()) { | 1846 if (screencast_capturers_.find(ssrc) != screencast_capturers_.end()) { |
1888 return false; | 1847 return false; |
1889 } | 1848 } |
1890 capturer->SignalStateChange.connect(this, &VideoChannel::OnStateChange); | 1849 capturer->SignalStateChange.connect(this, &VideoChannel::OnStateChange); |
1891 screencast_capturers_[ssrc] = capturer; | 1850 screencast_capturers_[ssrc] = capturer; |
1892 return true; | 1851 return true; |
1893 } | 1852 } |
1894 | 1853 |
1895 bool VideoChannel::RemoveScreencast_w(uint32_t ssrc) { | 1854 bool VideoChannel::RemoveScreencast_w(uint32_t ssrc) { |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2306 return (data_channel_type_ == DCT_RTP) && BaseChannel::ShouldSetupDtlsSrtp(); | 2265 return (data_channel_type_ == DCT_RTP) && BaseChannel::ShouldSetupDtlsSrtp(); |
2307 } | 2266 } |
2308 | 2267 |
2309 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { | 2268 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { |
2310 rtc::TypedMessageData<uint32_t>* message = | 2269 rtc::TypedMessageData<uint32_t>* message = |
2311 new rtc::TypedMessageData<uint32_t>(sid); | 2270 new rtc::TypedMessageData<uint32_t>(sid); |
2312 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); | 2271 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); |
2313 } | 2272 } |
2314 | 2273 |
2315 } // namespace cricket | 2274 } // namespace cricket |
OLD | NEW |