- more fixes & improvements for pcap2wav windows build
This commit is contained in:
parent
9126b106f5
commit
24e5a83d21
|
|
@ -110,10 +110,10 @@ add_subdirectory(${rtphone_libs}/webrtc)
|
|||
|
||||
set(LIBS ice_stack jrtplib g729_codec gsm_codec
|
||||
gsmhr_codec g722_codec srtp resiprocate helper_lib audio_lib webrtc speexdsp
|
||||
uuid dl)
|
||||
uuid)
|
||||
|
||||
if (CMAKE_SYSTEM MATCHES "Win*")
|
||||
set (LIBS ${LIBS} ssleay32 libeay32 opus silk_float celt)
|
||||
set (LIBS ${LIBS} opus )
|
||||
else (CMAKE_SYSTEM MATCHES "Win*")
|
||||
set (LIBS ${LIBS} dl opus uuid)
|
||||
endif (CMAKE_SYSTEM MATCHES "Win*")
|
||||
|
|
|
|||
|
|
@ -58,6 +58,21 @@ bool FileHelper::isAbsolute(const std::string& s)
|
|||
return s.front() == '/' || s.front() == '\\';
|
||||
}
|
||||
|
||||
std::string FileHelper::getCurrentDir()
|
||||
{
|
||||
#if defined(TARGET_WIN)
|
||||
return std::string();
|
||||
#endif
|
||||
|
||||
#if defined(TARGET_LINUX) || defined(TARGET_OSX)
|
||||
char buffer[512];
|
||||
if (getcwd(buf, sizeof buf) != nullptr)
|
||||
return buf;
|
||||
else
|
||||
return std::string();
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string FileHelper::addTrailingSlash(const std::string& s)
|
||||
{
|
||||
if (s.empty())
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ public:
|
|||
static std::string gettempname();
|
||||
static bool isAbsolute(const std::string& s);
|
||||
|
||||
static std::string getCurrentDir();
|
||||
|
||||
static std::string addTrailingSlash(const std::string& s);
|
||||
static std::string mergePathes(const std::string& s1, const std::string& s2);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ std::string OsProcess::execCommand(const std::string& cmd)
|
|||
|
||||
std::shared_ptr<std::thread> OsProcess::asyncExecCommand(const std::string& cmdline,
|
||||
std::function<void(const std::string& line)> callback,
|
||||
std::function<void(const std::string& reason)> finished_callback,
|
||||
bool& finish_flag)
|
||||
{
|
||||
std::string output;
|
||||
|
|
@ -117,7 +118,8 @@ std::shared_ptr<std::thread> OsProcess::asyncExecCommand(const std::string& cmdl
|
|||
return std::shared_ptr<std::thread>();
|
||||
}
|
||||
|
||||
std::shared_ptr<std::thread> r = std::make_shared<std::thread>([&finish_flag, pi, callback, hPipeRead, hPipeWrite]()
|
||||
std::shared_ptr<std::thread> r = std::make_shared<std::thread>(
|
||||
[&finish_flag, pi, callback, finished_callback, hPipeRead, hPipeWrite]()
|
||||
{
|
||||
char buf[4096]; memset(buf, 0, sizeof buf);
|
||||
for (; !finish_flag ;)
|
||||
|
|
@ -175,7 +177,8 @@ std::shared_ptr<std::thread> OsProcess::asyncExecCommand(const std::string& cmdl
|
|||
}
|
||||
CloseHandle( pi.hProcess );
|
||||
CloseHandle( pi.hThread );
|
||||
|
||||
if (finished_callback)
|
||||
finished_callback(std::string());
|
||||
});
|
||||
|
||||
return r;
|
||||
|
|
|
|||
|
|
@ -52,6 +52,16 @@ void ThreadHelper::setName(const std::string &name)
|
|||
#endif
|
||||
}
|
||||
|
||||
uint64_t ThreadHelper::getCurrentId()
|
||||
{
|
||||
#if defined(TARGET_WIN)
|
||||
return static_cast<uint64_t>(GetCurrentThreadId());
|
||||
#endif
|
||||
|
||||
#if defined(TARGET_LINUX)||defined(TARGET_OSX)
|
||||
return static_cast<uint64_t>(pthread_self());
|
||||
#endif
|
||||
}
|
||||
// ------------------- TimeHelper ---------------
|
||||
using namespace std::chrono;
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ class ThreadHelper
|
|||
{
|
||||
public:
|
||||
static void setName(const std::string& name);
|
||||
static uint64_t getCurrentId();
|
||||
};
|
||||
|
||||
class TimeHelper
|
||||
|
|
|
|||
Loading…
Reference in New Issue