Add option to configure Opus encoder bitrate. #14
This commit is contained in:
parent
e8db228b47
commit
bd3f62c044
@ -47,19 +47,18 @@ mumble::MumbleCommunicator::MumbleCommunicator(boost::asio::io_service &ioServic
|
||||
logger(log4cpp::Category::getInstance("MumbleCommunicator")) {
|
||||
}
|
||||
|
||||
void mumble::MumbleCommunicator::connect(
|
||||
std::string user,
|
||||
std::string password,
|
||||
std::string host,
|
||||
int port) {
|
||||
void mumble::MumbleCommunicator::connect(MumbleCommunicatorConfig &config) {
|
||||
|
||||
callback.reset(new MumlibCallback());
|
||||
|
||||
mum.reset(new mumlib::Mumlib(*callback, ioService));
|
||||
mumConfig = mumlib::MumlibConfiguration();
|
||||
mumConfig.opusEncoderBitrate = config.opusEncoderBitrate;
|
||||
|
||||
mum.reset(new mumlib::Mumlib(*callback, ioService, mumConfig));
|
||||
callback->communicator = this;
|
||||
callback->mum = mum;
|
||||
|
||||
mum->connect(host, port, user, password);
|
||||
mum->connect(config.host, config.port, config.user, config.password);
|
||||
}
|
||||
|
||||
void mumble::MumbleCommunicator::sendPcmSamples(int16_t *samples, unsigned int length) {
|
||||
|
@ -17,16 +17,20 @@ namespace mumble {
|
||||
|
||||
class MumlibCallback;
|
||||
|
||||
struct MumbleCommunicatorConfig {
|
||||
std::string user;
|
||||
std::string password;
|
||||
std::string host;
|
||||
int opusEncoderBitrate;
|
||||
int port = 0;
|
||||
};
|
||||
|
||||
class MumbleCommunicator : boost::noncopyable {
|
||||
public:
|
||||
MumbleCommunicator(
|
||||
boost::asio::io_service &ioService);
|
||||
|
||||
void connect(
|
||||
std::string user,
|
||||
std::string password,
|
||||
std::string host,
|
||||
int port = 0);
|
||||
void connect(MumbleCommunicatorConfig &config);
|
||||
|
||||
virtual ~MumbleCommunicator();
|
||||
|
||||
@ -50,11 +54,13 @@ namespace mumble {
|
||||
|
||||
void joinChannel(int channel_id);
|
||||
|
||||
public:
|
||||
private:
|
||||
boost::asio::io_service &ioService;
|
||||
|
||||
log4cpp::Category &logger;
|
||||
|
||||
mumlib::MumlibConfiguration mumConfig;
|
||||
|
||||
std::shared_ptr<mumlib::Mumlib> mum;
|
||||
|
||||
std::unique_ptr<MumlibCallback> callback;
|
||||
|
@ -14,3 +14,4 @@ port = 64738
|
||||
user = mumsi
|
||||
password = foobar
|
||||
channelNameExpression =
|
||||
opusEncoderBitrate = 16000
|
12
main.cpp
12
main.cpp
@ -77,12 +77,14 @@ int main(int argc, char *argv[]) {
|
||||
&mumbleChannelJoiner,
|
||||
&mumbleCommunicator);
|
||||
|
||||
mumble::MumbleCommunicatorConfig mumbleConf;
|
||||
mumbleConf.host = conf.getString("mumble.host");
|
||||
mumbleConf.port = conf.getInt("mumble.port");
|
||||
mumbleConf.user = conf.getString("mumble.user");
|
||||
mumbleConf.password = conf.getString("mumble.password");
|
||||
mumbleConf.opusEncoderBitrate = conf.getInt("mumble.opusEncoderBitrate");
|
||||
|
||||
mumbleCommunicator.connect(
|
||||
conf.getString("mumble.user"),
|
||||
conf.getString("mumble.password"),
|
||||
conf.getString("mumble.host"),
|
||||
conf.getInt("mumble.port"));
|
||||
mumbleCommunicator.connect(mumbleConf);
|
||||
|
||||
pjsuaCommunicator.connect(
|
||||
conf.getString("sip.host"),
|
||||
|
Loading…
Reference in New Issue
Block a user