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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 } | 234 } |
235 uint32 ssrc; | 235 uint32 ssrc; |
236 int event_code; | 236 int event_code; |
237 int duration; | 237 int duration; |
238 int flags; | 238 int flags; |
239 }; | 239 }; |
240 explicit FakeVoiceMediaChannel(FakeVoiceEngine* engine, | 240 explicit FakeVoiceMediaChannel(FakeVoiceEngine* engine, |
241 const AudioOptions& options) | 241 const AudioOptions& options) |
242 : engine_(engine), | 242 : engine_(engine), |
243 fail_set_send_(false), | 243 fail_set_send_(false), |
244 ringback_tone_ssrc_(0), | |
245 ringback_tone_play_(false), | |
246 ringback_tone_loop_(false), | |
247 time_since_last_typing_(-1) { | 244 time_since_last_typing_(-1) { |
248 output_scalings_[0] = OutputScaling(); // For default channel. | 245 output_scalings_[0] = OutputScaling(); // For default channel. |
249 SetOptions(options); | 246 SetOptions(options); |
250 } | 247 } |
251 ~FakeVoiceMediaChannel(); | 248 ~FakeVoiceMediaChannel(); |
252 const std::vector<AudioCodec>& recv_codecs() const { return recv_codecs_; } | 249 const std::vector<AudioCodec>& recv_codecs() const { return recv_codecs_; } |
253 const std::vector<AudioCodec>& send_codecs() const { return send_codecs_; } | 250 const std::vector<AudioCodec>& send_codecs() const { return send_codecs_; } |
254 const std::vector<AudioCodec>& codecs() const { return send_codecs(); } | 251 const std::vector<AudioCodec>& codecs() const { return send_codecs(); } |
255 const std::vector<DtmfInfo>& dtmf_info_queue() const { | 252 const std::vector<DtmfInfo>& dtmf_info_queue() const { |
256 return dtmf_info_queue_; | 253 return dtmf_info_queue_; |
257 } | 254 } |
258 const AudioOptions& options() const { return options_; } | 255 const AudioOptions& options() const { return options_; } |
259 | 256 |
260 uint32 ringback_tone_ssrc() const { return ringback_tone_ssrc_; } | |
261 bool ringback_tone_play() const { return ringback_tone_play_; } | |
262 bool ringback_tone_loop() const { return ringback_tone_loop_; } | |
263 | |
264 virtual bool SetSendParameters(const AudioSendParameters& params) { | 257 virtual bool SetSendParameters(const AudioSendParameters& params) { |
265 return (SetSendCodecs(params.codecs) && | 258 return (SetSendCodecs(params.codecs) && |
266 SetSendRtpHeaderExtensions(params.extensions) && | 259 SetSendRtpHeaderExtensions(params.extensions) && |
267 SetMaxSendBandwidth(params.max_bandwidth_bps) && | 260 SetMaxSendBandwidth(params.max_bandwidth_bps) && |
268 SetOptions(params.options)); | 261 SetOptions(params.options)); |
269 } | 262 } |
270 | 263 |
271 virtual bool SetRecvParameters(const AudioRecvParameters& params) { | 264 virtual bool SetRecvParameters(const AudioRecvParameters& params) { |
272 return (SetRecvCodecs(params.codecs) && | 265 return (SetRecvCodecs(params.codecs) && |
273 SetRecvRtpHeaderExtensions(params.extensions)); | 266 SetRecvRtpHeaderExtensions(params.extensions)); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 } | 323 } |
331 | 324 |
332 virtual bool GetActiveStreams(AudioInfo::StreamList* streams) { return true; } | 325 virtual bool GetActiveStreams(AudioInfo::StreamList* streams) { return true; } |
333 virtual int GetOutputLevel() { return 0; } | 326 virtual int GetOutputLevel() { return 0; } |
334 void set_time_since_last_typing(int ms) { time_since_last_typing_ = ms; } | 327 void set_time_since_last_typing(int ms) { time_since_last_typing_ = ms; } |
335 virtual int GetTimeSinceLastTyping() { return time_since_last_typing_; } | 328 virtual int GetTimeSinceLastTyping() { return time_since_last_typing_; } |
336 virtual void SetTypingDetectionParameters( | 329 virtual void SetTypingDetectionParameters( |
337 int time_window, int cost_per_typing, int reporting_threshold, | 330 int time_window, int cost_per_typing, int reporting_threshold, |
338 int penalty_decay, int type_event_delay) {} | 331 int penalty_decay, int type_event_delay) {} |
339 | 332 |
340 virtual bool SetRingbackTone(const char* buf, int len) { return true; } | |
341 virtual bool PlayRingbackTone(uint32 ssrc, bool play, bool loop) { | |
342 ringback_tone_ssrc_ = ssrc; | |
343 ringback_tone_play_ = play; | |
344 ringback_tone_loop_ = loop; | |
345 return true; | |
346 } | |
347 | |
348 virtual bool CanInsertDtmf() { | 333 virtual bool CanInsertDtmf() { |
349 for (std::vector<AudioCodec>::const_iterator it = send_codecs_.begin(); | 334 for (std::vector<AudioCodec>::const_iterator it = send_codecs_.begin(); |
350 it != send_codecs_.end(); ++it) { | 335 it != send_codecs_.end(); ++it) { |
351 // Find the DTMF telephone event "codec". | 336 // Find the DTMF telephone event "codec". |
352 if (_stricmp(it->name.c_str(), "telephone-event") == 0) { | 337 if (_stricmp(it->name.c_str(), "telephone-event") == 0) { |
353 return true; | 338 return true; |
354 } | 339 } |
355 } | 340 } |
356 return false; | 341 return false; |
357 } | 342 } |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 } | 452 } |
468 return true; | 453 return true; |
469 } | 454 } |
470 | 455 |
471 FakeVoiceEngine* engine_; | 456 FakeVoiceEngine* engine_; |
472 std::vector<AudioCodec> recv_codecs_; | 457 std::vector<AudioCodec> recv_codecs_; |
473 std::vector<AudioCodec> send_codecs_; | 458 std::vector<AudioCodec> send_codecs_; |
474 std::map<uint32, OutputScaling> output_scalings_; | 459 std::map<uint32, OutputScaling> output_scalings_; |
475 std::vector<DtmfInfo> dtmf_info_queue_; | 460 std::vector<DtmfInfo> dtmf_info_queue_; |
476 bool fail_set_send_; | 461 bool fail_set_send_; |
477 uint32 ringback_tone_ssrc_; | |
478 bool ringback_tone_play_; | |
479 bool ringback_tone_loop_; | |
480 int time_since_last_typing_; | 462 int time_since_last_typing_; |
481 AudioOptions options_; | 463 AudioOptions options_; |
482 std::map<uint32, VoiceChannelAudioSink*> local_renderers_; | 464 std::map<uint32, VoiceChannelAudioSink*> local_renderers_; |
483 std::map<uint32, AudioRenderer*> remote_renderers_; | 465 std::map<uint32, AudioRenderer*> remote_renderers_; |
484 }; | 466 }; |
485 | 467 |
486 // A helper function to compare the FakeVoiceMediaChannel::DtmfInfo. | 468 // A helper function to compare the FakeVoiceMediaChannel::DtmfInfo. |
487 inline bool CompareDtmfInfo(const FakeVoiceMediaChannel::DtmfInfo& info, | 469 inline bool CompareDtmfInfo(const FakeVoiceMediaChannel::DtmfInfo& info, |
488 uint32 ssrc, int event_code, int duration, | 470 uint32 ssrc, int event_code, int duration, |
489 int flags) { | 471 int flags) { |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 | 1073 |
1092 private: | 1074 private: |
1093 std::vector<FakeDataMediaChannel*> channels_; | 1075 std::vector<FakeDataMediaChannel*> channels_; |
1094 std::vector<DataCodec> data_codecs_; | 1076 std::vector<DataCodec> data_codecs_; |
1095 DataChannelType last_channel_type_; | 1077 DataChannelType last_channel_type_; |
1096 }; | 1078 }; |
1097 | 1079 |
1098 } // namespace cricket | 1080 } // namespace cricket |
1099 | 1081 |
1100 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ | 1082 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ |
OLD | NEW |