OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 return recv_extensions_; | 48 return recv_extensions_; |
49 } | 49 } |
50 const std::vector<RtpHeaderExtension>& send_extensions() { | 50 const std::vector<RtpHeaderExtension>& send_extensions() { |
51 return send_extensions_; | 51 return send_extensions_; |
52 } | 52 } |
53 bool sending() const { return sending_; } | 53 bool sending() const { return sending_; } |
54 bool playout() const { return playout_; } | 54 bool playout() const { return playout_; } |
55 const std::list<std::string>& rtp_packets() const { return rtp_packets_; } | 55 const std::list<std::string>& rtp_packets() const { return rtp_packets_; } |
56 const std::list<std::string>& rtcp_packets() const { return rtcp_packets_; } | 56 const std::list<std::string>& rtcp_packets() const { return rtcp_packets_; } |
57 | 57 |
58 bool SendRtp(const void* data, int len, const rtc::PacketOptions& options) { | 58 bool SendRtp(const void* data, |
| 59 size_t len, |
| 60 const rtc::PacketOptions& options) { |
59 if (!sending_) { | 61 if (!sending_) { |
60 return false; | 62 return false; |
61 } | 63 } |
62 rtc::CopyOnWriteBuffer packet(reinterpret_cast<const uint8_t*>(data), len, | 64 rtc::CopyOnWriteBuffer packet(reinterpret_cast<const uint8_t*>(data), len, |
63 kMaxRtpPacketLen); | 65 kMaxRtpPacketLen); |
64 return Base::SendPacket(&packet, options); | 66 return Base::SendPacket(&packet, options); |
65 } | 67 } |
66 bool SendRtcp(const void* data, int len) { | 68 bool SendRtcp(const void* data, size_t len) { |
67 rtc::CopyOnWriteBuffer packet(reinterpret_cast<const uint8_t*>(data), len, | 69 rtc::CopyOnWriteBuffer packet(reinterpret_cast<const uint8_t*>(data), len, |
68 kMaxRtpPacketLen); | 70 kMaxRtpPacketLen); |
69 return Base::SendRtcp(&packet, rtc::PacketOptions()); | 71 return Base::SendRtcp(&packet, rtc::PacketOptions()); |
70 } | 72 } |
71 | 73 |
72 bool CheckRtp(const void* data, int len) { | 74 bool CheckRtp(const void* data, size_t len) { |
73 bool success = !rtp_packets_.empty(); | 75 bool success = !rtp_packets_.empty(); |
74 if (success) { | 76 if (success) { |
75 std::string packet = rtp_packets_.front(); | 77 std::string packet = rtp_packets_.front(); |
76 rtp_packets_.pop_front(); | 78 rtp_packets_.pop_front(); |
77 success = (packet == std::string(static_cast<const char*>(data), len)); | 79 success = (packet == std::string(static_cast<const char*>(data), len)); |
78 } | 80 } |
79 return success; | 81 return success; |
80 } | 82 } |
81 bool CheckRtcp(const void* data, int len) { | 83 bool CheckRtcp(const void* data, size_t len) { |
82 bool success = !rtcp_packets_.empty(); | 84 bool success = !rtcp_packets_.empty(); |
83 if (success) { | 85 if (success) { |
84 std::string packet = rtcp_packets_.front(); | 86 std::string packet = rtcp_packets_.front(); |
85 rtcp_packets_.pop_front(); | 87 rtcp_packets_.pop_front(); |
86 success = (packet == std::string(static_cast<const char*>(data), len)); | 88 success = (packet == std::string(static_cast<const char*>(data), len)); |
87 } | 89 } |
88 return success; | 90 return success; |
89 } | 91 } |
90 bool CheckNoRtp() { return rtp_packets_.empty(); } | 92 bool CheckNoRtp() { return rtp_packets_.empty(); } |
91 bool CheckNoRtcp() { return rtcp_packets_.empty(); } | 93 bool CheckNoRtcp() { return rtcp_packets_.empty(); } |
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 | 909 |
908 private: | 910 private: |
909 std::vector<FakeDataMediaChannel*> channels_; | 911 std::vector<FakeDataMediaChannel*> channels_; |
910 std::vector<DataCodec> data_codecs_; | 912 std::vector<DataCodec> data_codecs_; |
911 DataChannelType last_channel_type_; | 913 DataChannelType last_channel_type_; |
912 }; | 914 }; |
913 | 915 |
914 } // namespace cricket | 916 } // namespace cricket |
915 | 917 |
916 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ | 918 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ |
OLD | NEW |