- more changes to unify development across different projects (callers / server / hasq / softphone)

This commit is contained in:
Dmytro Bogovych 2018-06-05 13:52:17 +03:00
parent 14fb3bbdbf
commit 5afaa1299e
16 changed files with 62 additions and 53 deletions

View File

@ -55,3 +55,4 @@ target_link_libraries(rtphone ice_stack jrtplib g729_codec gsm_codec
opencore-amrnb opencore-amrwb
helper_lib audio_lib webrtc speexdsp
ssl crypto opus uuid dl)

View File

@ -1,8 +1,9 @@
/* Copyright(C) 2007-2014 VoIP objects (voipobjects.com)
/* Copyright(C) 2007-2018 VoIP objects (voipobjects.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <assert.h>
#include "Audio_DataWindow.h"
using namespace Audio;

View File

@ -6,6 +6,7 @@
#define NOMINMAX
#include "Audio_DevicePair.h"
#include <algorithm>
#include <assert.h>
#define LOG_SUBSYSTEM "Audio"

View File

@ -7,6 +7,7 @@
# include <WinSock2.h>
#endif
#include <assert.h>
#include "Audio_Helper.h"
#include "../helper/HL_Exception.h"

View File

@ -1,14 +1,17 @@
/* Copyright(C) 2007-2014 VoIP objects (voipobjects.com)
/* Copyright(C) 2007-2018 VoIP objects (voipobjects.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "../config.h"
#include "../helper/HL_Exception.h"
#include "Audio_Mixer.h"
#include <algorithm>
#include "../helper/HL_Log.h"
#include <algorithm>
#include <assert.h>
#include "Audio_Mixer.h"
#define LOG_SUBSYSTEM "Mixer"
using namespace Audio;

View File

@ -1,5 +1,6 @@
#include "Audio_Null.h"
#include "helper/HL_Log.h"
#include <assert.h>
#define LOG_SUBSYSTEM "NULL audio"
using namespace Audio;

View File

@ -10,9 +10,9 @@
# include "signal_processing_library/signal_processing_library.h"
#endif
#include "../helper/HL_Pointer.h"
#include <vector>
#include <memory>
#include <map>
namespace Audio
{

View File

@ -31,6 +31,8 @@ typedef struct {
#define LOG_SUBSYSTEM "WavFileReader"
#define LOCK std::unique_lock<std::mutex> lock(mFileMtx);
using namespace Audio;
// ---------------------- WavFileReader -------------------------
@ -71,7 +73,7 @@ std::string WavFileReader::readChunk()
bool WavFileReader::open(const std::tstring& filename)
{
Lock lock(mFileMtx);
LOCK;
try
{
#ifdef WIN32
@ -160,7 +162,7 @@ bool WavFileReader::open(const std::tstring& filename)
void WavFileReader::close()
{
Lock lock(mFileMtx);
LOCK;
if (NULL != mHandle)
fclose(mHandle);
@ -179,7 +181,7 @@ unsigned WavFileReader::read(void* buffer, unsigned bytes)
unsigned WavFileReader::read(short* buffer, unsigned samples)
{
Lock lock(mFileMtx);
LOCK;
if (!mHandle)
return 0;
@ -208,14 +210,14 @@ unsigned WavFileReader::read(short* buffer, unsigned samples)
bool WavFileReader::isOpened()
{
Lock lock(mFileMtx);
LOCK;
return (mHandle != 0);
}
void WavFileReader::rewind()
{
Lock l(mFileMtx);
LOCK;
if (mHandle)
fseek(mHandle, mDataOffset, SEEK_SET);
@ -223,14 +225,14 @@ void WavFileReader::rewind()
std::tstring WavFileReader::filename() const
{
Lock lock(mFileMtx);
LOCK;
return mFileName;
}
unsigned WavFileReader::size() const
{
Lock l(mFileMtx);
LOCK;
return mDataLength;
}
@ -258,7 +260,7 @@ void WavFileWriter::checkWriteResult(int result)
bool WavFileWriter::open(const std::tstring& filename, int rate, int channels)
{
Lock lock(mFileMtx);
LOCK;
close();
@ -324,7 +326,7 @@ bool WavFileWriter::open(const std::tstring& filename, int rate, int channels)
void WavFileWriter::close()
{
Lock lock(mFileMtx);
LOCK;
if (mHandle)
{
@ -335,7 +337,7 @@ void WavFileWriter::close()
unsigned WavFileWriter::write(const void* buffer, unsigned bytes)
{
Lock l(mFileMtx);
LOCK;
if (!mHandle)
return 0;
@ -361,14 +363,15 @@ unsigned WavFileWriter::write(const void* buffer, unsigned bytes)
bool WavFileWriter::isOpened()
{
Lock lock(mFileMtx);
LOCK;
return (mHandle != 0);
}
std::tstring WavFileWriter::filename()
{
Lock lock(mFileMtx);
LOCK;
return mFileName;
}

View File

@ -1,4 +1,4 @@
/* Copyright(C) 2007-2017 VoIPobjects (voipobjects.com)
/* Copyright(C) 2007-2018 VoIPobjects (voipobjects.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@ -7,13 +7,15 @@
#ifndef __AUDIO_WAVFILE_H
#define __AUDIO_WAVFILE_H
#include "helper/HL_Sync.h"
#include "helper/HL_Types.h"
//#include "helper/HL_Types.h"
#include "Audio_Resampler.h"
#include <stdio.h>
#include <string>
#include <memory>
#include <mutex>
#include "helper/HL_Types.h"
namespace Audio
{
@ -26,7 +28,7 @@ namespace Audio
short mBits;
int mRate;
std::tstring mFileName;
mutable Mutex mFileMtx;
mutable std::mutex mFileMtx;
unsigned mDataOffset;
unsigned mDataLength;
Resampler mResampler;
@ -57,7 +59,7 @@ namespace Audio
protected:
FILE* mHandle; /// Handle of audio file.
std::tstring mFileName; /// Path to requested audio file.
Mutex mFileMtx; /// Mutex to protect this instance.
std::mutex mFileMtx; /// Mutex to protect this instance.
int mWritten; /// Amount of written data (in bytes)
int mLengthOffset; /// Position of length field.
int mRate, mChannels;

View File

@ -20,3 +20,4 @@ set (AUDIOLIB_SOURCES
)
add_library(audio_lib ${AUDIOLIB_SOURCES})
target_include_directories(audio_lib PRIVATE ../../libs/speex/include ../../libs ../)

View File

@ -4,26 +4,7 @@ project (helper_lib)
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (HELPER_LIB_SOURCES
HL_AsyncCommand.cpp
HL_Calculator.cpp
HL_CsvReader.cpp
HL_Epoll.cpp
HL_HepSupport.cpp
HL_IuUP.cpp
HL_Log.cpp
HL_NetworkFrame.cpp
HL_NetworkSocket.cpp
HL_OsVersion.cpp
HL_Pointer.cpp
HL_Rtp.cpp
HL_Singletone.cpp
HL_SocketHeap.cpp
HL_String.cpp
HL_Sync.cpp
HL_Usb.cpp
HL_Uuid.cpp
HL_VariantMap.cpp
)
file(GLOB HELPER_LIB_SOURCES "*.cpp" "*.h")
add_library(helper_lib ${HELPER_LIB_SOURCES})
target_include_directories(helper_lib PRIVATE ../../libs/ ../../engine ../)

View File

@ -6,15 +6,13 @@
#ifndef __SMART_POINTER_H
#define __SMART_POINTER_H
#ifdef USE_NATIVE_SMARTPTR
# include <memory>
# define SharedPtr std::shared_ptr
#else
#include "../../libs/resiprocate/rutil/SharedPtr.hxx"
using resip::SharedPtr;
#endif
#include <memory>
#define SharedPtr std::shared_ptr
#include "HL_Sync.h"
#include <map>
class UsageCounter
{
public:

View File

@ -7,9 +7,9 @@
#include "HL_Exception.h"
#include "HL_String.h"
#include "rtprawpacket.h"
#include "rtpipv4address.h"
#include <alloc.h>
#include "jrtplib/src/rtprawpacket.h"
#include "jrtplib/src/rtpipv4address.h"
#include <alloca.h>
#include <sstream>
#include <tuple>

View File

@ -10,6 +10,8 @@
#endif
#include <set>
#include <assert.h>
#include <unistd.h> // Responsible for close() call on Linux
#include "HL_SocketHeap.h"
#include "HL_Log.h"
#include "HL_Sync.h"
@ -279,6 +281,7 @@ void SocketHeap::thread()
SyncHelper::delay(1000); // Delay for 1 millisecond
}
mId = 0;
mShutdown = false;
//#endif
}

View File

@ -103,7 +103,10 @@ protected:
Mutex mDeleteGuard;
char mTempPacket[MAX_UDPPACKET_SIZE];
volatile bool mShutdown = false;
int mId = 0;
bool isShutdown() const { return mShutdown; }
virtual void thread();
// Processes mDeleteVector -> updates mSocketMap, removes socket items and closes sockets specified in mDeleteVector

View File

@ -0,0 +1,10 @@
project (media_lib)
# Rely on C++ 11
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
file(GLOB MEDIA_LIB_SOURCES "*.cpp" "*.h")
add_library(media_lib ${MEDIA_LIB_SOURCES})
target_include_directories(media_lib PRIVATE ../../libs/ ../ ../../libs/srtp/include ../../libs/srtp/crypto/include)