1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-13 16:44:50 +02:00

#129 sync audio/video chunks for STR video decoder; #15 fix windows release build, no logging

This commit is contained in:
XProger
2019-01-13 06:03:08 +03:00
parent 9946d28875
commit 347bb78e22
3 changed files with 14 additions and 5 deletions

View File

@@ -735,7 +735,7 @@ int main(int argc, char** argv) {
int main(int argc, char** argv) { int main(int argc, char** argv) {
#else #else
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { 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 }; char *argv[] = { "", lpCmdLine };
#endif #endif
cacheDir[0] = saveDir[0] = contentDir[0] = 0; cacheDir[0] = saveDir[0] = contentDir[0] = 0;

View File

@@ -26,11 +26,14 @@
#define ASSERT(expr) #define ASSERT(expr)
#define ASSERTV(expr) (expr) ? 1 : 0 #define ASSERTV(expr) (expr) ? 1 : 0
#ifdef _OS_LINUX #ifdef PROFILE
#define LOG(...) printf(__VA_ARGS__); fflush(stdout) #ifdef _OS_LINUX
#define LOG(...) printf(__VA_ARGS__); fflush(stdout)
#else
#define LOG(...) printf(__VA_ARGS__)
#endif
#else #else
#define LOG(...) printf(__VA_ARGS__) #define LOG(...) 0
// #define LOG(...) 0
#endif #endif
#endif #endif

View File

@@ -863,6 +863,9 @@ struct Video {
bool nextChunk() { bool nextChunk() {
OS_LOCK(Sound::lock); OS_LOCK(Sound::lock);
if (videoChunks[videoChunksCount % MAX_CHUNKS].size > 0)
return false;
if (stream->pos >= stream->size) if (stream->pos >= stream->size)
return false; return false;
@@ -1059,6 +1062,8 @@ struct Video {
} }
} }
chunk->size = 0;
return true; return true;
} }
@@ -1072,6 +1077,7 @@ struct Video {
curAudioChunk++; curAudioChunk++;
while (curAudioChunk >= audioChunksCount) { while (curAudioChunk >= audioChunksCount) {
if (!nextChunk()) { if (!nextChunk()) {
curAudioChunk--;
memset(frames, 0, count * sizeof(Sound::Frame)); memset(frames, 0, count * sizeof(Sound::Frame));
return count; return count;
} }