Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(834)

Side by Side Diff: talk/media/base/fakemediaengine.h

Issue 1363573002: Wire up transport sequence number / send time callbacks to webrtc via libjingle. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Cleanups. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 bool playout() const { return playout_; } 68 bool playout() const { return playout_; }
69 const std::list<std::string>& rtp_packets() const { return rtp_packets_; } 69 const std::list<std::string>& rtp_packets() const { return rtp_packets_; }
70 const std::list<std::string>& rtcp_packets() const { return rtcp_packets_; } 70 const std::list<std::string>& rtcp_packets() const { return rtcp_packets_; }
71 71
72 bool SendRtp(const void* data, int len) { 72 bool SendRtp(const void* data, int len) {
73 if (!sending_) { 73 if (!sending_) {
74 return false; 74 return false;
75 } 75 }
76 rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len, 76 rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len,
77 kMaxRtpPacketLen); 77 kMaxRtpPacketLen);
78 return Base::SendPacket(&packet); 78 return Base::SendPacket(&packet, rtc::PacketOptions());
79 } 79 }
80 bool SendRtcp(const void* data, int len) { 80 bool SendRtcp(const void* data, int len) {
81 rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len, 81 rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len,
82 kMaxRtpPacketLen); 82 kMaxRtpPacketLen);
83 return Base::SendRtcp(&packet); 83 return Base::SendRtcp(&packet, rtc::PacketOptions());
84 } 84 }
85 85
86 bool CheckRtp(const void* data, int len) { 86 bool CheckRtp(const void* data, int len) {
87 bool success = !rtp_packets_.empty(); 87 bool success = !rtp_packets_.empty();
88 if (success) { 88 if (success) {
89 std::string packet = rtp_packets_.front(); 89 std::string packet = rtp_packets_.front();
90 rtp_packets_.pop_front(); 90 rtp_packets_.pop_front();
91 success = (packet == std::string(static_cast<const char*>(data), len)); 91 success = (packet == std::string(static_cast<const char*>(data), len));
92 } 92 }
93 return success; 93 return success;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_sent_packet() const { return last_sent_packet_; }
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
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 OnSentPacket(const rtc::SentPacket& sent_packet) {
209 last_sent_packet_ = sent_packet;
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_sent_packet_;
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 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 1009
1004 private: 1010 private:
1005 std::vector<FakeDataMediaChannel*> channels_; 1011 std::vector<FakeDataMediaChannel*> channels_;
1006 std::vector<DataCodec> data_codecs_; 1012 std::vector<DataCodec> data_codecs_;
1007 DataChannelType last_channel_type_; 1013 DataChannelType last_channel_type_;
1008 }; 1014 };
1009 1015
1010 } // namespace cricket 1016 } // namespace cricket
1011 1017
1012 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ 1018 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698