1
0
mirror of https://github.com/danog/libtgvoip.git synced 2024-12-02 09:37:52 +01:00

Mark more methods as override, fixes for android

This commit is contained in:
Daniil Gentili 2020-03-29 16:55:33 +02:00
parent 18c7f84476
commit 23fafdf575
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
17 changed files with 197 additions and 193 deletions

View File

@ -1,7 +1,7 @@
LOCAL_PATH := $(call my-dir) LOCAL_PATH := $(call my-dir)
LOCAL_MODULE := voip LOCAL_MODULE := voip
LOCAL_CPPFLAGS := -Wall -std=c++11 -DANDROID -finline-functions -ffast-math -Os -fno-strict-aliasing -O3 -frtti -D__STDC_LIMIT_MACROS -Wno-unknown-pragmas LOCAL_CPPFLAGS := -Wall -std=c++17 -DANDROID -finline-functions -ffast-math -Os -fno-strict-aliasing -O3 -frtti -D__STDC_LIMIT_MACROS -Wno-unknown-pragmas
LOCAL_CFLAGS := -O3 -DUSE_KISS_FFT -fexceptions -DWEBRTC_APM_DEBUG_DUMP=0 -DWEBRTC_POSIX -DWEBRTC_ANDROID -D__STDC_LIMIT_MACROS -DFIXED_POINT -DWEBRTC_NS_FLOAT LOCAL_CFLAGS := -O3 -DUSE_KISS_FFT -fexceptions -DWEBRTC_APM_DEBUG_DUMP=0 -DWEBRTC_POSIX -DWEBRTC_ANDROID -D__STDC_LIMIT_MACROS -DFIXED_POINT -DWEBRTC_NS_FLOAT
LOCAL_EXPORT_LDLIBS := -llog -lOpenSLES LOCAL_EXPORT_LDLIBS := -llog -lOpenSLES
@ -23,7 +23,6 @@ LOCAL_CFLAGS += $(TGVOIP_ADDITIONAL_CFLAGS)
LOCAL_SRC_FILES := \ LOCAL_SRC_FILES := \
./tools/logging.cpp \ ./tools/logging.cpp \
./VoIPController.cpp \ ./VoIPController.cpp \
./VoIPGroupController.cpp \
./tools/Buffers.cpp \ ./tools/Buffers.cpp \
./tools/BlockingQueue.cpp \ ./tools/BlockingQueue.cpp \
./audio/AudioInput.cpp \ ./audio/AudioInput.cpp \

View File

@ -1,6 +1,6 @@
AUTOMAKE_OPTIONS = foreign AUTOMAKE_OPTIONS = foreign
CFLAGS = -Wall -DHAVE_CONFIG_H -Wno-unknown-pragmas -g CFLAGS = -Wall -DHAVE_CONFIG_H -Wno-unknown-pragmas -g -Wsuggest-override
lib_LTLIBRARIES = libtgvoip.la lib_LTLIBRARIES = libtgvoip.la

View File

@ -2274,9 +2274,10 @@ CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@ CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@ $(am__append_9) $(am__append_20) CCASFLAGS = @CCASFLAGS@ $(am__append_9) $(am__append_20)
CCDEPMODE = @CCDEPMODE@ CCDEPMODE = @CCDEPMODE@
CFLAGS = -Wall -DHAVE_CONFIG_H -Wno-unknown-pragmas -g $(am__append_8) \ CFLAGS = -Wall -DHAVE_CONFIG_H -Wno-unknown-pragmas -g \
$(am__append_11) $(am__append_13) $(am__append_15) \ -Wsuggest-override $(am__append_8) $(am__append_11) \
$(am__append_19) $(am__append_24) $(am__append_13) $(am__append_15) $(am__append_19) \
$(am__append_24)
CPP = @CPP@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@ CPPFLAGS = @CPPFLAGS@
CXX = @CXX@ CXX = @CXX@

View File

