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