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

Side by Side Diff: talk/media/webrtc/webrtcvoiceengine.h

Issue 1461333002: Using Rent-A-Codec for static Codec access in WVoE/MC. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase 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
« no previous file with comments | « talk/media/webrtc/fakewebrtcvoiceengine.h ('k') | talk/media/webrtc/webrtcvoiceengine.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 class AudioDeviceModule; 51 class AudioDeviceModule;
52 class AudioRenderer; 52 class AudioRenderer;
53 class VoEWrapper; 53 class VoEWrapper;
54 class WebRtcVoiceMediaChannel; 54 class WebRtcVoiceMediaChannel;
55 55
56 // WebRtcVoiceEngine is a class to be used with CompositeMediaEngine. 56 // WebRtcVoiceEngine is a class to be used with CompositeMediaEngine.
57 // It uses the WebRtc VoiceEngine library for audio handling. 57 // It uses the WebRtc VoiceEngine library for audio handling.
58 class WebRtcVoiceEngine final : public webrtc::TraceCallback { 58 class WebRtcVoiceEngine final : public webrtc::TraceCallback {
59 friend class WebRtcVoiceMediaChannel; 59 friend class WebRtcVoiceMediaChannel;
60 public:
61 // Exposed for the WVoE/MC unit test.
62 static bool ToCodecInst(const AudioCodec& in, webrtc::CodecInst* out);
60 63
61 public:
62 WebRtcVoiceEngine(); 64 WebRtcVoiceEngine();
63 // Dependency injection for testing. 65 // Dependency injection for testing.
64 explicit WebRtcVoiceEngine(VoEWrapper* voe_wrapper); 66 explicit WebRtcVoiceEngine(VoEWrapper* voe_wrapper);
65 ~WebRtcVoiceEngine(); 67 ~WebRtcVoiceEngine();
66 bool Init(rtc::Thread* worker_thread); 68 bool Init(rtc::Thread* worker_thread);
67 void Terminate(); 69 void Terminate();
68 70
69 rtc::scoped_refptr<webrtc::AudioState> GetAudioState() const; 71 rtc::scoped_refptr<webrtc::AudioState> GetAudioState() const;
70 VoiceMediaChannel* CreateChannel(webrtc::Call* call, 72 VoiceMediaChannel* CreateChannel(webrtc::Call* call,
71 const AudioOptions& options); 73 const AudioOptions& options);
72 74
73 AudioOptions GetOptions() const { return options_; } 75 AudioOptions GetOptions() const { return options_; }
74 bool SetOptions(const AudioOptions& options); 76 bool SetOptions(const AudioOptions& options);
75 bool SetDevices(const Device* in_device, const Device* out_device); 77 bool SetDevices(const Device* in_device, const Device* out_device);
76 bool GetOutputVolume(int* level); 78 bool GetOutputVolume(int* level);
77 bool SetOutputVolume(int level); 79 bool SetOutputVolume(int level);
78 int GetInputLevel(); 80 int GetInputLevel();
79 81
80 const std::vector<AudioCodec>& codecs(); 82 const std::vector<AudioCodec>& codecs();
81 bool FindCodec(const AudioCodec& codec);
82 bool FindWebRtcCodec(const AudioCodec& codec, webrtc::CodecInst* gcodec);
83
84 const std::vector<RtpHeaderExtension>& rtp_header_extensions() const; 83 const std::vector<RtpHeaderExtension>& rtp_header_extensions() const;
85 84
86 // For tracking WebRtc channels. Needed because we have to pause them 85 // For tracking WebRtc channels. Needed because we have to pause them
87 // all when switching devices. 86 // all when switching devices.
88 // May only be called by WebRtcVoiceMediaChannel. 87 // May only be called by WebRtcVoiceMediaChannel.
89 void RegisterChannel(WebRtcVoiceMediaChannel* channel); 88 void RegisterChannel(WebRtcVoiceMediaChannel* channel);
90 void UnregisterChannel(WebRtcVoiceMediaChannel* channel); 89 void UnregisterChannel(WebRtcVoiceMediaChannel* channel);
91 90
92 // Called by WebRtcVoiceMediaChannel to set a gain offset from 91 // Called by WebRtcVoiceMediaChannel to set a gain offset from
93 // the default AGC target level. 92 // the default AGC target level.
(...skipping 13 matching lines...) Expand all
107 106
108 // Starts recording an RtcEventLog using an existing file until 10 minutes 107 // Starts recording an RtcEventLog using an existing file until 10 minutes
109 // pass or the StopRtcEventLog function is called. 108 // pass or the StopRtcEventLog function is called.
110 bool StartRtcEventLog(rtc::PlatformFile file); 109 bool StartRtcEventLog(rtc::PlatformFile file);
111 110
112 // Stops recording the RtcEventLog. 111 // Stops recording the RtcEventLog.
113 void StopRtcEventLog(); 112 void StopRtcEventLog();
114 113
115 private: 114 private:
116 void Construct(); 115 void Construct();
117 void ConstructCodecs();
118 bool GetVoeCodec(int index, webrtc::CodecInst* codec);
119 bool InitInternal(); 116 bool InitInternal();
120 // Every option that is "set" will be applied. Every option not "set" will be 117 // Every option that is "set" will be applied. Every option not "set" will be
121 // ignored. This allows us to selectively turn on and off different options 118 // ignored. This allows us to selectively turn on and off different options
122 // easily at any time. 119 // easily at any time.
123 bool ApplyOptions(const AudioOptions& options); 120 bool ApplyOptions(const AudioOptions& options);
124 121
125 // webrtc::TraceCallback: 122 // webrtc::TraceCallback:
126 void Print(webrtc::TraceLevel level, const char* trace, int length) override; 123 void Print(webrtc::TraceLevel level, const char* trace, int length) override;
127 124
128 // Given the device type, name, and id, find device id. Return true and 125 // Given the device type, name, and id, find device id. Return true and
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 bool ChangePlayout(bool playout); 248 bool ChangePlayout(bool playout);
252 bool ChangeSend(SendFlags send); 249 bool ChangeSend(SendFlags send);
253 bool ChangeSend(int channel, SendFlags send); 250 bool ChangeSend(int channel, SendFlags send);
254 int CreateVoEChannel(); 251 int CreateVoEChannel();
255 bool DeleteVoEChannel(int channel); 252 bool DeleteVoEChannel(int channel);
256 bool IsDefaultRecvStream(uint32_t ssrc) { 253 bool IsDefaultRecvStream(uint32_t ssrc) {
257 return default_recv_ssrc_ == static_cast<int64_t>(ssrc); 254 return default_recv_ssrc_ == static_cast<int64_t>(ssrc);
258 } 255 }
259 bool SetSendCodecs(int channel, const std::vector<AudioCodec>& codecs); 256 bool SetSendCodecs(int channel, const std::vector<AudioCodec>& codecs);
260 bool SetSendBitrateInternal(int bps); 257 bool SetSendBitrateInternal(int bps);
261 bool SetRecvCodecsInternal(const std::vector<AudioCodec>& new_codecs);
262 258
263 rtc::ThreadChecker worker_thread_checker_; 259 rtc::ThreadChecker worker_thread_checker_;
264 260
265 WebRtcVoiceEngine* const engine_ = nullptr; 261 WebRtcVoiceEngine* const engine_ = nullptr;
266 std::vector<AudioCodec> recv_codecs_; 262 std::vector<AudioCodec> recv_codecs_;
267 std::vector<AudioCodec> send_codecs_; 263 std::vector<AudioCodec> send_codecs_;
268 rtc::scoped_ptr<webrtc::CodecInst> send_codec_; 264 rtc::scoped_ptr<webrtc::CodecInst> send_codec_;
269 bool send_bitrate_setting_ = false; 265 bool send_bitrate_setting_ = false;
270 int send_bitrate_bps_ = 0; 266 int send_bitrate_bps_ = 0;
271 AudioOptions options_; 267 AudioOptions options_;
(...skipping 20 matching lines...) Expand all
292 288
293 class WebRtcAudioReceiveStream; 289 class WebRtcAudioReceiveStream;
294 std::map<uint32_t, WebRtcAudioReceiveStream*> recv_streams_; 290 std::map<uint32_t, WebRtcAudioReceiveStream*> recv_streams_;
295 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; 291 std::vector<webrtc::RtpExtension> recv_rtp_extensions_;
296 292
297 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel); 293 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel);
298 }; 294 };
299 } // namespace cricket 295 } // namespace cricket
300 296
301 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_ 297 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_
OLDNEW
« no previous file with comments | « talk/media/webrtc/fakewebrtcvoiceengine.h ('k') | talk/media/webrtc/webrtcvoiceengine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698