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

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: Add thread check, Remove bits_per_sample and use int16_t. 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"
the sun 2015/12/11 16:32:04 one too many
tommi (sloooow) - chröme 2015/12/11 17:51:18 Acknowledged.
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(
351 uint32_t ssrc,
352 rtc::scoped_ptr<webrtc::AudioSinkInterface> sink) {
353 sink_ = std::move(sink);
the sun 2015/12/11 16:32:04 If you're doing tests in a separate CL, can you sk
tommi (sloooow) - chröme 2015/12/11 17:51:18 This runs in existing tests. The code isn't _comp
the sun 2015/12/11 19:46:28 Ah, thanks for explaining. I hadn't looked at the
354 }
355
349 private: 356 private:
350 class VoiceChannelAudioSink : public AudioRenderer::Sink { 357 class VoiceChannelAudioSink : public AudioRenderer::Sink {
351 public: 358 public:
352 explicit VoiceChannelAudioSink(AudioRenderer* renderer) 359 explicit VoiceChannelAudioSink(AudioRenderer* renderer)
353 : renderer_(renderer) { 360 : renderer_(renderer) {
354 renderer_->SetSink(this); 361 renderer_->SetSink(this);
355 } 362 }
356 virtual ~VoiceChannelAudioSink() { 363 virtual ~VoiceChannelAudioSink() {
357 if (renderer_) { 364 if (renderer_) {
358 renderer_->SetSink(NULL); 365 renderer_->SetSink(NULL);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 } 418 }
412 419
413 FakeVoiceEngine* engine_; 420 FakeVoiceEngine* engine_;
414 std::vector<AudioCodec> recv_codecs_; 421 std::vector<AudioCodec> recv_codecs_;
415 std::vector<AudioCodec> send_codecs_; 422 std::vector<AudioCodec> send_codecs_;
416 std::map<uint32_t, double> output_scalings_; 423 std::map<uint32_t, double> output_scalings_;
417 std::vector<DtmfInfo> dtmf_info_queue_; 424 std::vector<DtmfInfo> dtmf_info_queue_;
418 int time_since_last_typing_; 425 int time_since_last_typing_;
419 AudioOptions options_; 426 AudioOptions options_;
420 std::map<uint32_t, VoiceChannelAudioSink*> local_renderers_; 427 std::map<uint32_t, VoiceChannelAudioSink*> local_renderers_;
428 rtc::scoped_ptr<webrtc::AudioSinkInterface> sink_;
421 }; 429 };
422 430
423 // A helper function to compare the FakeVoiceMediaChannel::DtmfInfo. 431 // A helper function to compare the FakeVoiceMediaChannel::DtmfInfo.
424 inline bool CompareDtmfInfo(const FakeVoiceMediaChannel::DtmfInfo& info, 432 inline bool CompareDtmfInfo(const FakeVoiceMediaChannel::DtmfInfo& info,
425 uint32_t ssrc, 433 uint32_t ssrc,
426 int event_code, 434 int event_code,
427 int duration) { 435 int duration) {
428 return (info.duration == duration && info.event_code == event_code && 436 return (info.duration == duration && info.event_code == event_code &&
429 info.ssrc == ssrc); 437 info.ssrc == ssrc);
430 } 438 }
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 950
943 private: 951 private:
944 std::vector<FakeDataMediaChannel*> channels_; 952 std::vector<FakeDataMediaChannel*> channels_;
945 std::vector<DataCodec> data_codecs_; 953 std::vector<DataCodec> data_codecs_;
946 DataChannelType last_channel_type_; 954 DataChannelType last_channel_type_;
947 }; 955 };
948 956
949 } // namespace cricket 957 } // namespace cricket
950 958
951 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ 959 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698