| 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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 return false; | 293 return false; |
| 294 output_scalings_[sp.first_ssrc()] = 1.0; | 294 output_scalings_[sp.first_ssrc()] = 1.0; |
| 295 return true; | 295 return true; |
| 296 } | 296 } |
| 297 virtual bool RemoveRecvStream(uint32_t ssrc) { | 297 virtual bool RemoveRecvStream(uint32_t ssrc) { |
| 298 if (!RtpHelper<VoiceMediaChannel>::RemoveRecvStream(ssrc)) | 298 if (!RtpHelper<VoiceMediaChannel>::RemoveRecvStream(ssrc)) |
| 299 return false; | 299 return false; |
| 300 output_scalings_.erase(ssrc); | 300 output_scalings_.erase(ssrc); |
| 301 return true; | 301 return true; |
| 302 } | 302 } |
| 303 virtual bool SetRemoteRenderer(uint32_t ssrc, AudioRenderer* renderer) { | |
| 304 std::map<uint32_t, AudioRenderer*>::iterator it = | |
| 305 remote_renderers_.find(ssrc); | |
| 306 if (renderer) { | |
| 307 if (it != remote_renderers_.end()) { | |
| 308 ASSERT(it->second == renderer); | |
| 309 } else { | |
| 310 remote_renderers_.insert(std::make_pair(ssrc, renderer)); | |
| 311 } | |
| 312 } else { | |
| 313 if (it != remote_renderers_.end()) { | |
| 314 remote_renderers_.erase(it); | |
| 315 } else { | |
| 316 return false; | |
| 317 } | |
| 318 } | |
| 319 return true; | |
| 320 } | |
| 321 | 303 |
| 322 virtual bool GetActiveStreams(AudioInfo::StreamList* streams) { return true; } | 304 virtual bool GetActiveStreams(AudioInfo::StreamList* streams) { return true; } |
| 323 virtual int GetOutputLevel() { return 0; } | 305 virtual int GetOutputLevel() { return 0; } |
| 324 void set_time_since_last_typing(int ms) { time_since_last_typing_ = ms; } | 306 void set_time_since_last_typing(int ms) { time_since_last_typing_ = ms; } |
| 325 virtual int GetTimeSinceLastTyping() { return time_since_last_typing_; } | 307 virtual int GetTimeSinceLastTyping() { return time_since_last_typing_; } |
| 326 virtual void SetTypingDetectionParameters( | 308 virtual void SetTypingDetectionParameters( |
| 327 int time_window, int cost_per_typing, int reporting_threshold, | 309 int time_window, int cost_per_typing, int reporting_threshold, |
| 328 int penalty_decay, int type_event_delay) {} | 310 int penalty_decay, int type_event_delay) {} |
| 329 | 311 |
| 330 virtual bool CanInsertDtmf() { | 312 virtual bool CanInsertDtmf() { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 } | 414 } |
| 433 | 415 |
| 434 FakeVoiceEngine* engine_; | 416 FakeVoiceEngine* engine_; |
| 435 std::vector<AudioCodec> recv_codecs_; | 417 std::vector<AudioCodec> recv_codecs_; |
| 436 std::vector<AudioCodec> send_codecs_; | 418 std::vector<AudioCodec> send_codecs_; |
| 437 std::map<uint32_t, double> output_scalings_; | 419 std::map<uint32_t, double> output_scalings_; |
| 438 std::vector<DtmfInfo> dtmf_info_queue_; | 420 std::vector<DtmfInfo> dtmf_info_queue_; |
| 439 int time_since_last_typing_; | 421 int time_since_last_typing_; |
| 440 AudioOptions options_; | 422 AudioOptions options_; |
| 441 std::map<uint32_t, VoiceChannelAudioSink*> local_renderers_; | 423 std::map<uint32_t, VoiceChannelAudioSink*> local_renderers_; |
| 442 std::map<uint32_t, AudioRenderer*> remote_renderers_; | |
| 443 }; | 424 }; |
| 444 | 425 |
| 445 // A helper function to compare the FakeVoiceMediaChannel::DtmfInfo. | 426 // A helper function to compare the FakeVoiceMediaChannel::DtmfInfo. |
| 446 inline bool CompareDtmfInfo(const FakeVoiceMediaChannel::DtmfInfo& info, | 427 inline bool CompareDtmfInfo(const FakeVoiceMediaChannel::DtmfInfo& info, |
| 447 uint32_t ssrc, | 428 uint32_t ssrc, |
| 448 int event_code, | 429 int event_code, |
| 449 int duration, | 430 int duration, |
| 450 int flags) { | 431 int flags) { |
| 451 return (info.duration == duration && info.event_code == event_code && | 432 return (info.duration == duration && info.event_code == event_code && |
| 452 info.flags == flags && info.ssrc == ssrc); | 433 info.flags == flags && info.ssrc == ssrc); |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 | 979 |
| 999 private: | 980 private: |
| 1000 std::vector<FakeDataMediaChannel*> channels_; | 981 std::vector<FakeDataMediaChannel*> channels_; |
| 1001 std::vector<DataCodec> data_codecs_; | 982 std::vector<DataCodec> data_codecs_; |
| 1002 DataChannelType last_channel_type_; | 983 DataChannelType last_channel_type_; |
| 1003 }; | 984 }; |
| 1004 | 985 |
| 1005 } // namespace cricket | 986 } // namespace cricket |
| 1006 | 987 |
| 1007 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ | 988 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ |
| OLD | NEW |