Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(700)

Side by Side Diff: talk/media/base/fakemediaengine.h

Issue 1505253004: Support for remote audio into tracks (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: New AudioSink added Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 17 matching lines...) Expand all
28 #ifndef TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ 28 #ifndef TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_
29 #define TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ 29 #define TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_
30 30
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/audiorenderer.h"
perkj_webrtc 2015/12/13 19:26:47 nit: remove extra
tommi 2015/12/13 19:46:33 Done in the last patch set
38 #include "talk/media/base/mediaengine.h" 39 #include "talk/media/base/mediaengine.h"
39 #include "talk/media/base/rtputils.h" 40 #include "talk/media/base/rtputils.h"
40 #include "talk/media/base/streamparams.h" 41 #include "talk/media/base/streamparams.h"
41 #include "webrtc/p2p/base/sessiondescription.h"
42 #include "webrtc/base/buffer.h" 42 #include "webrtc/base/buffer.h"
43 #include "webrtc/base/stringutils.h" 43 #include "webrtc/base/stringutils.h"
44 #include "webrtc/p2p/base/sessiondescription.h"
44 45
45 namespace cricket { 46 namespace cricket {
46 47
47 class FakeMediaEngine; 48 class FakeMediaEngine;
48 class FakeVideoEngine; 49 class FakeVideoEngine;
49 class FakeVoiceEngine; 50 class FakeVoiceEngine;
50 51
51 // A common helper class that handles sending and receiving RTP/RTCP packets. 52 // A common helper class that handles sending and receiving RTP/RTCP packets.
52 template <class Base> class RtpHelper : public Base { 53 template <class Base> class RtpHelper : public Base {
53 public: 54 public:
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } 340 }
340 bool GetOutputVolume(uint32_t ssrc, double* volume) { 341 bool GetOutputVolume(uint32_t ssrc, double* volume) {
341 if (output_scalings_.find(ssrc) == output_scalings_.end()) 342 if (output_scalings_.find(ssrc) == output_scalings_.end())
342 return false; 343 return false;
343 *volume = output_scalings_[ssrc]; 344 *volume = output_scalings_[ssrc];
344 return true; 345 return true;
345 } 346 }
346 347
347 virtual bool GetStats(VoiceMediaInfo* info) { return false; } 348 virtual bool GetStats(VoiceMediaInfo* info) { return false; }
348 349
350 virtual void SetRawAudioSink(uint32_t ssrc,
351 rtc::scoped_ptr<webrtc::AudioSink> 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
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::AudioSink> 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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698