From 0548fca0dd384af1902e2d7e811bc4b79a29a00c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20S=C5=82omkowski?= Date: Tue, 17 Nov 2015 23:15:52 +0100 Subject: [PATCH] Update Mumlib audio callback and and 'override'. #1 --- MumbleCommunicator.cpp | 5 ++++- MumbleCommunicator.hpp | 2 +- PjsuaCommunicator.cpp | 13 ++++++------- PjsuaCommunicator.hpp | 4 ++-- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/MumbleCommunicator.cpp b/MumbleCommunicator.cpp index 07d15ed..a1209c2 100644 --- a/MumbleCommunicator.cpp +++ b/MumbleCommunicator.cpp @@ -10,8 +10,11 @@ namespace mumble { MumbleCommunicator *communicator; virtual void audio( + int target, + int sessionId, + int sequenceNumber, int16_t *pcm_data, - uint32_t pcm_data_size) { + uint32_t pcm_data_size) override { communicator->onIncomingPcmSamples(pcm_data, pcm_data_size); } }; diff --git a/MumbleCommunicator.hpp b/MumbleCommunicator.hpp index 7065f4b..68c466c 100644 --- a/MumbleCommunicator.hpp +++ b/MumbleCommunicator.hpp @@ -32,7 +32,7 @@ namespace mumble { ~MumbleCommunicator(); - virtual void sendPcmSamples(int16_t *samples, unsigned int length); + virtual void sendPcmSamples(int16_t *samples, unsigned int length) override; void sendTextMessage(std::string message); diff --git a/PjsuaCommunicator.cpp b/PjsuaCommunicator.cpp index ca50206..65df7e3 100644 --- a/PjsuaCommunicator.cpp +++ b/PjsuaCommunicator.cpp @@ -16,7 +16,7 @@ namespace sip { _LogWriter(Category &logger) : logger(logger) { } - virtual void write(const pj::LogEntry &entry) { + virtual void write(const pj::LogEntry &entry) override { auto message = entry.msg.substr(0, entry.msg.size() - 1); // remove newline @@ -93,11 +93,11 @@ namespace sip { communicator(comm), account(acc) { } - virtual void onCallState(pj::OnCallStateParam &prm); + virtual void onCallState(pj::OnCallStateParam &prm) override; - virtual void onCallMediaState(pj::OnCallMediaStateParam &prm); + virtual void onCallMediaState(pj::OnCallMediaStateParam &prm) override; - virtual void onDtmfDigit(pj::OnDtmfDigitParam &prm); + virtual void onDtmfDigit(pj::OnDtmfDigitParam &prm) override; private: sip::PjsuaCommunicator &communicator; @@ -109,9 +109,9 @@ namespace sip { _Account(sip::PjsuaCommunicator &comm) : communicator(comm) { } - virtual void onRegState(pj::OnRegStateParam &prm); + virtual void onRegState(pj::OnRegStateParam &prm) override; - virtual void onIncomingCall(pj::OnIncomingCallParam &iprm); + virtual void onIncomingCall(pj::OnIncomingCallParam &iprm) override; private: sip::PjsuaCommunicator &communicator; @@ -328,4 +328,3 @@ void sip::PjsuaCommunicator::sendPcmSamples(int16_t *samples, unsigned int lengt pjsuaLogger.debug("Pushing %d samples to in-buff.", length); pjmedia_circ_buf_write(inputBuff, samples, length); } - diff --git a/PjsuaCommunicator.hpp b/PjsuaCommunicator.hpp index 133d23f..a3f60c7 100644 --- a/PjsuaCommunicator.hpp +++ b/PjsuaCommunicator.hpp @@ -39,7 +39,7 @@ namespace sip { mesg += errorMsgBuffer; } - virtual const char *what() const throw() { + virtual const char *what() const throw() override { return mesg.c_str(); } @@ -67,7 +67,7 @@ namespace sip { ~PjsuaCommunicator(); - virtual void sendPcmSamples(int16_t *samples, unsigned int length); + virtual void sendPcmSamples(int16_t *samples, unsigned int length) override; std::function onStateChange;