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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 bool fail_set_send_codecs_; | 222 bool fail_set_send_codecs_; |
223 bool fail_set_recv_codecs_; | 223 bool fail_set_recv_codecs_; |
224 uint32_t send_ssrc_; | 224 uint32_t send_ssrc_; |
225 std::string rtcp_cname_; | 225 std::string rtcp_cname_; |
226 bool ready_to_send_; | 226 bool ready_to_send_; |
227 }; | 227 }; |
228 | 228 |
229 class FakeVoiceMediaChannel : public RtpHelper<VoiceMediaChannel> { | 229 class FakeVoiceMediaChannel : public RtpHelper<VoiceMediaChannel> { |
230 public: | 230 public: |
231 struct DtmfInfo { | 231 struct DtmfInfo { |
232 DtmfInfo(uint32_t ssrc, int event_code, int duration, int flags) | 232 DtmfInfo(uint32_t ssrc, int event_code, int duration) |
233 : ssrc(ssrc), | 233 : ssrc(ssrc), |
234 event_code(event_code), | 234 event_code(event_code), |
235 duration(duration), | 235 duration(duration) {} |
236 flags(flags) {} | |
237 uint32_t ssrc; | 236 uint32_t ssrc; |
238 int event_code; | 237 int event_code; |
239 int duration; | 238 int duration; |
240 int flags; | |
241 }; | 239 }; |
242 explicit FakeVoiceMediaChannel(FakeVoiceEngine* engine, | 240 explicit FakeVoiceMediaChannel(FakeVoiceEngine* engine, |
243 const AudioOptions& options) | 241 const AudioOptions& options) |
244 : engine_(engine), | 242 : engine_(engine), |
245 time_since_last_typing_(-1) { | 243 time_since_last_typing_(-1) { |
246 output_scalings_[0] = 1.0; // For default channel. | 244 output_scalings_[0] = 1.0; // For default channel. |
247 SetOptions(options); | 245 SetOptions(options); |
248 } | 246 } |
249 ~FakeVoiceMediaChannel(); | 247 ~FakeVoiceMediaChannel(); |
250 const std::vector<AudioCodec>& recv_codecs() const { return recv_codecs_; } | 248 const std::vector<AudioCodec>& recv_codecs() const { return recv_codecs_; } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 it != send_codecs_.end(); ++it) { | 312 it != send_codecs_.end(); ++it) { |
315 // Find the DTMF telephone event "codec". | 313 // Find the DTMF telephone event "codec". |
316 if (_stricmp(it->name.c_str(), "telephone-event") == 0) { | 314 if (_stricmp(it->name.c_str(), "telephone-event") == 0) { |
317 return true; | 315 return true; |
318 } | 316 } |
319 } | 317 } |
320 return false; | 318 return false; |
321 } | 319 } |
322 virtual bool InsertDtmf(uint32_t ssrc, | 320 virtual bool InsertDtmf(uint32_t ssrc, |
323 int event_code, | 321 int event_code, |
324 int duration, | 322 int duration) { |
325 int flags) { | 323 dtmf_info_queue_.push_back(DtmfInfo(ssrc, event_code, duration)); |
326 dtmf_info_queue_.push_back(DtmfInfo(ssrc, event_code, duration, flags)); | |
327 return true; | 324 return true; |
328 } | 325 } |
329 | 326 |
330 virtual bool SetOutputVolume(uint32_t ssrc, double volume) { | 327 virtual bool SetOutputVolume(uint32_t ssrc, double volume) { |
331 if (0 == ssrc) { | 328 if (0 == ssrc) { |
332 std::map<uint32_t, double>::iterator it; | 329 std::map<uint32_t, double>::iterator it; |
333 for (it = output_scalings_.begin(); it != output_scalings_.end(); ++it) { | 330 for (it = output_scalings_.begin(); it != output_scalings_.end(); ++it) { |
334 it->second = volume; | 331 it->second = volume; |
335 } | 332 } |
336 return true; | 333 return true; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 std::vector<DtmfInfo> dtmf_info_queue_; | 417 std::vector<DtmfInfo> dtmf_info_queue_; |
421 int time_since_last_typing_; | 418 int time_since_last_typing_; |
422 AudioOptions options_; | 419 AudioOptions options_; |
423 std::map<uint32_t, VoiceChannelAudioSink*> local_renderers_; | 420 std::map<uint32_t, VoiceChannelAudioSink*> local_renderers_; |
424 }; | 421 }; |
425 | 422 |
426 // A helper function to compare the FakeVoiceMediaChannel::DtmfInfo. | 423 // A helper function to compare the FakeVoiceMediaChannel::DtmfInfo. |
427 inline bool CompareDtmfInfo(const FakeVoiceMediaChannel::DtmfInfo& info, | 424 inline bool CompareDtmfInfo(const FakeVoiceMediaChannel::DtmfInfo& info, |
428 uint32_t ssrc, | 425 uint32_t ssrc, |
429 int event_code, | 426 int event_code, |
430 int duration, | 427 int duration) { |
431 int flags) { | |
432 return (info.duration == duration && info.event_code == event_code && | 428 return (info.duration == duration && info.event_code == event_code && |
433 info.flags == flags && info.ssrc == ssrc); | 429 info.ssrc == ssrc); |
434 } | 430 } |
435 | 431 |
436 class FakeVideoMediaChannel : public RtpHelper<VideoMediaChannel> { | 432 class FakeVideoMediaChannel : public RtpHelper<VideoMediaChannel> { |
437 public: | 433 public: |
438 explicit FakeVideoMediaChannel(FakeVideoEngine* engine, | 434 explicit FakeVideoMediaChannel(FakeVideoEngine* engine, |
439 const VideoOptions& options) | 435 const VideoOptions& options) |
440 : engine_(engine), | 436 : engine_(engine), |
441 sent_intra_frame_(false), | 437 sent_intra_frame_(false), |
442 requested_intra_frame_(false), | 438 requested_intra_frame_(false), |
443 max_bps_(-1) { | 439 max_bps_(-1) { |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 | 971 |
976 private: | 972 private: |
977 std::vector<FakeDataMediaChannel*> channels_; | 973 std::vector<FakeDataMediaChannel*> channels_; |
978 std::vector<DataCodec> data_codecs_; | 974 std::vector<DataCodec> data_codecs_; |
979 DataChannelType last_channel_type_; | 975 DataChannelType last_channel_type_; |
980 }; | 976 }; |
981 | 977 |
982 } // namespace cricket | 978 } // namespace cricket |
983 | 979 |
984 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ | 980 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ |
OLD | NEW |