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 |
11 #ifndef WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ | 11 #ifndef WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ |
12 #define WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ | 12 #define WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ |
13 | 13 |
14 #include <list> | 14 #include <list> |
15 #include <map> | 15 #include <map> |
| 16 #include <memory> |
16 #include <set> | 17 #include <set> |
17 #include <string> | 18 #include <string> |
18 #include <vector> | 19 #include <vector> |
19 | 20 |
20 #include "webrtc/audio/audio_sink.h" | 21 #include "webrtc/audio/audio_sink.h" |
21 #include "webrtc/base/buffer.h" | 22 #include "webrtc/base/buffer.h" |
22 #include "webrtc/base/stringutils.h" | 23 #include "webrtc/base/stringutils.h" |
23 #include "webrtc/media/base/audiorenderer.h" | 24 #include "webrtc/media/base/audiorenderer.h" |
24 #include "webrtc/media/base/mediaengine.h" | 25 #include "webrtc/media/base/mediaengine.h" |
25 #include "webrtc/media/base/rtputils.h" | 26 #include "webrtc/media/base/rtputils.h" |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 if (output_scalings_.find(ssrc) == output_scalings_.end()) | 326 if (output_scalings_.find(ssrc) == output_scalings_.end()) |
326 return false; | 327 return false; |
327 *volume = output_scalings_[ssrc]; | 328 *volume = output_scalings_[ssrc]; |
328 return true; | 329 return true; |
329 } | 330 } |
330 | 331 |
331 virtual bool GetStats(VoiceMediaInfo* info) { return false; } | 332 virtual bool GetStats(VoiceMediaInfo* info) { return false; } |
332 | 333 |
333 virtual void SetRawAudioSink( | 334 virtual void SetRawAudioSink( |
334 uint32_t ssrc, | 335 uint32_t ssrc, |
335 rtc::scoped_ptr<webrtc::AudioSinkInterface> sink) { | 336 std::unique_ptr<webrtc::AudioSinkInterface> sink) { |
336 sink_ = std::move(sink); | 337 sink_ = std::move(sink); |
337 } | 338 } |
338 | 339 |
339 private: | 340 private: |
340 class VoiceChannelAudioSink : public AudioRenderer::Sink { | 341 class VoiceChannelAudioSink : public AudioRenderer::Sink { |
341 public: | 342 public: |
342 explicit VoiceChannelAudioSink(AudioRenderer* renderer) | 343 explicit VoiceChannelAudioSink(AudioRenderer* renderer) |
343 : renderer_(renderer) { | 344 : renderer_(renderer) { |
344 renderer_->SetSink(this); | 345 renderer_->SetSink(this); |
345 } | 346 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 } | 402 } |
402 | 403 |
403 FakeVoiceEngine* engine_; | 404 FakeVoiceEngine* engine_; |
404 std::vector<AudioCodec> recv_codecs_; | 405 std::vector<AudioCodec> recv_codecs_; |
405 std::vector<AudioCodec> send_codecs_; | 406 std::vector<AudioCodec> send_codecs_; |
406 std::map<uint32_t, double> output_scalings_; | 407 std::map<uint32_t, double> output_scalings_; |
407 std::vector<DtmfInfo> dtmf_info_queue_; | 408 std::vector<DtmfInfo> dtmf_info_queue_; |
408 int time_since_last_typing_; | 409 int time_since_last_typing_; |
409 AudioOptions options_; | 410 AudioOptions options_; |
410 std::map<uint32_t, VoiceChannelAudioSink*> local_renderers_; | 411 std::map<uint32_t, VoiceChannelAudioSink*> local_renderers_; |
411 rtc::scoped_ptr<webrtc::AudioSinkInterface> sink_; | 412 std::unique_ptr<webrtc::AudioSinkInterface> sink_; |
412 }; | 413 }; |
413 | 414 |
414 // A helper function to compare the FakeVoiceMediaChannel::DtmfInfo. | 415 // A helper function to compare the FakeVoiceMediaChannel::DtmfInfo. |
415 inline bool CompareDtmfInfo(const FakeVoiceMediaChannel::DtmfInfo& info, | 416 inline bool CompareDtmfInfo(const FakeVoiceMediaChannel::DtmfInfo& info, |
416 uint32_t ssrc, | 417 uint32_t ssrc, |
417 int event_code, | 418 int event_code, |
418 int duration) { | 419 int duration) { |
419 return (info.duration == duration && info.event_code == event_code && | 420 return (info.duration == duration && info.event_code == event_code && |
420 info.ssrc == ssrc); | 421 info.ssrc == ssrc); |
421 } | 422 } |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 | 869 |
869 private: | 870 private: |
870 std::vector<FakeDataMediaChannel*> channels_; | 871 std::vector<FakeDataMediaChannel*> channels_; |
871 std::vector<DataCodec> data_codecs_; | 872 std::vector<DataCodec> data_codecs_; |
872 DataChannelType last_channel_type_; | 873 DataChannelType last_channel_type_; |
873 }; | 874 }; |
874 | 875 |
875 } // namespace cricket | 876 } // namespace cricket |
876 | 877 |
877 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ | 878 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ |
OLD | NEW |