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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 DtmfInfo(uint32_t ssrc, int event_code, int duration) | 297 DtmfInfo(uint32_t ssrc, int event_code, int duration) |
298 : ssrc(ssrc), | 298 : ssrc(ssrc), |
299 event_code(event_code), | 299 event_code(event_code), |
300 duration(duration) {} | 300 duration(duration) {} |
301 uint32_t ssrc; | 301 uint32_t ssrc; |
302 int event_code; | 302 int event_code; |
303 int duration; | 303 int duration; |
304 }; | 304 }; |
305 explicit FakeVoiceMediaChannel(FakeVoiceEngine* engine, | 305 explicit FakeVoiceMediaChannel(FakeVoiceEngine* engine, |
306 const AudioOptions& options) | 306 const AudioOptions& options) |
307 : engine_(engine), time_since_last_typing_(-1), max_bps_(-1) { | 307 : engine_(engine), max_bps_(-1) { |
308 output_scalings_[0] = 1.0; // For default channel. | 308 output_scalings_[0] = 1.0; // For default channel. |
309 SetOptions(options); | 309 SetOptions(options); |
310 } | 310 } |
311 ~FakeVoiceMediaChannel(); | 311 ~FakeVoiceMediaChannel(); |
312 const std::vector<AudioCodec>& recv_codecs() const { return recv_codecs_; } | 312 const std::vector<AudioCodec>& recv_codecs() const { return recv_codecs_; } |
313 const std::vector<AudioCodec>& send_codecs() const { return send_codecs_; } | 313 const std::vector<AudioCodec>& send_codecs() const { return send_codecs_; } |
314 const std::vector<AudioCodec>& codecs() const { return send_codecs(); } | 314 const std::vector<AudioCodec>& codecs() const { return send_codecs(); } |
315 const std::vector<DtmfInfo>& dtmf_info_queue() const { | 315 const std::vector<DtmfInfo>& dtmf_info_queue() const { |
316 return dtmf_info_queue_; | 316 return dtmf_info_queue_; |
317 } | 317 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 } | 359 } |
360 virtual bool RemoveRecvStream(uint32_t ssrc) { | 360 virtual bool RemoveRecvStream(uint32_t ssrc) { |
361 if (!RtpHelper<VoiceMediaChannel>::RemoveRecvStream(ssrc)) | 361 if (!RtpHelper<VoiceMediaChannel>::RemoveRecvStream(ssrc)) |
362 return false; | 362 return false; |
363 output_scalings_.erase(ssrc); | 363 output_scalings_.erase(ssrc); |
364 return true; | 364 return true; |
365 } | 365 } |
366 | 366 |
367 virtual bool GetActiveStreams(AudioInfo::StreamList* streams) { return true; } | 367 virtual bool GetActiveStreams(AudioInfo::StreamList* streams) { return true; } |
368 virtual int GetOutputLevel() { return 0; } | 368 virtual int GetOutputLevel() { return 0; } |
369 void set_time_since_last_typing(int ms) { time_since_last_typing_ = ms; } | |
370 virtual int GetTimeSinceLastTyping() { return time_since_last_typing_; } | |
371 virtual void SetTypingDetectionParameters( | |
372 int time_window, int cost_per_typing, int reporting_threshold, | |
373 int penalty_decay, int type_event_delay) {} | |
374 | 369 |
375 virtual bool CanInsertDtmf() { | 370 virtual bool CanInsertDtmf() { |
376 for (std::vector<AudioCodec>::const_iterator it = send_codecs_.begin(); | 371 for (std::vector<AudioCodec>::const_iterator it = send_codecs_.begin(); |
377 it != send_codecs_.end(); ++it) { | 372 it != send_codecs_.end(); ++it) { |
378 // Find the DTMF telephone event "codec". | 373 // Find the DTMF telephone event "codec". |
379 if (_stricmp(it->name.c_str(), "telephone-event") == 0) { | 374 if (_stricmp(it->name.c_str(), "telephone-event") == 0) { |
380 return true; | 375 return true; |
381 } | 376 } |
382 } | 377 } |
383 return false; | 378 return false; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 } | 476 } |
482 } | 477 } |
483 return true; | 478 return true; |
484 } | 479 } |
485 | 480 |
486 FakeVoiceEngine* engine_; | 481 FakeVoiceEngine* engine_; |
487 std::vector<AudioCodec> recv_codecs_; | 482 std::vector<AudioCodec> recv_codecs_; |
488 std::vector<AudioCodec> send_codecs_; | 483 std::vector<AudioCodec> send_codecs_; |
489 std::map<uint32_t, double> output_scalings_; | 484 std::map<uint32_t, double> output_scalings_; |
490 std::vector<DtmfInfo> dtmf_info_queue_; | 485 std::vector<DtmfInfo> dtmf_info_queue_; |
491 int time_since_last_typing_; | |
492 AudioOptions options_; | 486 AudioOptions options_; |
493 std::map<uint32_t, VoiceChannelAudioSink*> local_sinks_; | 487 std::map<uint32_t, VoiceChannelAudioSink*> local_sinks_; |
494 std::unique_ptr<webrtc::AudioSinkInterface> sink_; | 488 std::unique_ptr<webrtc::AudioSinkInterface> sink_; |
495 int max_bps_; | 489 int max_bps_; |
496 }; | 490 }; |
497 | 491 |
498 // A helper function to compare the FakeVoiceMediaChannel::DtmfInfo. | 492 // A helper function to compare the FakeVoiceMediaChannel::DtmfInfo. |
499 inline bool CompareDtmfInfo(const FakeVoiceMediaChannel::DtmfInfo& info, | 493 inline bool CompareDtmfInfo(const FakeVoiceMediaChannel::DtmfInfo& info, |
500 uint32_t ssrc, | 494 uint32_t ssrc, |
501 int event_code, | 495 int event_code, |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 virtual const std::vector<DataCodec>& data_codecs() { return data_codecs_; } | 946 virtual const std::vector<DataCodec>& data_codecs() { return data_codecs_; } |
953 | 947 |
954 private: | 948 private: |
955 std::vector<FakeDataMediaChannel*> channels_; | 949 std::vector<FakeDataMediaChannel*> channels_; |
956 std::vector<DataCodec> data_codecs_; | 950 std::vector<DataCodec> data_codecs_; |
957 }; | 951 }; |
958 | 952 |
959 } // namespace cricket | 953 } // namespace cricket |
960 | 954 |
961 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ | 955 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ |
OLD | NEW |