Chromium Code Reviews| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 } | 157 } |
| 158 | 158 |
| 159 // TODO(perkj): This is to support legacy unit test that only check one | 159 // TODO(perkj): This is to support legacy unit test that only check one |
| 160 // sending stream. | 160 // sending stream. |
| 161 const std::string rtcp_cname() { | 161 const std::string rtcp_cname() { |
| 162 if (send_streams_.empty()) | 162 if (send_streams_.empty()) |
| 163 return ""; | 163 return ""; |
| 164 return send_streams_[0].cname; | 164 return send_streams_[0].cname; |
| 165 } | 165 } |
| 166 | 166 |
| 167 rtc::SentPacket last_packet_sent() const { return last_packet_sent_; } | |
|
pthatcher1
2015/09/25 23:24:57
last_sent_packet_ would fit a little better with t
stefan-webrtc
2015/10/02 13:29:12
Done.
| |
| 168 | |
| 167 bool ready_to_send() const { | 169 bool ready_to_send() const { |
| 168 return ready_to_send_; | 170 return ready_to_send_; |
| 169 } | 171 } |
| 170 | 172 |
| 171 protected: | 173 protected: |
| 172 bool MuteStream(uint32 ssrc, bool mute) { | 174 bool MuteStream(uint32 ssrc, bool mute) { |
| 173 if (!HasSendStream(ssrc) && ssrc != 0) { | 175 if (!HasSendStream(ssrc) && ssrc != 0) { |
| 174 return false; | 176 return false; |
| 175 } | 177 } |
| 176 if (mute) { | 178 if (mute) { |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 196 return true; | 198 return true; |
| 197 } | 199 } |
| 198 virtual void OnPacketReceived(rtc::Buffer* packet, | 200 virtual void OnPacketReceived(rtc::Buffer* packet, |
| 199 const rtc::PacketTime& packet_time) { | 201 const rtc::PacketTime& packet_time) { |
| 200 rtp_packets_.push_back(std::string(packet->data<char>(), packet->size())); | 202 rtp_packets_.push_back(std::string(packet->data<char>(), packet->size())); |
| 201 } | 203 } |
| 202 virtual void OnRtcpReceived(rtc::Buffer* packet, | 204 virtual void OnRtcpReceived(rtc::Buffer* packet, |
| 203 const rtc::PacketTime& packet_time) { | 205 const rtc::PacketTime& packet_time) { |
| 204 rtcp_packets_.push_back(std::string(packet->data<char>(), packet->size())); | 206 rtcp_packets_.push_back(std::string(packet->data<char>(), packet->size())); |
| 205 } | 207 } |
| 208 virtual void OnPacketSent(const rtc::SentPacket& packet_sent) { | |
|
pthatcher1
2015/09/25 23:24:57
Similarly, sent_packet would be a slightly better
stefan-webrtc
2015/10/02 13:29:12
Done.
| |
| 209 last_packet_sent_ = packet_sent; | |
| 210 } | |
| 206 virtual void OnReadyToSend(bool ready) { | 211 virtual void OnReadyToSend(bool ready) { |
| 207 ready_to_send_ = ready; | 212 ready_to_send_ = ready; |
| 208 } | 213 } |
| 209 bool fail_set_send_codecs() const { return fail_set_send_codecs_; } | 214 bool fail_set_send_codecs() const { return fail_set_send_codecs_; } |
| 210 bool fail_set_recv_codecs() const { return fail_set_recv_codecs_; } | 215 bool fail_set_recv_codecs() const { return fail_set_recv_codecs_; } |
| 211 | 216 |
| 212 private: | 217 private: |
| 213 bool sending_; | 218 bool sending_; |
| 214 bool playout_; | 219 bool playout_; |
| 215 std::vector<RtpHeaderExtension> recv_extensions_; | 220 std::vector<RtpHeaderExtension> recv_extensions_; |
| 216 std::vector<RtpHeaderExtension> send_extensions_; | 221 std::vector<RtpHeaderExtension> send_extensions_; |
| 217 std::list<std::string> rtp_packets_; | 222 std::list<std::string> rtp_packets_; |
| 218 std::list<std::string> rtcp_packets_; | 223 std::list<std::string> rtcp_packets_; |
| 219 std::vector<StreamParams> send_streams_; | 224 std::vector<StreamParams> send_streams_; |
| 220 std::vector<StreamParams> receive_streams_; | 225 std::vector<StreamParams> receive_streams_; |
| 221 std::set<uint32> muted_streams_; | 226 std::set<uint32> muted_streams_; |
| 222 bool fail_set_send_codecs_; | 227 bool fail_set_send_codecs_; |
| 223 bool fail_set_recv_codecs_; | 228 bool fail_set_recv_codecs_; |
| 224 uint32 send_ssrc_; | 229 uint32 send_ssrc_; |
| 225 std::string rtcp_cname_; | 230 std::string rtcp_cname_; |
| 231 rtc::SentPacket last_packet_sent_; | |
| 226 bool ready_to_send_; | 232 bool ready_to_send_; |
| 227 }; | 233 }; |
| 228 | 234 |
| 229 class FakeVoiceMediaChannel : public RtpHelper<VoiceMediaChannel> { | 235 class FakeVoiceMediaChannel : public RtpHelper<VoiceMediaChannel> { |
| 230 public: | 236 public: |
| 231 struct DtmfInfo { | 237 struct DtmfInfo { |
| 232 DtmfInfo(uint32 ssrc, int event_code, int duration, int flags) | 238 DtmfInfo(uint32 ssrc, int event_code, int duration, int flags) |
| 233 : ssrc(ssrc), event_code(event_code), duration(duration), flags(flags) { | 239 : ssrc(ssrc), event_code(event_code), duration(duration), flags(flags) { |
| 234 } | 240 } |
| 235 uint32 ssrc; | 241 uint32 ssrc; |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1019 | 1025 |
| 1020 private: | 1026 private: |
| 1021 std::vector<FakeDataMediaChannel*> channels_; | 1027 std::vector<FakeDataMediaChannel*> channels_; |
| 1022 std::vector<DataCodec> data_codecs_; | 1028 std::vector<DataCodec> data_codecs_; |
| 1023 DataChannelType last_channel_type_; | 1029 DataChannelType last_channel_type_; |
| 1024 }; | 1030 }; |
| 1025 | 1031 |
| 1026 } // namespace cricket | 1032 } // namespace cricket |
| 1027 | 1033 |
| 1028 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ | 1034 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ |
| OLD | NEW |