From 347bb78e229c53af0a234073fe5f5536e1900047 Mon Sep 17 00:00:00 2001 From: XProger Date: Sun, 13 Jan 2019 06:03:08 +0300 Subject: [PATCH] #129 sync audio/video chunks for STR video decoder; #15 fix windows release build, no logging --- src/platform/win/main.cpp | 2 +- src/utils.h | 11 +++++++---- src/video.h | 6 ++++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/platform/win/main.cpp b/src/platform/win/main.cpp index 18e9a84..13bb6c6 100644 --- a/src/platform/win/main.cpp +++ b/src/platform/win/main.cpp @@ -735,7 +735,7 @@ int main(int argc, char** argv) { int main(int argc, char** argv) { #else int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { - int argc = lpCmdLine ? 2 : 1; + int argc = (lpCmdLine && strlen(lpCmdLine)) ? 2 : 1; char *argv[] = { "", lpCmdLine }; #endif cacheDir[0] = saveDir[0] = contentDir[0] = 0; diff --git a/src/utils.h b/src/utils.h index a425d56..09b865c 100644 --- a/src/utils.h +++ b/src/utils.h @@ -26,11 +26,14 @@ #define ASSERT(expr) #define ASSERTV(expr) (expr) ? 1 : 0 - #ifdef _OS_LINUX - #define LOG(...) printf(__VA_ARGS__); fflush(stdout) + #ifdef PROFILE + #ifdef _OS_LINUX + #define LOG(...) printf(__VA_ARGS__); fflush(stdout) + #else + #define LOG(...) printf(__VA_ARGS__) + #endif #else - #define LOG(...) printf(__VA_ARGS__) - // #define LOG(...) 0 + #define LOG(...) 0 #endif #endif diff --git a/src/video.h b/src/video.h index b047e3d..921fe03 100644 --- a/src/video.h +++ b/src/video.h @@ -863,6 +863,9 @@ struct Video { bool nextChunk() { OS_LOCK(Sound::lock); + if (videoChunks[videoChunksCount % MAX_CHUNKS].size > 0) + return false; + if (stream->pos >= stream->size) return false; @@ -1059,6 +1062,8 @@ struct Video { } } + chunk->size = 0; + return true; } @@ -1072,6 +1077,7 @@ struct Video { curAudioChunk++; while (curAudioChunk >= audioChunksCount) { if (!nextChunk()) { + curAudioChunk--; memset(frames, 0, count * sizeof(Sound::Frame)); return count; }