@ -10,10 +10,10 @@
#ifndef TGVOIP_USE_CUSTOM_CRYPTO #ifndef TGVOIP_USE_CUSTOM_CRYPTO
extern "C" extern "C"
{ {
#include <openssl/sha.h>
#include <openssl/aes.h> #include <openssl/aes.h>
#include <openssl/modes.h> #include <openssl/modes.h>
#include <openssl/rand.h> #include <openssl/rand.h>
#include <openssl/sha.h>
} }
void tgvoip_openssl_aes_ige_encrypt(uint8_t *in, uint8_t *out, size_t length, uint8_t *key, uint8_t *iv) void tgvoip_openssl_aes_ige_encrypt(uint8_t *in, uint8_t *out, size_t length, uint8_t *key, uint8_t *iv)
@ -198,13 +198,13 @@ public:
{ {
} }
void setOnStateUpdated(std::function<void(TgVoipState)> onStateUpdated) void setOnStateUpdated(std::function<void(TgVoipState)> onStateUpdated) override
{ {
std::lock_guard<std::mutex> lock(m_onStateUpdated); std::lock_guard<std::mutex> lock(m_onStateUpdated);
onStateUpdated_ = onStateUpdated; onStateUpdated_ = onStateUpdated;
} }
void setOnSignalBarsUpdated(std::function<void(int)> onSignalBarsUpdated) void setOnSignalBarsUpdated(std::function<void(int)> onSignalBarsUpdated) override
{ {
std::lock_guard<std::mutex> lock(m_onSignalBarsUpdated); std::lock_guard<std::mutex> lock(m_onSignalBarsUpdated);
onSignalBarsUpdated_ = onSignalBarsUpdated; onSignalBarsUpdated_ = onSignalBarsUpdated;

View File

@ -13,12 +13,6 @@
#include "controller/protocol/VersionInfo.h" #include "controller/protocol/VersionInfo.h"
#include "controller/protocol/protocol/Index.h" #include "controller/protocol/protocol/Index.h"
#if defined HAVE_CONFIG_H || defined TGVOIP_USE_INSTALLED_OPUS
#include <opus/opus.h>
#else
#include <opus/opus.h>
#endif
#ifdef __ANDROID__ #ifdef __ANDROID__
#include "controller/net/NetworkSocket.h" #include "controller/net/NetworkSocket.h"
#include "os/android/AudioInputAndroid.h" #include "os/android/AudioInputAndroid.h"

View File

@ -55,7 +55,7 @@ public:
return input; return input;
} }
virtual std::shared_ptr<AudioOutput> *GetOutput() virtual std::shared_ptr<AudioOutput> GetOutput()
{ {
return output; return output;
} }

View File

