2013-07-10 00:45:36 +00:00
|
|
|
/*
|
2016-02-07 20:46:45 -08:00
|
|
|
* Copyright (c) 2004 The WebRTC project authors. All Rights Reserved.
|
2013-07-10 00:45:36 +00:00
|
|
|
*
|
2016-02-07 20:46:45 -08:00
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
2013-07-10 00:45:36 +00:00
|
|
|
*/
|
|
|
|
|
|
2016-02-12 06:39:40 +01:00
|
|
|
#ifndef WEBRTC_MEDIA_ENGINE_WEBRTCVOICEENGINE_H_
|
|
|
|
|
#define WEBRTC_MEDIA_ENGINE_WEBRTCVOICEENGINE_H_
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
#include <map>
|
2016-02-26 03:00:35 -08:00
|
|
|
#include <memory>
|
2013-07-10 00:45:36 +00:00
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2015-11-06 15:34:49 -08:00
|
|
|
#include "webrtc/audio_state.h"
|
2014-08-13 17:26:08 +00:00
|
|
|
#include "webrtc/base/buffer.h"
|
2016-04-26 08:14:39 -07:00
|
|
|
#include "webrtc/base/constructormagic.h"
|
2016-03-29 17:27:21 -07:00
|
|
|
#include "webrtc/base/networkroute.h"
|
2016-03-30 23:28:51 -07:00
|
|
|
#include "webrtc/base/scoped_ref_ptr.h"
|
2014-08-13 17:26:08 +00:00
|
|
|
#include "webrtc/base/stream.h"
|
2015-05-07 14:07:48 +02:00
|
|
|
#include "webrtc/base/thread_checker.h"
|
|
|
|
|
#include "webrtc/call.h"
|
2013-12-05 00:24:06 +00:00
|
|
|
#include "webrtc/common.h"
|
2015-05-11 12:44:23 +02:00
|
|
|
#include "webrtc/config.h"
|
Move talk/media to webrtc/media
I removed the 'libjingle' target in talk/libjingle.gyp and replaced
all users of it with base/base.gyp:rtc_base. It seems the jsoncpp
and expat dependencies were not used by it's previous references.
The files in talk/media/testdata were uploaded to Google Storage and
added .sha1 files in resources/media instead of simply moving them.
The previously disabled warnings that were inherited from
talk/build/common.gypi are now replaced by target-specific disabling
of only the failing warnings. Additional disabling was needed since the stricter
compilation warnings that applies to code in webrtc/.
License headers will be updated in a follow-up CL in order to not
break Git history.
Other modifications:
* Updated the header guards.
* Sorted the includes using chromium/src/tools/sort-headers.py
except for these files:
talk/app/webrtc/peerconnectionendtoend_unittest.cc
talk/app/webrtc/java/jni/androidmediadecoder_jni.cc
talk/app/webrtc/java/jni/androidmediaencoder_jni.cc
webrtc/media/devices/win32devicemanager.cc.
* Unused GYP reference to libjingle_tests_additional_deps was removed.
* Removed duplicated GYP entries of
webrtc/base/testutils.cc
webrtc/base/testutils.h
The HAVE_WEBRTC_VIDEO and HAVE_WEBRTC_VOICE defines were used by only talk/media,
so they were moved to the media.gyp.
I also checked that none of
EXPAT_RELATIVE_PATH,
FEATURE_ENABLE_VOICEMAIL,
GTEST_RELATIVE_PATH,
JSONCPP_RELATIVE_PATH,
LOGGING=1,
SRTP_RELATIVE_PATH,
FEATURE_ENABLE_SSL,
FEATURE_ENABLE_VOICEMAIL,
FEATURE_ENABLE_PSTN,
HAVE_SCTP,
HAVE_SRTP,
are used by the talk/media code.
For Chromium, the following changes will need to be applied to the roll CL that updates the
DEPS for WebRTC and libjingle: https://codereview.chromium.org/1604303002/
BUG=webrtc:5420
NOPRESUBMIT=True
TBR=tommi@webrtc.org
Review URL: https://codereview.webrtc.org/1587193006
Cr-Commit-Position: refs/heads/master@{#11495}
2016-02-04 23:52:28 -08:00
|
|
|
#include "webrtc/media/base/rtputils.h"
|
2016-02-12 06:39:40 +01:00
|
|
|
#include "webrtc/media/engine/webrtccommon.h"
|
|
|
|
|
#include "webrtc/media/engine/webrtcvoe.h"
|
2016-02-12 06:47:59 +01:00
|
|
|
#include "webrtc/pc/channel.h"
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
namespace cricket {
|
|
|
|
|
|
|
|
|
|
class AudioDeviceModule;
|
2016-03-08 12:37:39 -08:00
|
|
|
class AudioSource;
|
2013-07-10 00:45:36 +00:00
|
|
|
class VoEWrapper;
|
|
|
|
|
class WebRtcVoiceMediaChannel;
|
|
|
|
|
|
2016-06-14 10:02:41 -07:00
|
|
|
struct SendCodecSpec {
|
|
|
|
|
SendCodecSpec() {
|
|
|
|
|
webrtc::CodecInst empty_inst = {0};
|
|
|
|
|
codec_inst = empty_inst;
|
|
|
|
|
codec_inst.pltype = -1;
|
|
|
|
|
}
|
|
|
|
|
bool operator==(const SendCodecSpec& rhs) const;
|
|
|
|
|
bool operator!=(const SendCodecSpec& rhs) const;
|
|
|
|
|
|
|
|
|
|
bool nack_enabled = false;
|
|
|
|
|
bool transport_cc_enabled = false;
|
|
|
|
|
bool enable_codec_fec = false;
|
|
|
|
|
bool enable_opus_dtx = false;
|
|
|
|
|
int opus_max_playback_rate = 0;
|
|
|
|
|
int red_payload_type = -1;
|
|
|
|
|
int cng_payload_type = -1;
|
|
|
|
|
int cng_plfreq = -1;
|
|
|
|
|
webrtc::CodecInst codec_inst;
|
|
|
|
|
};
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
// WebRtcVoiceEngine is a class to be used with CompositeMediaEngine.
|
|
|
|
|
// It uses the WebRtc VoiceEngine library for audio handling.
|
2015-11-06 15:34:49 -08:00
|
|
|
class WebRtcVoiceEngine final : public webrtc::TraceCallback {
|
2015-05-29 15:05:44 +02:00
|
|
|
friend class WebRtcVoiceMediaChannel;
|
2013-07-10 00:45:36 +00:00
|
|
|
public:
|
2015-11-27 04:00:25 -08:00
|
|
|
// Exposed for the WVoE/MC unit test.
|
|
|
|
|
static bool ToCodecInst(const AudioCodec& in, webrtc::CodecInst* out);
|
|
|
|
|
|
2016-06-13 07:34:51 -07:00
|
|
|
WebRtcVoiceEngine(
|
|
|
|
|
webrtc::AudioDeviceModule* adm,
|
|
|
|
|
const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory);
|
2013-07-10 00:45:36 +00:00
|
|
|
// Dependency injection for testing.
|
2016-06-13 07:34:51 -07:00
|
|
|
WebRtcVoiceEngine(
|
|
|
|
|
webrtc::AudioDeviceModule* adm,
|
|
|
|
|
const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory,
|
|
|
|
|
VoEWrapper* voe_wrapper);
|
2016-03-30 23:28:51 -07:00
|
|
|
~WebRtcVoiceEngine() override;
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2015-11-06 15:34:49 -08:00
|
|
|
rtc::scoped_refptr<webrtc::AudioState> GetAudioState() const;
|
2015-09-15 12:26:33 +02:00
|
|
|
VoiceMediaChannel* CreateChannel(webrtc::Call* call,
|
2016-02-12 02:27:06 -08:00
|
|
|
const MediaConfig& config,
|
2015-09-15 12:26:33 +02:00
|
|
|
const AudioOptions& options);
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
int GetInputLevel();
|
|
|
|
|
|
2016-06-14 07:12:39 -07:00
|
|
|
const std::vector<AudioCodec>& send_codecs() const;
|
|
|
|
|
const std::vector<AudioCodec>& recv_codecs() const;
|
2015-12-07 10:45:43 +01:00
|
|
|
RtpCapabilities GetCapabilities() const;
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
// For tracking WebRtc channels. Needed because we have to pause them
|
|
|
|
|
// all when switching devices.
|
|
|
|
|
// May only be called by WebRtcVoiceMediaChannel.
|
2015-09-29 06:06:31 -07:00
|
|
|
void RegisterChannel(WebRtcVoiceMediaChannel* channel);
|
|
|
|
|
void UnregisterChannel(WebRtcVoiceMediaChannel* channel);
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
// Called by WebRtcVoiceMediaChannel to set a gain offset from
|
|
|
|
|
// the default AGC target level.
|
|
|
|
|
bool AdjustAgcLevel(int delta);
|
|
|
|
|
|
|
|
|
|
VoEWrapper* voe() { return voe_wrapper_.get(); }
|
|
|
|
|
int GetLastEngineError();
|
|
|
|
|
|
2016-01-15 03:06:36 -08:00
|
|
|
// Starts AEC dump using an existing file. A maximum file size in bytes can be
|
|
|
|
|
// specified. When the maximum file size is reached, logging is stopped and
|
|
|
|
|
// the file is closed. If max_size_bytes is set to <= 0, no limit will be
|
|
|
|
|
// used.
|
|
|
|
|
bool StartAecDump(rtc::PlatformFile file, int64_t max_size_bytes);
|
2013-12-13 00:21:03 +00:00
|
|
|
|
2015-10-22 03:25:41 -07:00
|
|
|
// Stops AEC dump.
|
|
|
|
|
void StopAecDump();
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
private:
|
2015-09-29 06:06:31 -07:00
|
|
|
// Every option that is "set" will be applied. Every option not "set" will be
|
|
|
|
|
// ignored. This allows us to selectively turn on and off different options
|
|
|
|
|
// easily at any time.
|
2013-07-10 00:45:36 +00:00
|
|
|
bool ApplyOptions(const AudioOptions& options);
|
2015-12-08 09:50:23 -08:00
|
|
|
void SetDefaultDevices();
|
2014-10-10 09:42:53 +00:00
|
|
|
|
|
|
|
|
// webrtc::TraceCallback:
|
2015-03-04 12:58:35 +00:00
|
|
|
void Print(webrtc::TraceLevel level, const char* trace, int length) override;
|
2014-10-10 09:42:53 +00:00
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
void StartAecDump(const std::string& filename);
|
2015-10-20 15:49:38 -07:00
|
|
|
int CreateVoEChannel();
|
2016-04-08 05:35:48 -07:00
|
|
|
webrtc::AudioDeviceModule* adm();
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2015-11-06 15:34:49 -08:00
|
|
|
rtc::ThreadChecker signal_thread_checker_;
|
|
|
|
|
rtc::ThreadChecker worker_thread_checker_;
|
|
|
|
|
|
2016-03-30 23:28:51 -07:00
|
|
|
// The audio device manager.
|
|
|
|
|
rtc::scoped_refptr<webrtc::AudioDeviceModule> adm_;
|
2016-06-13 07:34:51 -07:00
|
|
|
rtc::scoped_refptr<webrtc::AudioDecoderFactory> decoder_factory_;
|
2013-07-10 00:45:36 +00:00
|
|
|
// The primary instance of WebRtc VoiceEngine.
|
2016-02-26 03:00:35 -08:00
|
|
|
std::unique_ptr<VoEWrapper> voe_wrapper_;
|
2015-11-06 15:34:49 -08:00
|
|
|
rtc::scoped_refptr<webrtc::AudioState> audio_state_;
|
2016-07-13 06:31:30 -07:00
|
|
|
std::vector<AudioCodec> codecs_;
|
2015-09-29 06:06:31 -07:00
|
|
|
std::vector<WebRtcVoiceMediaChannel*> channels_;
|
2013-12-05 00:24:06 +00:00
|
|
|
webrtc::Config voe_config_;
|
2015-12-08 09:50:23 -08:00
|
|
|
bool is_dumping_aec_ = false;
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2015-12-08 09:50:23 -08:00
|
|
|
webrtc::AgcConfig default_agc_config_;
|
2016-06-30 00:02:34 -07:00
|
|
|
// Cache received extended_filter_aec, delay_agnostic_aec, experimental_ns
|
|
|
|
|
// level controller, and intelligibility_enhancer values, and apply them
|
|
|
|
|
// in case they are missing in the audio options. We need to do this because
|
|
|
|
|
// SetExtraOptions() will revert to defaults for options which are not
|
|
|
|
|
// provided.
|
2015-11-10 22:34:18 +01:00
|
|
|
rtc::Optional<bool> extended_filter_aec_;
|
|
|
|
|
rtc::Optional<bool> delay_agnostic_aec_;
|
|
|
|
|
rtc::Optional<bool> experimental_ns_;
|
2016-05-16 15:32:38 -07:00
|
|
|
rtc::Optional<bool> intelligibility_enhancer_;
|
2016-06-30 00:02:34 -07:00
|
|
|
rtc::Optional<bool> level_control_;
|
2015-10-21 13:01:53 -07:00
|
|
|
|
2016-03-30 23:28:51 -07:00
|
|
|
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceEngine);
|
2013-07-10 00:45:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// WebRtcVoiceMediaChannel is an implementation of VoiceMediaChannel that uses
|
|
|
|
|
// WebRtc Voice Engine.
|
2015-11-06 15:34:49 -08:00
|
|
|
class WebRtcVoiceMediaChannel final : public VoiceMediaChannel,
|
|
|
|
|
public webrtc::Transport {
|
2013-07-10 00:45:36 +00:00
|
|
|
public:
|
2015-09-17 16:42:56 +02:00
|
|
|
WebRtcVoiceMediaChannel(WebRtcVoiceEngine* engine,
|
2016-02-12 02:27:06 -08:00
|
|
|
const MediaConfig& config,
|
2015-09-17 16:42:56 +02:00
|
|
|
const AudioOptions& options,
|
|
|
|
|
webrtc::Call* call);
|
2015-05-07 16:05:53 +02:00
|
|
|
~WebRtcVoiceMediaChannel() override;
|
2015-05-07 16:42:08 +02:00
|
|
|
|
2015-09-09 01:36:22 -07:00
|
|
|
const AudioOptions& options() const { return options_; }
|
2015-05-07 16:42:08 +02:00
|
|
|
|
2016-02-12 02:27:06 -08:00
|
|
|
rtc::DiffServCodePoint PreferredDscp() const override;
|
|
|
|
|
|
2015-08-07 16:05:34 -07:00
|
|
|
bool SetSendParameters(const AudioSendParameters& params) override;
|
|
|
|
|
bool SetRecvParameters(const AudioRecvParameters& params) override;
|
2016-05-16 11:40:30 -07:00
|
|
|
webrtc::RtpParameters GetRtpSendParameters(uint32_t ssrc) const override;
|
|
|
|
|
bool SetRtpSendParameters(uint32_t ssrc,
|
|
|
|
|
const webrtc::RtpParameters& parameters) override;
|
|
|
|
|
webrtc::RtpParameters GetRtpReceiveParameters(uint32_t ssrc) const override;
|
|
|
|
|
bool SetRtpReceiveParameters(
|
|
|
|
|
uint32_t ssrc,
|
|
|
|
|
const webrtc::RtpParameters& parameters) override;
|
2016-04-07 22:59:22 -07:00
|
|
|
|
2015-05-07 16:05:53 +02:00
|
|
|
bool SetPlayout(bool playout) override;
|
2013-07-10 00:45:36 +00:00
|
|
|
bool PausePlayout();
|
|
|
|
|
bool ResumePlayout();
|
2016-03-08 12:37:39 -08:00
|
|
|
void SetSend(bool send) override;
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
bool SetAudioSend(uint32_t ssrc,
|
|
|
|
|
bool enable,
|
|
|
|
|
const AudioOptions* options,
|
2016-03-08 12:37:39 -08:00
|
|
|
AudioSource* source) override;
|
2015-05-07 16:05:53 +02:00
|
|
|
bool AddSendStream(const StreamParams& sp) override;
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
bool RemoveSendStream(uint32_t ssrc) override;
|
2015-05-07 16:05:53 +02:00
|
|
|
bool AddRecvStream(const StreamParams& sp) override;
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
bool RemoveRecvStream(uint32_t ssrc) override;
|
2015-05-07 16:05:53 +02:00
|
|
|
bool GetActiveStreams(AudioInfo::StreamList* actives) override;
|
|
|
|
|
int GetOutputLevel() override;
|
|
|
|
|
int GetTimeSinceLastTyping() override;
|
|
|
|
|
void SetTypingDetectionParameters(int time_window,
|
|
|
|
|
int cost_per_typing,
|
|
|
|
|
int reporting_threshold,
|
|
|
|
|
int penalty_decay,
|
|
|
|
|
int type_event_delay) override;
|
2015-10-09 02:32:53 -07:00
|
|
|
bool SetOutputVolume(uint32_t ssrc, double volume) override;
|
2015-05-07 16:05:53 +02:00
|
|
|
|
|
|
|
|
bool CanInsertDtmf() override;
|
2015-12-02 12:35:09 -08:00
|
|
|
bool InsertDtmf(uint32_t ssrc, int event, int duration) override;
|
2015-05-07 16:05:53 +02:00
|
|
|
|
2016-03-20 06:15:43 -07:00
|
|
|
void OnPacketReceived(rtc::CopyOnWriteBuffer* packet,
|
2015-05-07 16:05:53 +02:00
|
|
|
const rtc::PacketTime& packet_time) override;
|
2016-03-20 06:15:43 -07:00
|
|
|
void OnRtcpReceived(rtc::CopyOnWriteBuffer* packet,
|
2015-05-07 16:05:53 +02:00
|
|
|
const rtc::PacketTime& packet_time) override;
|
2016-03-29 17:27:21 -07:00
|
|
|
void OnNetworkRouteChanged(const std::string& transport_name,
|
2016-04-19 15:41:36 -07:00
|
|
|
const rtc::NetworkRoute& network_route) override;
|
2016-03-22 15:32:27 -07:00
|
|
|
void OnReadyToSend(bool ready) override;
|
2015-05-07 16:05:53 +02:00
|
|
|
bool GetStats(VoiceMediaInfo* info) override;
|
2015-05-07 16:42:08 +02:00
|
|
|
|
2015-12-12 01:37:01 +01:00
|
|
|
void SetRawAudioSink(
|
|
|
|
|
uint32_t ssrc,
|
2016-02-26 03:00:35 -08:00
|
|
|
std::unique_ptr<webrtc::AudioSinkInterface> sink) override;
|
2015-12-12 01:37:01 +01:00
|
|
|
|
2015-05-07 16:42:08 +02:00
|
|
|
// implements Transport interface
|
2015-10-02 03:39:33 -07:00
|
|
|
bool SendRtp(const uint8_t* data,
|
|
|
|
|
size_t len,
|
|
|
|
|
const webrtc::PacketOptions& options) override {
|
2016-03-20 06:15:43 -07:00
|
|
|
rtc::CopyOnWriteBuffer packet(data, len, kMaxRtpPacketLen);
|
2015-10-15 07:26:07 -07:00
|
|
|
rtc::PacketOptions rtc_options;
|
|
|
|
|
rtc_options.packet_id = options.packet_id;
|
|
|
|
|
return VoiceMediaChannel::SendPacket(&packet, rtc_options);
|
2015-05-07 16:42:08 +02:00
|
|
|
}
|
|
|
|
|
|
2015-09-28 09:59:31 -07:00
|
|
|
bool SendRtcp(const uint8_t* data, size_t len) override {
|
2016-03-20 06:15:43 -07:00
|
|
|
rtc::CopyOnWriteBuffer packet(data, len, kMaxRtpPacketLen);
|
2015-10-15 07:26:07 -07:00
|
|
|
return VoiceMediaChannel::SendRtcp(&packet, rtc::PacketOptions());
|
2015-05-07 16:42:08 +02:00
|
|
|
}
|
|
|
|
|
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
int GetReceiveChannelId(uint32_t ssrc) const;
|
|
|
|
|
int GetSendChannelId(uint32_t ssrc) const;
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2015-05-07 16:42:08 +02:00
|
|
|
private:
|
2015-09-17 16:42:56 +02:00
|
|
|
bool SetOptions(const AudioOptions& options);
|
|
|
|
|
bool SetRecvCodecs(const std::vector<AudioCodec>& codecs);
|
2016-03-08 06:35:16 -08:00
|
|
|
bool SetSendCodecs(const std::vector<AudioCodec>& codecs);
|
2016-04-07 22:59:22 -07:00
|
|
|
bool SetSendCodecs(int channel, const webrtc::RtpParameters& rtp_parameters);
|
2016-03-08 06:35:16 -08:00
|
|
|
bool SetSendCodec(int channel, const webrtc::CodecInst& send_codec);
|
2016-03-08 12:37:39 -08:00
|
|
|
bool SetLocalSource(uint32_t ssrc, AudioSource* source);
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
bool MuteStream(uint32_t ssrc, bool mute);
|
2015-09-17 16:42:56 +02:00
|
|
|
|
2015-05-07 16:42:08 +02:00
|
|
|
WebRtcVoiceEngine* engine() { return engine_; }
|
2013-07-10 00:45:36 +00:00
|
|
|
int GetLastEngineError() { return engine()->GetLastEngineError(); }
|
|
|
|
|
int GetOutputLevel(int channel);
|
|
|
|
|
bool SetPlayout(int channel, bool playout);
|
|
|
|
|
bool ChangePlayout(bool playout);
|
2015-10-20 15:49:38 -07:00
|
|
|
int CreateVoEChannel();
|
2015-11-20 09:59:34 -08:00
|
|
|
bool DeleteVoEChannel(int channel);
|
2015-10-13 03:58:19 -07:00
|
|
|
bool IsDefaultRecvStream(uint32_t ssrc) {
|
|
|
|
|
return default_recv_ssrc_ == static_cast<int64_t>(ssrc);
|
|
|
|
|
}
|
2016-04-27 14:17:10 -07:00
|
|
|
bool SetMaxSendBitrate(int bps);
|
2016-05-16 11:40:30 -07:00
|
|
|
bool SetChannelSendParameters(int channel,
|
|
|
|
|
const webrtc::RtpParameters& parameters);
|
2016-04-27 14:17:10 -07:00
|
|
|
bool SetMaxSendBitrate(int channel, int bps);
|
2016-03-08 06:35:16 -08:00
|
|
|
bool HasSendCodec() const {
|
|
|
|
|
return send_codec_spec_.codec_inst.pltype != -1;
|
|
|
|
|
}
|
2016-04-07 22:59:22 -07:00
|
|
|
bool ValidateRtpParameters(const webrtc::RtpParameters& parameters);
|
2016-04-14 13:56:37 -07:00
|
|
|
void SetupRecording();
|
2015-05-07 14:07:48 +02:00
|
|
|
|
2015-11-06 15:34:49 -08:00
|
|
|
rtc::ThreadChecker worker_thread_checker_;
|
2015-05-07 14:07:48 +02:00
|
|
|
|
2015-11-06 15:34:49 -08:00
|
|
|
WebRtcVoiceEngine* const engine_ = nullptr;
|
2016-04-20 16:23:10 -07:00
|
|
|
std::vector<AudioCodec> send_codecs_;
|
2013-07-10 00:45:36 +00:00
|
|
|
std::vector<AudioCodec> recv_codecs_;
|
2016-04-27 14:17:10 -07:00
|
|
|
int max_send_bitrate_bps_ = 0;
|
2013-07-10 00:45:36 +00:00
|
|
|
AudioOptions options_;
|
2015-12-04 15:22:19 +01:00
|
|
|
rtc::Optional<int> dtmf_payload_type_;
|
2015-11-06 15:34:49 -08:00
|
|
|
bool desired_playout_ = false;
|
2016-03-08 06:35:16 -08:00
|
|
|
bool recv_transport_cc_enabled_ = false;
|
2016-06-14 12:13:00 -07:00
|
|
|
bool recv_nack_enabled_ = false;
|
2015-11-06 15:34:49 -08:00
|
|
|
bool playout_ = false;
|
2016-03-08 12:37:39 -08:00
|
|
|
bool send_ = false;
|
2015-11-06 15:34:49 -08:00
|
|
|
webrtc::Call* const call_ = nullptr;
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2015-10-13 03:58:19 -07:00
|
|
|
// SSRC of unsignalled receive stream, or -1 if there isn't one.
|
|
|
|
|
int64_t default_recv_ssrc_ = -1;
|
|
|
|
|
// Volume for unsignalled stream, which may be set before the stream exists.
|
|
|
|
|
double default_recv_volume_ = 1.0;
|
2016-01-15 09:20:04 -08:00
|
|
|
// Sink for unsignalled stream, which may be set before the stream exists.
|
2016-02-26 03:00:35 -08:00
|
|
|
std::unique_ptr<webrtc::AudioSinkInterface> default_sink_;
|
2015-11-12 06:02:30 -08:00
|
|
|
// Default SSRC to use for RTCP receiver reports in case of no signaled
|
2015-10-20 15:49:38 -07:00
|
|
|
// send streams. See: https://code.google.com/p/webrtc/issues/detail?id=4740
|
2015-11-12 06:02:30 -08:00
|
|
|
// and https://code.google.com/p/chromium/issues/detail?id=547661
|
|
|
|
|
uint32_t receiver_reports_ssrc_ = 0xFA17FA17u;
|
2015-10-13 03:58:19 -07:00
|
|
|
|
2015-10-21 13:01:53 -07:00
|
|
|
class WebRtcAudioSendStream;
|
|
|
|
|
std::map<uint32_t, WebRtcAudioSendStream*> send_streams_;
|
2015-11-16 07:34:50 -08:00
|
|
|
std::vector<webrtc::RtpExtension> send_rtp_extensions_;
|
2015-10-21 13:01:53 -07:00
|
|
|
|
|
|
|
|
class WebRtcAudioReceiveStream;
|
2015-11-20 09:59:34 -08:00
|
|
|
std::map<uint32_t, WebRtcAudioReceiveStream*> recv_streams_;
|
2015-05-07 14:07:48 +02:00
|
|
|
std::vector<webrtc::RtpExtension> recv_rtp_extensions_;
|
2015-10-21 13:01:53 -07:00
|
|
|
|
2016-06-14 10:02:41 -07:00
|
|
|
SendCodecSpec send_codec_spec_;
|
2016-03-08 06:35:16 -08:00
|
|
|
|
2015-10-21 13:01:53 -07:00
|
|
|
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel);
|
2013-07-10 00:45:36 +00:00
|
|
|
};
|
|
|
|
|
} // namespace cricket
|
|
|
|
|
|
2016-02-12 06:39:40 +01:00
|
|
|
#endif // WEBRTC_MEDIA_ENGINE_WEBRTCVOICEENGINE_H_
|