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

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

Issue 1327933002: Full impl of NnChannel::SetSendParameters and NnChannel::SetRecvParameters (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years, 3 months 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 Settable<bool> extended_filter_aec_; 273 Settable<bool> extended_filter_aec_;
274 Settable<bool> delay_agnostic_aec_; 274 Settable<bool> delay_agnostic_aec_;
275 Settable<bool> experimental_ns_; 275 Settable<bool> experimental_ns_;
276 }; 276 };
277 277
278 // WebRtcVoiceMediaChannel is an implementation of VoiceMediaChannel that uses 278 // WebRtcVoiceMediaChannel is an implementation of VoiceMediaChannel that uses
279 // WebRtc Voice Engine. 279 // WebRtc Voice Engine.
280 class WebRtcVoiceMediaChannel : public VoiceMediaChannel, 280 class WebRtcVoiceMediaChannel : public VoiceMediaChannel,
281 public webrtc::Transport { 281 public webrtc::Transport {
282 public: 282 public:
283 explicit WebRtcVoiceMediaChannel(WebRtcVoiceEngine *engine); 283 WebRtcVoiceMediaChannel(WebRtcVoiceEngine *engine,
284 const AudioOptions& options);
284 ~WebRtcVoiceMediaChannel() override; 285 ~WebRtcVoiceMediaChannel() override;
285 286
286 int voe_channel() const { return voe_channel_; } 287 int voe_channel() const { return voe_channel_; }
287 bool valid() const { return voe_channel_ != -1; } 288 bool valid() const { return voe_channel_ != -1; }
288 const AudioOptions& options() const { return options_; } 289 const AudioOptions& options() const { return options_; }
289 290
290 bool SetSendParameters(const AudioSendParameters& params) override; 291 bool SetSendParameters(const AudioSendParameters& params) override;
291 bool SetRecvParameters(const AudioRecvParameters& params) override; 292 bool SetRecvParameters(const AudioRecvParameters& params) override;
292 bool SetOptions(const AudioOptions& options) override;
293 bool SetRecvCodecs(const std::vector<AudioCodec>& codecs) override;
294 bool SetSendCodecs(const std::vector<AudioCodec>& codecs) override;
295 bool SetRecvRtpHeaderExtensions(
296 const std::vector<RtpHeaderExtension>& extensions) override;
297 bool SetSendRtpHeaderExtensions(
298 const std::vector<RtpHeaderExtension>& extensions) override;
299 bool SetPlayout(bool playout) override; 293 bool SetPlayout(bool playout) override;
300 bool PausePlayout(); 294 bool PausePlayout();
301 bool ResumePlayout(); 295 bool ResumePlayout();
302 bool SetSend(SendFlags send) override; 296 bool SetSend(SendFlags send) override;
303 bool PauseSend(); 297 bool PauseSend();
304 bool ResumeSend(); 298 bool ResumeSend();
305 bool SetAudioSend(uint32 ssrc, bool mute, const AudioOptions* options, 299 bool SetAudioSend(uint32 ssrc, bool mute, const AudioOptions* options,
306 AudioRenderer* renderer) override; 300 AudioRenderer* renderer) override;
307 bool AddSendStream(const StreamParams& sp) override; 301 bool AddSendStream(const StreamParams& sp) override;
308 bool RemoveSendStream(uint32 ssrc) override; 302 bool RemoveSendStream(uint32 ssrc) override;
(...skipping 13 matching lines...) Expand all
322 bool SetRingbackTone(const char* buf, int len) override; 316 bool SetRingbackTone(const char* buf, int len) override;
323 bool PlayRingbackTone(uint32 ssrc, bool play, bool loop) override; 317 bool PlayRingbackTone(uint32 ssrc, bool play, bool loop) override;
324 bool CanInsertDtmf() override; 318 bool CanInsertDtmf() override;
325 bool InsertDtmf(uint32 ssrc, int event, int duration, int flags) override; 319 bool InsertDtmf(uint32 ssrc, int event, int duration, int flags) override;
326 320
327 void OnPacketReceived(rtc::Buffer* packet, 321 void OnPacketReceived(rtc::Buffer* packet,
328 const rtc::PacketTime& packet_time) override; 322 const rtc::PacketTime& packet_time) override;
329 void OnRtcpReceived(rtc::Buffer* packet, 323 void OnRtcpReceived(rtc::Buffer* packet,
330 const rtc::PacketTime& packet_time) override; 324 const rtc::PacketTime& packet_time) override;
331 void OnReadyToSend(bool ready) override {} 325 void OnReadyToSend(bool ready) override {}
332 bool SetMaxSendBandwidth(int bps) override;
333 bool GetStats(VoiceMediaInfo* info) override; 326 bool GetStats(VoiceMediaInfo* info) override;
334 // Gets last reported error from WebRtc voice engine. This should be only 327 // Gets last reported error from WebRtc voice engine. This should be only
335 // called in response a failure. 328 // called in response a failure.
336 void GetLastMediaError(uint32* ssrc, 329 void GetLastMediaError(uint32* ssrc,
337 VoiceMediaChannel::Error* error) override; 330 VoiceMediaChannel::Error* error) override;
338 331
339 // implements Transport interface 332 // implements Transport interface
340 int SendPacket(int channel, const void* data, size_t len) override { 333 int SendPacket(int channel, const void* data, size_t len) override {
341 rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len, 334 rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len,
342 kMaxRtpPacketLen); 335 kMaxRtpPacketLen);
343 return VoiceMediaChannel::SendPacket(&packet) ? static_cast<int>(len) : -1; 336 return VoiceMediaChannel::SendPacket(&packet) ? static_cast<int>(len) : -1;
344 } 337 }
345 338
346 int SendRTCPPacket(int channel, const void* data, size_t len) override { 339 int SendRTCPPacket(int channel, const void* data, size_t len) override {
347 rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len, 340 rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len,
348 kMaxRtpPacketLen); 341 kMaxRtpPacketLen);
349 return VoiceMediaChannel::SendRtcp(&packet) ? static_cast<int>(len) : -1; 342 return VoiceMediaChannel::SendRtcp(&packet) ? static_cast<int>(len) : -1;
350 } 343 }
351 344
352 bool FindSsrc(int channel_num, uint32* ssrc); 345 bool FindSsrc(int channel_num, uint32* ssrc);
353 void OnError(uint32 ssrc, int error); 346 void OnError(uint32 ssrc, int error);
354 347
355 bool sending() const { return send_ != SEND_NOTHING; } 348 bool sending() const { return send_ != SEND_NOTHING; }
356 int GetReceiveChannelNum(uint32 ssrc) const; 349 int GetReceiveChannelNum(uint32 ssrc) const;
357 int GetSendChannelNum(uint32 ssrc) const; 350 int GetSendChannelNum(uint32 ssrc) const;
358 351
359 void SetCall(webrtc::Call* call); 352 void SetCall(webrtc::Call* call);
360 353
361 private: 354 private:
355 bool SetSendCodecs(const std::vector<AudioCodec>& codecs);
356 bool SetSendRtpHeaderExtensions(
357 const std::vector<RtpHeaderExtension>& extensions);
358 bool SetOptions(const AudioOptions& options);
359 bool SetMaxSendBandwidth(int bps);
360 bool SetRecvCodecs(const std::vector<AudioCodec>& codecs);
361 bool SetRecvRtpHeaderExtensions(
362 const std::vector<RtpHeaderExtension>& extensions);
362 bool SetLocalRenderer(uint32 ssrc, AudioRenderer* renderer); 363 bool SetLocalRenderer(uint32 ssrc, AudioRenderer* renderer);
363 bool MuteStream(uint32 ssrc, bool mute); 364 bool MuteStream(uint32 ssrc, bool mute);
365
364 WebRtcVoiceEngine* engine() { return engine_; } 366 WebRtcVoiceEngine* engine() { return engine_; }
365 int GetLastEngineError() { return engine()->GetLastEngineError(); } 367 int GetLastEngineError() { return engine()->GetLastEngineError(); }
366 int GetOutputLevel(int channel); 368 int GetOutputLevel(int channel);
367 bool GetRedSendCodec(const AudioCodec& red_codec, 369 bool GetRedSendCodec(const AudioCodec& red_codec,
368 const std::vector<AudioCodec>& all_codecs, 370 const std::vector<AudioCodec>& all_codecs,
369 webrtc::CodecInst* send_codec); 371 webrtc::CodecInst* send_codec);
370 bool EnableRtcp(int channel); 372 bool EnableRtcp(int channel);
371 bool ResetRecvCodecs(int channel); 373 bool ResetRecvCodecs(int channel);
372 bool SetPlayout(int channel, bool playout); 374 bool SetPlayout(int channel, bool playout);
373 static uint32 ParseSsrc(const void* data, size_t len, bool rtcp); 375 static uint32 ParseSsrc(const void* data, size_t len, bool rtcp);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; 455 std::vector<webrtc::RtpExtension> recv_rtp_extensions_;
454 456
455 // Do not lock this on the VoE media processor thread; potential for deadlock 457 // Do not lock this on the VoE media processor thread; potential for deadlock
456 // exists. 458 // exists.
457 mutable rtc::CriticalSection receive_channels_cs_; 459 mutable rtc::CriticalSection receive_channels_cs_;
458 }; 460 };
459 461
460 } // namespace cricket 462 } // namespace cricket
461 463
462 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_ 464 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698