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, |
11 * this list of conditions and the following disclaimer in the documentation | 11 * this list of conditions and the following disclaimer in the documentation |
12 * and/or other materials provided with the distribution. | 12 * and/or other materials provided with the distribution. |
13 * 3. The name of the author may not be used to endorse or promote products | 13 * 3. The name of the author may not be used to endorse or promote products |
14 * derived from this software without specific prior written permission. | 14 * derived from this software without specific prior written permission. |
15 * | 15 * |
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED | 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO |
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 */ | 26 */ |
27 | 27 |
| 28 #include <utility> |
| 29 |
28 #include "talk/session/media/channel.h" | 30 #include "talk/session/media/channel.h" |
29 | 31 |
30 #include "talk/media/base/constants.h" | 32 #include "talk/media/base/constants.h" |
31 #include "talk/media/base/rtputils.h" | 33 #include "talk/media/base/rtputils.h" |
32 #include "talk/session/media/channelmanager.h" | 34 #include "talk/session/media/channelmanager.h" |
33 #include "webrtc/audio/audio_sink.h" | 35 #include "webrtc/audio/audio_sink.h" |
34 #include "webrtc/base/bind.h" | 36 #include "webrtc/base/bind.h" |
35 #include "webrtc/base/buffer.h" | 37 #include "webrtc/base/buffer.h" |
36 #include "webrtc/base/byteorder.h" | 38 #include "webrtc/base/byteorder.h" |
37 #include "webrtc/base/common.h" | 39 #include "webrtc/base/common.h" |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 // If the thread is not our worker thread, we will post to our worker | 550 // If the thread is not our worker thread, we will post to our worker |
549 // so that the real work happens on our worker. This avoids us having to | 551 // so that the real work happens on our worker. This avoids us having to |
550 // synchronize access to all the pieces of the send path, including | 552 // synchronize access to all the pieces of the send path, including |
551 // SRTP and the inner workings of the transport channels. | 553 // SRTP and the inner workings of the transport channels. |
552 // The only downside is that we can't return a proper failure code if | 554 // The only downside is that we can't return a proper failure code if |
553 // needed. Since UDP is unreliable anyway, this should be a non-issue. | 555 // needed. Since UDP is unreliable anyway, this should be a non-issue. |
554 if (rtc::Thread::Current() != worker_thread_) { | 556 if (rtc::Thread::Current() != worker_thread_) { |
555 // Avoid a copy by transferring the ownership of the packet data. | 557 // Avoid a copy by transferring the ownership of the packet data. |
556 int message_id = (!rtcp) ? MSG_RTPPACKET : MSG_RTCPPACKET; | 558 int message_id = (!rtcp) ? MSG_RTPPACKET : MSG_RTCPPACKET; |
557 PacketMessageData* data = new PacketMessageData; | 559 PacketMessageData* data = new PacketMessageData; |
558 data->packet = packet->Pass(); | 560 data->packet = std::move(*packet); |
559 data->options = options; | 561 data->options = options; |
560 worker_thread_->Post(this, message_id, data); | 562 worker_thread_->Post(this, message_id, data); |
561 return true; | 563 return true; |
562 } | 564 } |
563 | 565 |
564 // Now that we are on the correct thread, ensure we have a place to send this | 566 // Now that we are on the correct thread, ensure we have a place to send this |
565 // packet before doing anything. (We might get RTCP packets that we don't | 567 // packet before doing anything. (We might get RTCP packets that we don't |
566 // intend to send.) If we've negotiated RTCP mux, send RTCP over the RTP | 568 // intend to send.) If we've negotiated RTCP mux, send RTCP over the RTP |
567 // transport. | 569 // transport. |
568 TransportChannel* channel = (!rtcp || rtcp_mux_filter_.IsActive()) ? | 570 TransportChannel* channel = (!rtcp || rtcp_mux_filter_.IsActive()) ? |
(...skipping 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2333 return (data_channel_type_ == DCT_RTP) && BaseChannel::ShouldSetupDtlsSrtp(); | 2335 return (data_channel_type_ == DCT_RTP) && BaseChannel::ShouldSetupDtlsSrtp(); |
2334 } | 2336 } |
2335 | 2337 |
2336 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { | 2338 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { |
2337 rtc::TypedMessageData<uint32_t>* message = | 2339 rtc::TypedMessageData<uint32_t>* message = |
2338 new rtc::TypedMessageData<uint32_t>(sid); | 2340 new rtc::TypedMessageData<uint32_t>(sid); |
2339 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); | 2341 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); |
2340 } | 2342 } |
2341 | 2343 |
2342 } // namespace cricket | 2344 } // namespace cricket |
OLD | NEW |