@ -4,6 +4,11 @@
#include "../protocol/packets/PacketSender.h" #include "../protocol/packets/PacketSender.h"
#include <deque> #include <deque>
#include <list> #include <list>
#if defined HAVE_CONFIG_H || defined TGVOIP_USE_INSTALLED_OPUS
#include <opus/opus.h>
#else
#include "opus.h"
#endif
namespace tgvoip namespace tgvoip
{ {

View File

@ -7,10 +7,10 @@
#ifndef LIBTGVOIP_ECHOCANCELLER_H #ifndef LIBTGVOIP_ECHOCANCELLER_H
#define LIBTGVOIP_ECHOCANCELLER_H #define LIBTGVOIP_ECHOCANCELLER_H
#include "tools/threading.h"
#include "tools/Buffers.h"
#include "tools/BlockingQueue.h"
#include "controller/media/MediaStreamItf.h" #include "controller/media/MediaStreamItf.h"
#include "tools/BlockingQueue.h"
#include "tools/Buffers.h"
#include "tools/threading.h"
#include "tools/utils.h" #include "tools/utils.h"
namespace webrtc namespace webrtc
@ -73,7 +73,7 @@ class Volume : public AudioEffect
public: public:
Volume(); Volume();
virtual ~Volume(); virtual ~Volume();
virtual void Process(int16_t *inOut, size_t numSamples); virtual void Process(int16_t *inOut, size_t numSamples) override;
/** /**
* Level is (0.0, 2.0] * Level is (0.0, 2.0]
*/ */

View File

@ -11,6 +11,11 @@
#include <math.h> #include <math.h>
#include <algorithm> #include <algorithm>
#if defined HAVE_CONFIG_H || defined TGVOIP_USE_INSTALLED_OPUS
#include <opus/opus.h>
#else
#include "opus.h"
#endif
#include "VoIPController.h" #include "VoIPController.h"
#define PACKET_SIZE (960 * 2) #define PACKET_SIZE (960 * 2)

View File

@ -7,17 +7,17 @@
#ifndef LIBTGVOIP_OPUSDECODER_H #ifndef LIBTGVOIP_OPUSDECODER_H
#define LIBTGVOIP_OPUSDECODER_H #define LIBTGVOIP_OPUSDECODER_H
#include "controller/audio/EchoCanceller.h"
#include "controller/media/MediaStreamItf.h" #include "controller/media/MediaStreamItf.h"
#include "tools/threading.h" #include "controller/net/JitterBuffer.h"
#include "tools/BlockingQueue.h" #include "tools/BlockingQueue.h"
#include "tools/Buffers.h" #include "tools/Buffers.h"
#include "controller/audio/EchoCanceller.h" #include "tools/threading.h"
#include "controller/net/JitterBuffer.h"
#include "tools/utils.h" #include "tools/utils.h"
#include <atomic>
#include <memory>
#include <stdio.h> #include <stdio.h>
#include <vector> #include <vector>
#include <memory>
#include <atomic>
struct OpusDecoder; struct OpusDecoder;

View File

@ -12,7 +12,7 @@
#if defined HAVE_CONFIG_H || defined TGVOIP_USE_INSTALLED_OPUS #if defined HAVE_CONFIG_H || defined TGVOIP_USE_INSTALLED_OPUS
#include <opus/opus.h> #include <opus/opus.h>
#else #else
#include <opus/opus.h> #include "opus.h"
#endif #endif
namespace namespace

View File

@ -7,13 +7,13 @@
#ifndef LIBTGVOIP_MEDIASTREAMINPUT_H #ifndef LIBTGVOIP_MEDIASTREAMINPUT_H
#define LIBTGVOIP_MEDIASTREAMINPUT_H #define LIBTGVOIP_MEDIASTREAMINPUT_H
#include <string.h>
#include <vector>
#include <memory>
#include <stdint.h>
#include "tools/threading.h"
#include "tools/BlockingQueue.h" #include "tools/BlockingQueue.h"
#include "tools/Buffers.h" #include "tools/Buffers.h"
#include "tools/threading.h"
#include <memory>
#include <stdint.h>
#include <string.h>
#include <vector>
namespace tgvoip namespace tgvoip
{ {
@ -42,8 +42,8 @@ public:
AudioMixer(); AudioMixer();
virtual ~AudioMixer(); virtual ~AudioMixer();
void SetOutput(MediaStreamItf *output); void SetOutput(MediaStreamItf *output);
virtual void Start(); virtual void Start() override;
virtual void Stop(); virtual void Stop() override;
void AddInput(std::shared_ptr<MediaStreamItf> input); void AddInput(std::shared_ptr<MediaStreamItf> input);
void RemoveInput(std::shared_ptr<MediaStreamItf> input); void RemoveInput(std::shared_ptr<MediaStreamItf> input);
void SetInputVolume(std::shared_ptr<MediaStreamItf> input, float volumeDB); void SetInputVolume(std::shared_ptr<MediaStreamItf> input, float volumeDB);
@ -73,8 +73,8 @@ class CallbackWrapper : public MediaStreamItf
public: public:
CallbackWrapper(){}; CallbackWrapper(){};
virtual ~CallbackWrapper(){}; virtual ~CallbackWrapper(){};
virtual void Start(){}; virtual void Start() override{};
virtual void Stop(){}; virtual void Stop() override{};
}; };
class AudioLevelMeter class AudioLevelMeter

View File

@ -169,17 +169,17 @@ class NetworkSocketTCPObfuscated : public NetworkSocketWrapper
public: public:
NetworkSocketTCPObfuscated(const std::shared_ptr<NetworkSocket> &wrapped); NetworkSocketTCPObfuscated(const std::shared_ptr<NetworkSocket> &wrapped);
virtual ~NetworkSocketTCPObfuscated(); virtual ~NetworkSocketTCPObfuscated();
virtual std::shared_ptr<NetworkSocket> GetWrapped(); virtual std::shared_ptr<NetworkSocket> GetWrapped() override;
virtual void InitConnection(); virtual void InitConnection() override;
virtual void Send(NetworkPacket &&packet) override; virtual void Send(NetworkPacket &&packet) override;
virtual NetworkPacket Receive(size_t maxLen) override; virtual NetworkPacket Receive(size_t maxLen) override;
virtual void Open(); virtual void Open() override;
virtual void Close(); virtual void Close() override;
virtual void Connect(const NetworkAddress address, uint16_t port); virtual void Connect(const NetworkAddress address, uint16_t port) override;
virtual bool OnReadyToSend(); virtual bool OnReadyToSend() override;
virtual bool IsFailed(); virtual bool IsFailed() override;
virtual bool IsReadyToSend() virtual bool IsReadyToSend() override
{ {
return readyToSend && wrapped->IsReadyToSend(); return readyToSend && wrapped->IsReadyToSend();
}; };
@ -199,15 +199,15 @@ public:
virtual void Send(NetworkPacket &&packet) override; virtual void Send(NetworkPacket &&packet) override;
virtual NetworkPacket Receive(size_t maxLen) override; virtual NetworkPacket Receive(size_t maxLen) override;
virtual void Open() override; virtual void Open() override;
virtual void Close(); virtual void Close() override;
virtual void Connect(const NetworkAddress address, uint16_t port); virtual void Connect(const NetworkAddress address, uint16_t port) override;
virtual std::shared_ptr<NetworkSocket> GetWrapped(); virtual std::shared_ptr<NetworkSocket> GetWrapped() override;
virtual void InitConnection(); virtual void InitConnection() override;
virtual bool IsFailed(); virtual bool IsFailed() override;
virtual NetworkAddress GetConnectedAddress(); virtual NetworkAddress GetConnectedAddress() override;
virtual uint16_t GetConnectedPort(); virtual uint16_t GetConnectedPort() override;
virtual bool OnReadyToSend(); virtual bool OnReadyToSend() override;
virtual bool OnReadyToReceive(); virtual bool OnReadyToReceive() override;
bool NeedSelectForSending(); bool NeedSelectForSending();

View File

@ -120,7 +120,7 @@ public:
uint8_t streamId; uint8_t streamId;
uint8_t flags = 0; uint8_t flags = 0;
uint8_t getID() const uint8_t getID() const override
{ {
return ID; return ID;
} }
@ -150,7 +150,7 @@ public:
Array<Wrapped<Bytes>> data; Array<Wrapped<Bytes>> data;
uint8_t getID() const uint8_t getID() const override
{ {
return ID; return ID;
} }
@ -175,7 +175,7 @@ struct ExtraNetworkChanged : public Extra
uint8_t flags = 0; uint8_t flags = 0;
uint8_t getID() const uint8_t getID() const override
{ {
return ID; return ID;
} }
@ -197,7 +197,7 @@ public:
NetworkAddress address; NetworkAddress address;
uint16_t port = 0; uint16_t port = 0;
uint8_t getID() const uint8_t getID() const override
{ {
return ID; return ID;
} }
@ -218,7 +218,7 @@ struct ExtraIpv6Endpoint : public Extra
NetworkAddress address; NetworkAddress address;
uint16_t port = 0; uint16_t port = 0;
uint8_t getID() const uint8_t getID() const override
{ {
return ID; return ID;
} }
@ -240,7 +240,7 @@ struct ExtraGroupCallKey : public Extra
Buffer key; Buffer key;
uint8_t getID() const uint8_t getID() const override
{ {
return ID; return ID;
} }
@ -258,7 +258,7 @@ struct ExtraGroupCallUpgrade : public Extra
bool parse(const BufferInputStream &in, const VersionInfo &ver) override { return true; }; bool parse(const BufferInputStream &in, const VersionInfo &ver) override { return true; };
void serialize(BufferOutputStream &out, const VersionInfo &ver) const override{}; void serialize(BufferOutputStream &out, const VersionInfo &ver) const override{};
uint8_t getID() const uint8_t getID() const override
{ {
return ID; return ID;
} }
@ -293,7 +293,7 @@ struct ExtraInit : public Extra
Array<UInt32> decoders; Array<UInt32> decoders;
uint8_t maxResolution; uint8_t maxResolution;
uint8_t getID() const uint8_t getID() const override
{ {
return ID; return ID;
} }
@ -320,7 +320,7 @@ struct ExtraInitAck : public Extra
Array<ExtraStreamInfo> streams; Array<ExtraStreamInfo> streams;
uint8_t getID() const uint8_t getID() const override
{ {
return ID; return ID;
} }
@ -344,7 +344,7 @@ struct ExtraPing : public Extra
bool parse(const BufferInputStream &in, const VersionInfo &ver) override { return true; }; bool parse(const BufferInputStream &in, const VersionInfo &ver) override { return true; };
void serialize(BufferOutputStream &out, const VersionInfo &ver) const override{}; void serialize(BufferOutputStream &out, const VersionInfo &ver) const override{};
uint8_t getID() const uint8_t getID() const override
{ {
return ID; return ID;
} }
@ -363,7 +363,7 @@ struct ExtraPong : public Extra
uint32_t seq = 0; uint32_t seq = 0;
uint8_t getID() const uint8_t getID() const override
{ {
return ID; return ID;
} }

View File

@ -335,7 +335,7 @@ struct Bytes : public Serializable,
virtual ~Bytes() = default; virtual ~Bytes() = default;
Bytes() = default; Bytes() = default;
bool parse(const BufferInputStream &in, const VersionInfo &ver) bool parse(const BufferInputStream &in, const VersionInfo &ver) override
{ {
setData(std::make_unique<Buffer>(in.GetLength())); setData(std::make_unique<Buffer>(in.GetLength()));
return in.TryRead(*getData()); return in.TryRead(*getData());
@ -368,16 +368,16 @@ struct OutputBytes : public Bytes
OutputBytes() = default; OutputBytes() = default;
OutputBytes(Buffer &&_data) : data(std::make_unique<Buffer>(std::move(_data))){}; OutputBytes(Buffer &&_data) : data(std::make_unique<Buffer>(std::move(_data))){};
virtual Buffer *getData() virtual Buffer *getData() override
{ {
return data.get(); return data.get();
} }
virtual const Buffer *getData() const virtual const Buffer *getData() const override
{ {
return data.get(); return data.get();
} }
virtual void setData(std::unique_ptr<Buffer> &&buf) virtual void setData(std::unique_ptr<Buffer> &&buf) override
{ {
data = std::move(buf); data = std::move(buf);
} }
@ -390,15 +390,15 @@ struct InputBytes : public Bytes
InputBytes() = default; InputBytes() = default;
InputBytes(std::shared_ptr<Buffer> _data) : data(_data){}; InputBytes(std::shared_ptr<Buffer> _data) : data(_data){};
virtual Buffer *getData() virtual Buffer *getData() override
{ {
return data.get(); return data.get();
} }
virtual const Buffer *getData() const virtual const Buffer *getData() const override
{ {
return data.get(); return data.get();
} }
virtual void setData(std::unique_ptr<Buffer> &&buf) virtual void setData(std::unique_ptr<Buffer> &&buf) override
{ {
data = std::move(buf); data = std::move(buf);
} }
@ -416,7 +416,7 @@ struct UInt32 : public Serializable,
{ {
return data; return data;
} }
bool parse(const BufferInputStream &in, const VersionInfo &ver) bool parse(const BufferInputStream &in, const VersionInfo &ver) override
{ {
return in.TryRead(data); return in.TryRead(data);
} }

View File

@ -756,7 +756,7 @@
[ [
'"<(OS)" == "mac"', { '"<(OS)" == "mac"', {
'xcode_settings': { 'xcode_settings': {
'CLANG_CXX_LANGUAGE_STANDARD': 'c++11', 'CLANG_CXX_LANGUAGE_STANDARD': 'c++17',
'ALWAYS_SEARCH_USER_PATHS': 'NO', 'ALWAYS_SEARCH_USER_PATHS': 'NO',
}, },
'defines': [ 'defines': [

View File

@ -24,7 +24,7 @@ class SocketSelectCancellerPosix : public SocketSelectCanceller
public: public:
SocketSelectCancellerPosix(); SocketSelectCancellerPosix();
virtual ~SocketSelectCancellerPosix(); virtual ~SocketSelectCancellerPosix();
virtual void CancelSelect(); virtual void CancelSelect() override;
private: private:
int pipeRead; int pipeRead;