Skip to content
This repository was archived by the owner on Oct 31, 2022. It is now read-only.

Commit e0c5cb8

Browse files
committed
Limit the number of frames queued in Adobe products on Windows to avoid an After Effects error
1 parent f2fcf69 commit e0c5cb8

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

source/HapCompressor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ Hap_CPrepareToCompressFrames(
572572
goto bail;
573573
}
574574

575-
glob->taskGroup = HapCodecTasksCreateGroup(Background_Encode, 20);
575+
glob->taskGroup = HapCodecTasksCreateGroup(Background_Encode, hapCodecMaxTasks());
576576

577577
#ifdef DEBUG
578578
glob->debugStartTime = CVGetCurrentHostTime();

source/Utility.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,24 @@ SInt16 resourceIDForComponentType(OSType componentType, OSType resourceType)
102102
return 0;
103103
}
104104

105+
int hapCodecMaxTasks()
106+
{
107+
/*
108+
Some Adobe products throw an error if they queue more than 10 buffers
109+
*/
110+
#if defined(_WIN32)
111+
TCHAR executablePath[MAX_PATH + 1];
112+
if (GetModuleFileName(0, executablePath, MAX_PATH + 1) != 0)
113+
{
114+
if (wcsstr(executablePath, L"Adobe") != NULL)
115+
{
116+
return 10;
117+
}
118+
}
119+
#endif
120+
return 20;
121+
}
122+
105123
#if defined(_WIN32) && defined(DEBUG)
106124
void debug_print_s(void *glob, const char *func, const char *s)
107125
{

source/Utility.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ unsigned long dxtBytesForDimensions(int width, int height, OSType codecSubType);
5757

5858
SInt16 resourceIDForComponentType(OSType componentType, OSType resourceType);
5959

60+
int hapCodecMaxTasks();
61+
6062
#ifdef DEBUG
6163
#if defined(_WIN32)
6264
#define debug_print_function_call(glob) debug_print((glob), NULL)

0 commit comments

Comments
 (0)