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 20 matching lines...) Expand all Loading... |
31 #include <list> | 31 #include <list> |
32 #include <map> | 32 #include <map> |
33 #include <set> | 33 #include <set> |
34 #include <string> | 34 #include <string> |
35 #include <vector> | 35 #include <vector> |
36 | 36 |
37 #include "talk/media/base/audiorenderer.h" | 37 #include "talk/media/base/audiorenderer.h" |
38 #include "talk/media/base/mediaengine.h" | 38 #include "talk/media/base/mediaengine.h" |
39 #include "talk/media/base/rtputils.h" | 39 #include "talk/media/base/rtputils.h" |
40 #include "talk/media/base/streamparams.h" | 40 #include "talk/media/base/streamparams.h" |
41 #include "webrtc/p2p/base/sessiondescription.h" | |
42 #include "webrtc/base/buffer.h" | 41 #include "webrtc/base/buffer.h" |
43 #include "webrtc/base/stringutils.h" | 42 #include "webrtc/base/stringutils.h" |
| 43 #include "webrtc/p2p/base/sessiondescription.h" |
44 | 44 |
45 namespace cricket { | 45 namespace cricket { |
46 | 46 |
47 class FakeMediaEngine; | 47 class FakeMediaEngine; |
48 class FakeVideoEngine; | 48 class FakeVideoEngine; |
49 class FakeVoiceEngine; | 49 class FakeVoiceEngine; |
50 | 50 |
51 // A common helper class that handles sending and receiving RTP/RTCP packets. | 51 // A common helper class that handles sending and receiving RTP/RTCP packets. |
52 template <class Base> class RtpHelper : public Base { | 52 template <class Base> class RtpHelper : public Base { |
53 public: | 53 public: |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 } | 339 } |
340 bool GetOutputVolume(uint32_t ssrc, double* volume) { | 340 bool GetOutputVolume(uint32_t ssrc, double* volume) { |
341 if (output_scalings_.find(ssrc) == output_scalings_.end()) | 341 if (output_scalings_.find(ssrc) == output_scalings_.end()) |
342 return false; | 342 return false; |
343 *volume = output_scalings_[ssrc]; | 343 *volume = output_scalings_[ssrc]; |
344 return true; | 344 return true; |
345 } | 345 } |
346 | 346 |
347 virtual bool GetStats(VoiceMediaInfo* info) { return false; } | 347 virtual bool GetStats(VoiceMediaInfo* info) { return false; } |
348 | 348 |
| 349 virtual void SetRawAudioSink( |
| 350 uint32_t ssrc, |
| 351 rtc::scoped_ptr<webrtc::AudioSinkInterface> sink) { |
| 352 sink_ = std::move(sink); |
| 353 } |
| 354 |
349 private: | 355 private: |
350 class VoiceChannelAudioSink : public AudioRenderer::Sink { | 356 class VoiceChannelAudioSink : public AudioRenderer::Sink { |
351 public: | 357 public: |
352 explicit VoiceChannelAudioSink(AudioRenderer* renderer) | 358 explicit VoiceChannelAudioSink(AudioRenderer* renderer) |
353 : renderer_(renderer) { | 359 : renderer_(renderer) { |
354 renderer_->SetSink(this); | 360 renderer_->SetSink(this); |
355 } | 361 } |
356 virtual ~VoiceChannelAudioSink() { | 362 virtual ~VoiceChannelAudioSink() { |
357 if (renderer_) { | 363 if (renderer_) { |
358 renderer_->SetSink(NULL); | 364 renderer_->SetSink(NULL); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 } | 417 } |
412 | 418 |
413 FakeVoiceEngine* engine_; | 419 FakeVoiceEngine* engine_; |
414 std::vector<AudioCodec> recv_codecs_; | 420 std::vector<AudioCodec> recv_codecs_; |
415 std::vector<AudioCodec> send_codecs_; | 421 std::vector<AudioCodec> send_codecs_; |
416 std::map<uint32_t, double> output_scalings_; | 422 std::map<uint32_t, double> output_scalings_; |
417 std::vector<DtmfInfo> dtmf_info_queue_; | 423 std::vector<DtmfInfo> dtmf_info_queue_; |
418 int time_since_last_typing_; | 424 int time_since_last_typing_; |
419 AudioOptions options_; | 425 AudioOptions options_; |
420 std::map<uint32_t, VoiceChannelAudioSink*> local_renderers_; | 426 std::map<uint32_t, VoiceChannelAudioSink*> local_renderers_; |
| 427 rtc::scoped_ptr<webrtc::AudioSinkInterface> sink_; |
421 }; | 428 }; |
422 | 429 |
423 // A helper function to compare the FakeVoiceMediaChannel::DtmfInfo. | 430 // A helper function to compare the FakeVoiceMediaChannel::DtmfInfo. |
424 inline bool CompareDtmfInfo(const FakeVoiceMediaChannel::DtmfInfo& info, | 431 inline bool CompareDtmfInfo(const FakeVoiceMediaChannel::DtmfInfo& info, |
425 uint32_t ssrc, | 432 uint32_t ssrc, |
426 int event_code, | 433 int event_code, |
427 int duration) { | 434 int duration) { |
428 return (info.duration == duration && info.event_code == event_code && | 435 return (info.duration == duration && info.event_code == event_code && |
429 info.ssrc == ssrc); | 436 info.ssrc == ssrc); |
430 } | 437 } |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 | 949 |
943 private: | 950 private: |
944 std::vector<FakeDataMediaChannel*> channels_; | 951 std::vector<FakeDataMediaChannel*> channels_; |
945 std::vector<DataCodec> data_codecs_; | 952 std::vector<DataCodec> data_codecs_; |
946 DataChannelType last_channel_type_; | 953 DataChannelType last_channel_type_; |
947 }; | 954 }; |
948 | 955 |
949 } // namespace cricket | 956 } // namespace cricket |
950 | 957 |
951 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ | 958 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ |
OLD | NEW |