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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 }; | 107 }; |
108 | 108 |
109 struct DataChannelErrorMessageData : public rtc::MessageData { | 109 struct DataChannelErrorMessageData : public rtc::MessageData { |
110 DataChannelErrorMessageData(uint32_t in_ssrc, | 110 DataChannelErrorMessageData(uint32_t in_ssrc, |
111 DataMediaChannel::Error in_error) | 111 DataMediaChannel::Error in_error) |
112 : ssrc(in_ssrc), error(in_error) {} | 112 : ssrc(in_ssrc), error(in_error) {} |
113 uint32_t ssrc; | 113 uint32_t ssrc; |
114 DataMediaChannel::Error error; | 114 DataMediaChannel::Error error; |
115 }; | 115 }; |
116 | 116 |
117 | |
118 struct VideoChannel::ScreencastDetailsData { | |
119 explicit ScreencastDetailsData(uint32_t s) | |
120 : ssrc(s), fps(0), screencast_max_pixels(0) {} | |
121 uint32_t ssrc; | |
122 int fps; | |
123 int screencast_max_pixels; | |
124 }; | |
125 | |
126 static const char* PacketType(bool rtcp) { | 117 static const char* PacketType(bool rtcp) { |
127 return (!rtcp) ? "RTP" : "RTCP"; | 118 return (!rtcp) ? "RTP" : "RTCP"; |
128 } | 119 } |
129 | 120 |
130 static bool ValidPacket(bool rtcp, const rtc::Buffer* packet) { | 121 static bool ValidPacket(bool rtcp, const rtc::Buffer* packet) { |
131 // Check the packet size. We could check the header too if needed. | 122 // Check the packet size. We could check the header too if needed. |
132 return (packet && | 123 return (packet && |
133 packet->size() >= (!rtcp ? kMinRtpPacketLen : kMinRtcpPacketLen) && | 124 packet->size() >= (!rtcp ? kMinRtpPacketLen : kMinRtcpPacketLen) && |
134 packet->size() <= kMaxRtpPacketLen); | 125 packet->size() <= kMaxRtpPacketLen); |
135 } | 126 } |
(...skipping 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1691 } | 1682 } |
1692 | 1683 |
1693 bool VideoChannel::RemoveScreencast(uint32_t ssrc) { | 1684 bool VideoChannel::RemoveScreencast(uint32_t ssrc) { |
1694 return InvokeOnWorker(Bind(&VideoChannel::RemoveScreencast_w, this, ssrc)); | 1685 return InvokeOnWorker(Bind(&VideoChannel::RemoveScreencast_w, this, ssrc)); |
1695 } | 1686 } |
1696 | 1687 |
1697 bool VideoChannel::IsScreencasting() { | 1688 bool VideoChannel::IsScreencasting() { |
1698 return InvokeOnWorker(Bind(&VideoChannel::IsScreencasting_w, this)); | 1689 return InvokeOnWorker(Bind(&VideoChannel::IsScreencasting_w, this)); |
1699 } | 1690 } |
1700 | 1691 |
1701 int VideoChannel::GetScreencastFps(uint32_t ssrc) { | |
1702 ScreencastDetailsData data(ssrc); | |
1703 worker_thread()->Invoke<void>(Bind( | |
1704 &VideoChannel::GetScreencastDetails_w, this, &data)); | |
1705 return data.fps; | |
1706 } | |
1707 | |
1708 int VideoChannel::GetScreencastMaxPixels(uint32_t ssrc) { | |
1709 ScreencastDetailsData data(ssrc); | |
1710 worker_thread()->Invoke<void>(Bind( | |
1711 &VideoChannel::GetScreencastDetails_w, this, &data)); | |
1712 return data.screencast_max_pixels; | |
1713 } | |
1714 | |
1715 bool VideoChannel::SendIntraFrame() { | 1692 bool VideoChannel::SendIntraFrame() { |
1716 worker_thread()->Invoke<void>(Bind( | 1693 worker_thread()->Invoke<void>(Bind( |
1717 &VideoMediaChannel::SendIntraFrame, media_channel())); | 1694 &VideoMediaChannel::SendIntraFrame, media_channel())); |
1718 return true; | 1695 return true; |
1719 } | 1696 } |
1720 | 1697 |
1721 bool VideoChannel::RequestIntraFrame() { | 1698 bool VideoChannel::RequestIntraFrame() { |
1722 worker_thread()->Invoke<void>(Bind( | 1699 worker_thread()->Invoke<void>(Bind( |
1723 &VideoMediaChannel::RequestIntraFrame, media_channel())); | 1700 &VideoMediaChannel::RequestIntraFrame, media_channel())); |
1724 return true; | 1701 return true; |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1917 // Clean up VideoCapturer. | 1894 // Clean up VideoCapturer. |
1918 delete iter->second; | 1895 delete iter->second; |
1919 screencast_capturers_.erase(iter); | 1896 screencast_capturers_.erase(iter); |
1920 return true; | 1897 return true; |
1921 } | 1898 } |
1922 | 1899 |
1923 bool VideoChannel::IsScreencasting_w() const { | 1900 bool VideoChannel::IsScreencasting_w() const { |
1924 return !screencast_capturers_.empty(); | 1901 return !screencast_capturers_.empty(); |
1925 } | 1902 } |
1926 | 1903 |
1927 void VideoChannel::GetScreencastDetails_w( | |
1928 ScreencastDetailsData* data) const { | |
1929 ScreencastMap::const_iterator iter = screencast_capturers_.find(data->ssrc); | |
1930 if (iter == screencast_capturers_.end()) { | |
1931 return; | |
1932 } | |
1933 VideoCapturer* capturer = iter->second; | |
1934 const VideoFormat* video_format = capturer->GetCaptureFormat(); | |
1935 data->fps = VideoFormat::IntervalToFps(video_format->interval); | |
1936 data->screencast_max_pixels = capturer->screencast_max_pixels(); | |
1937 } | |
1938 | |
1939 void VideoChannel::OnScreencastWindowEvent_s(uint32_t ssrc, | 1904 void VideoChannel::OnScreencastWindowEvent_s(uint32_t ssrc, |
1940 rtc::WindowEvent we) { | 1905 rtc::WindowEvent we) { |
1941 ASSERT(signaling_thread() == rtc::Thread::Current()); | 1906 ASSERT(signaling_thread() == rtc::Thread::Current()); |
1942 SignalScreencastWindowEvent(ssrc, we); | 1907 SignalScreencastWindowEvent(ssrc, we); |
1943 } | 1908 } |
1944 | 1909 |
1945 void VideoChannel::OnMessage(rtc::Message *pmsg) { | 1910 void VideoChannel::OnMessage(rtc::Message *pmsg) { |
1946 switch (pmsg->message_id) { | 1911 switch (pmsg->message_id) { |
1947 case MSG_SCREENCASTWINDOWEVENT: { | 1912 case MSG_SCREENCASTWINDOWEVENT: { |
1948 const ScreencastEventMessageData* data = | 1913 const ScreencastEventMessageData* data = |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2335 return (data_channel_type_ == DCT_RTP) && BaseChannel::ShouldSetupDtlsSrtp(); | 2300 return (data_channel_type_ == DCT_RTP) && BaseChannel::ShouldSetupDtlsSrtp(); |
2336 } | 2301 } |
2337 | 2302 |
2338 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { | 2303 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { |
2339 rtc::TypedMessageData<uint32_t>* message = | 2304 rtc::TypedMessageData<uint32_t>* message = |
2340 new rtc::TypedMessageData<uint32_t>(sid); | 2305 new rtc::TypedMessageData<uint32_t>(sid); |
2341 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); | 2306 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); |
2342 } | 2307 } |
2343 | 2308 |
2344 } // namespace cricket | 2309 } // namespace cricket |
OLD | NEW |