本文整理汇总了C++中CrashError函数的典型用法代码示例。如果您正苦于以下问题:C++ CrashError函数的具体用法?C++ CrashError怎么用?C++ CrashError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CrashError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Encode
bool Encode(LPVOID picInPtr, List<DataPacket> &packets, List<PacketType> &packetTypes, DWORD outputTimestamp)
{
if(!process_waiter.wait_timeout())
{
int code = 0;
if(!GetExitCodeProcess(process_waiter.list[0], (LPDWORD)&code))
CrashError(TEXT("QSVHelper.exe exited!"));
switch(code)
{
case EXIT_INCOMPATIBLE_CONFIGURATION:
CrashError(TEXT("QSVHelper.exe has exited because of an incompatible qsvimpl custom parameter"));
default:
CrashError(TEXT("QSVHelper.exe has exited with code %i"), code);
}
}
profileIn("ProcessEncodedFrame");
do
{
ProcessEncodedFrame(packets, packetTypes, outputTimestamp, idle_tasks.Num() ? 0 : INFINITE);
}
while(!idle_tasks.Num());
profileOut;
if(picInPtr)
{
profileSegment("QueueEncodeTask");
QueueEncodeTask(*(mfxFrameSurface1*)picInPtr);
}
return true;
}
示例2: sizeof
bool RTMPPublisher::Init(RTMP *rtmpIn, UINT tcpBufferSize)
{
rtmp = rtmpIn;
//------------------------------------------
//Log(TEXT("Using Send Buffer Size: %u"), sendBufferSize);
rtmp->m_customSendFunc = (CUSTOMSEND)RTMPPublisher::BufferedSend;
rtmp->m_customSendParam = this;
rtmp->m_bCustomSend = TRUE;
//------------------------------------------
int curTCPBufSize, curTCPBufSizeSize = sizeof(curTCPBufSize);
getsockopt (rtmp->m_sb.sb_socket, SOL_SOCKET, SO_SNDBUF, (char *)&curTCPBufSize, &curTCPBufSizeSize);
Log(TEXT("SO_SNDBUF was at %u"), curTCPBufSize);
if(curTCPBufSize < int(tcpBufferSize))
{
setsockopt (rtmp->m_sb.sb_socket, SOL_SOCKET, SO_SNDBUF, (const char *)&tcpBufferSize, sizeof(tcpBufferSize));
getsockopt (rtmp->m_sb.sb_socket, SOL_SOCKET, SO_SNDBUF, (char *)&curTCPBufSize, &curTCPBufSizeSize);
if(curTCPBufSize != tcpBufferSize)
Log(TEXT("Could not set SO_SNDBUF to %u, value is now %u"), tcpBufferSize, curTCPBufSize);
}
Log(TEXT("SO_SNDBUF is now %u"), tcpBufferSize);
//------------------------------------------
hSendThread = OSCreateThread((XTHREAD)RTMPPublisher::SendThread, this);
if(!hSendThread)
CrashError(TEXT("RTMPPublisher: Could not create send thread"));
hBufferEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
hBufferSpaceAvailableEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
hWriteEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
hSendLoopExit = CreateEvent(NULL, FALSE, FALSE, NULL);
hSocketLoopExit = CreateEvent(NULL, FALSE, FALSE, NULL);
hSendBacklogEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
hDataBufferMutex = OSCreateMutex();
dataBufferSize = (App->GetVideoEncoder()->GetBitRate() + App->GetAudioEncoder()->GetBitRate()) / 8 * 1024;
dataBuffer = (BYTE *)Allocate(dataBufferSize);
hSocketThread = OSCreateThread((XTHREAD)RTMPPublisher::SocketThread, this);
if(!hSocketThread)
CrashError(TEXT("RTMPPublisher: Could not create send thread"));
//------------------------------------------
packetWaitType = 0;
return true;
}
示例3: BlankAudioPlayback
BlankAudioPlayback(CTSTR lpDevice)
{
const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);
const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator);
const IID IID_IAudioClient = __uuidof(IAudioClient);
const IID IID_IAudioRenderClient = __uuidof(IAudioRenderClient);
HRESULT err;
err = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, IID_IMMDeviceEnumerator, (void**)&mmEnumerator);
if(FAILED(err))
CrashError(TEXT("Could not create IMMDeviceEnumerator: 0x%08lx"), err);
if (scmpi(lpDevice, TEXT("Default")) == 0)
err = mmEnumerator->GetDefaultAudioEndpoint(eRender, eConsole, &mmDevice);
else
err = mmEnumerator->GetDevice(lpDevice, &mmDevice);
if(FAILED(err))
CrashError(TEXT("Could not create IMMDevice"));
err = mmDevice->Activate(IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&mmClient);
if(FAILED(err))
CrashError(TEXT("Could not create IAudioClient"));
WAVEFORMATEX *pwfx;
err = mmClient->GetMixFormat(&pwfx);
if(FAILED(err))
CrashError(TEXT("Could not get mix format from audio client"));
UINT inputBlockSize = pwfx->nBlockAlign;
err = mmClient->Initialize(AUDCLNT_SHAREMODE_SHARED, 0, ConvertMSTo100NanoSec(1000), 0, pwfx, NULL);
if(FAILED(err))
CrashError(TEXT("Could not initialize audio client, error = %08lX"), err);
err = mmClient->GetService(IID_IAudioRenderClient, (void**)&mmRender);
if(FAILED(err))
CrashError(TEXT("Could not get audio render client"));
//----------------------------------------------------------------
UINT bufferFrameCount;
err = mmClient->GetBufferSize(&bufferFrameCount);
if(FAILED(err))
CrashError(TEXT("Could not get audio buffer size"));
BYTE *lpData;
err = mmRender->GetBuffer(bufferFrameCount, &lpData);
if(FAILED(err))
CrashError(TEXT("Could not get audio buffer"));
zero(lpData, bufferFrameCount*inputBlockSize);
mmRender->ReleaseBuffer(bufferFrameCount, 0);//AUDCLNT_BUFFERFLAGS_SILENT); //probably better if it doesn't know
if(FAILED(mmClient->Start()))
CrashError(TEXT("Could not start audio source"));
}
示例4: CreateSemaphore
RTMPPublisher::RTMPPublisher()
{
//bufferedPackets.SetBaseSize(MAX_BUFFERED_PACKETS);
bFirstKeyframe = true;
hSendSempahore = CreateSemaphore(NULL, 0, 0x7FFFFFFFL, NULL);
if(!hSendSempahore)
CrashError(TEXT("RTMPPublisher: Could not create semaphore"));
hDataMutex = OSCreateMutex();
if(!hDataMutex)
CrashError(TEXT("RTMPPublisher: Could not create mutex"));
//------------------------------------------
bframeDropThreshold = AppConfig->GetInt(TEXT("Publish"), TEXT("BFrameDropThreshold"), 400);
if(bframeDropThreshold < 50) bframeDropThreshold = 50;
else if(bframeDropThreshold > 1000) bframeDropThreshold = 1000;
dropThreshold = AppConfig->GetInt(TEXT("Publish"), TEXT("FrameDropThreshold"), 600);
if(dropThreshold < 50) dropThreshold = 50;
else if(dropThreshold > 1000) dropThreshold = 1000;
if (AppConfig->GetInt(TEXT("Publish"), TEXT("LowLatencyMode"), 0))
{
if (AppConfig->GetInt(TEXT("Publish"), TEXT("LowLatencyMethod"), 0) == 0)
{
latencyFactor = AppConfig->GetInt(TEXT("Publish"), TEXT("LatencyFactor"), 20);
if (latencyFactor < 3)
latencyFactor = 3;
lowLatencyMode = LL_MODE_FIXED;
Log(TEXT("Using fixed low latency mode, factor %d"), latencyFactor);
}
else
{
lowLatencyMode = LL_MODE_AUTO;
Log(TEXT("Using automatic low latency mode"));
}
}
else
lowLatencyMode = LL_MODE_NONE;
bFastInitialKeyframe = AppConfig->GetInt(TEXT("Publish"), TEXT("FastInitialKeyframe"), 0) == 1;
strRTMPErrors.Clear();
}
示例5: traceIn
DXInput::DXInput()
{
traceIn(DXInput::DXInput);
Log(TEXT("Initializing DirectInput"));
++realtimeCounter;
bDInputActive = 1;
if(DirectInput8Create((HINSTANCE)hinstMain, DIRECTINPUT_VERSION, IID_IDirectInput8A, (void**)&diDevice, NULL) != DI_OK)
CrashError(TEXT("DInput: Could not create Direct Input device"));
InputEvents[0] = CreateEvent(NULL, 0, 0, NULL);
InputEvents[1] = CreateEvent(NULL, 0, 0, NULL);
DICreateKeyboardDevice(hwndMain);
DICreateMouseDevice(hwndMain);
//DWORD dummy;
//hInputThread = CreateThread(NULL, 0, InputThread, NULL, 0, &dummy);
//if(hInputThread == INVALID_HANDLE_VALUE)
// CrashError(TEXT("DInput: could not create input thread"));
traceOut;
}
示例6: QueueEncodeTask
void QueueEncodeTask(mfxFrameSurface1& pic)
{
encode_task& task = encode_tasks[idle_tasks[0]];
auto lock_queue = lock_mutex(frame_queue);
for(unsigned i = 0; i < frame_queue.size; i++)
{
queued_frame &info = frame_queue[i];
if(info.is_new)
continue;
queued_tasks << idle_tasks[0];
idle_tasks.Remove(0);
info.is_new = true;
info.request_keyframe = bRequestKeyframe;
bRequestKeyframe = false;
info.timestamp = task.surf.Data.TimeStamp = timestampFromMS(pic.Data.TimeStamp);
info.frame_index = (uint32_t)pic.Data.MemId-1;
auto lock_status = lock_mutex(frame_buff_status);
frame_buff_status[info.frame_index] += 1;
frame_queue.signal();
return;
}
CrashError(TEXT("QSV encoder is too slow"));
}
示例7: tstr_createUTF8
void D3D10VertexShader::CreateVertexShaderBlob(ShaderBlob &blob, CTSTR lpShader, CTSTR lpFileName)
{
D3D10System *d3d10Sys = static_cast<D3D10System*>(GS);
LPCSTR lpVSType = d3d10Sys->bDisableCompatibilityMode ? "vs_4_0" : "vs_4_0_level_9_3";
ComPtr<ID3D10Blob> errorMessages, shaderBlob;
LPSTR lpAnsiShader = tstr_createUTF8(lpShader);
LPSTR lpAnsiFileName = tstr_createUTF8(lpFileName);
HRESULT err = D3DX11CompileFromMemory(lpAnsiShader, strlen(lpAnsiShader), lpAnsiFileName, NULL, NULL, "main", lpVSType, D3D10_SHADER_OPTIMIZATION_LEVEL3, 0, NULL, shaderBlob.Assign(), errorMessages.Assign(), NULL);
Free(lpAnsiFileName);
Free(lpAnsiShader);
if (FAILED(err))
{
if (errorMessages)
{
if (errorMessages->GetBufferSize())
{
LPSTR lpErrors = (LPSTR)errorMessages->GetBufferPointer();
Log(TEXT("Error compiling vertex shader '%s':\r\n\r\n%S\r\n"), lpFileName, lpErrors);
}
}
CrashError(TEXT("Compilation of vertex shader '%s' failed, result = %08lX"), lpFileName, err);
return;
}
blob.assign((char*)shaderBlob->GetBufferPointer(), (char*)shaderBlob->GetBufferPointer() + shaderBlob->GetBufferSize());
}
示例8: AppWarning
Shader *D3D10PixelShader::CreatePixelShaderFromBlob(ShaderBlob const &blob, CTSTR lpShader, CTSTR lpFileName)
{
ShaderProcessor shaderProcessor;
if (!shaderProcessor.ProcessShader(lpShader, lpFileName))
AppWarning(TEXT("Unable to process pixel shader '%s'"), lpFileName); //don't exit, leave it to the actual shader compiler to tell the errors
//-----------------------------------------------
if (!blob.size())
return nullptr;
ID3D11PixelShader *pShader;
HRESULT err = GetD3D()->CreatePixelShader(&blob.front(), blob.size(), NULL, &pShader);
if (FAILED(err))
{
CrashError(TEXT("Unable to create pixel shader '%s', result = %08lX"), lpFileName, err);
return NULL;
}
//-----------------------------------------------
D3D10PixelShader *shader = new D3D10PixelShader;
shader->pixelShader = pShader;
if (!shader->ProcessData(shaderProcessor, lpFileName))
{
delete shader;
return NULL;
}
return shader;
}
示例9: OSIncompatibleModulesLoaded
BOOL STDCALL OSIncompatibleModulesLoaded()
{
StringList moduleList;
//Modules that will likely cause OBS to crash because they hooked it.
//This list is checked on stream start only.
if (!OSGetLoadedModuleList(GetCurrentProcess(), moduleList))
return 0;
for(UINT i=0; i<moduleList.Num(); i++)
{
CTSTR moduleName = moduleList[i];
if (!scmp(moduleName, TEXT("dxtorycore.dll")) || //DXTory
!scmp(moduleName, TEXT("dxtorycore64.dll")) || //DXTory
!scmp(moduleName, TEXT("dxtorymm.dll")) || //DXTory
!scmp(moduleName, TEXT("dxtorymm64.dll")) || //DXTory
!scmp(moduleName, TEXT("rtsshooks.dll")) || //EVGA Precision OSD
!scmp(moduleName, TEXT("axonoverlay.dll")) || //Dolby Axon
!scmp(moduleName, TEXT("action_x86.dll")) || //Action!
!scmp(moduleName, TEXT("action_x64.dll"))) //Action!
{
return 1;
}
else if (!scmp(moduleName, TEXT("atkdx11disp.dll"))) //ASUS GamerOSD
{
//ASUS GamerOSD is so terrible we can't even cleanly shutdown once it loads, trying to unload D3D crashes too (!)
CrashError (TEXT("ASUS GamerOSD has been detected. This program installs user mode driver hooks which will corrupt the Direct3D state and crash OBS. Please uninstall ASUS GamerOSD if you wish to use OBS."));
}
}
return 0;
}
示例10: MP3Encoder
MP3Encoder(UINT bitRate)
{
curBitRate = bitRate;
lgf = lame_init();
if(!lgf)
CrashError(TEXT("Unable to open mp3 encoder"));
lame_set_in_samplerate(lgf, App->GetSampleRateHz());
lame_set_out_samplerate(lgf, App->GetSampleRateHz());
lame_set_num_channels(lgf, 2);
lame_set_mode(lgf, STEREO);
lame_set_disable_reservoir(lgf, TRUE); //bit reservoir has to be disabled for seamless streaming
lame_set_VBR(lgf, vbr_off);
lame_set_brate(lgf, bitRate);
lame_init_params(lgf);
outputFrameSize = lame_get_framesize(lgf); //1152 usually
dwMP3MaxSize = DWORD(1.25*double(outputFrameSize*audioBlockSize) + 7200.0);
MP3OutputBuffer.SetSize(dwMP3MaxSize+1);
MP3OutputBuffer[0] = 0x2f;
bFirstPacket = true;
Log(TEXT("------------------------------------------"));
Log(TEXT("%s"), GetInfoString().Array());
}
示例11: traceInFast
Shader* ResourceManager::GetVertexShader(CTSTR lpName)
{
traceInFast(ResourceManager::GetVertexShader);
assert(lpName);
UINT val = VertexShaderNames.FindValueIndexI(lpName);
if(val != INVALID)
return VertexShaders[val];
//----------------------------------------
String path;
if(!Engine::ConvertResourceName(lpName, TEXT("shaders"), path))
return NULL;
//----------------------------------------
Shader *newVertexShader = GS->CreateVertexShaderFromFile(path);
if(!newVertexShader)
{
CrashError(TEXT("Resource Manager: Could not find Vertex Shader %s"), lpName);
return NULL;
}
VertexShaderNames << lpName;
VertexShaders << newVertexShader;
return newVertexShader;
traceOutFast;
}
示例12: GetVolumeControlValue
float GetVolumeControlValue(HWND hwnd)
{
VolumeControlData *control = GetVolumeControlData(hwnd);
if(!control)
CrashError(TEXT("GetVolumeControlValue called on a control that's not a volume control"));
return control->curVolume;
}
示例13: SafeRelease
void D3D10System::ResizeView()
{
LPVOID nullVal = NULL;
d3d->OMSetRenderTargets(1, (ID3D10RenderTargetView**)&nullVal, NULL);
SafeRelease(swapRenderView);
swap->ResizeBuffers(2, 0, 0, DXGI_FORMAT_B8G8R8A8_UNORM, 0);
ID3D10Texture2D *backBuffer = NULL;
HRESULT err = swap->GetBuffer(0, IID_ID3D10Texture2D, (void**)&backBuffer);
if(FAILED(err))
CrashError(TEXT("Unable to get back buffer from swap chain"));
err = d3d->CreateRenderTargetView(backBuffer, NULL, &swapRenderView);
if(FAILED(err))
CrashError(TEXT("Unable to get render view from back buffer"));
backBuffer->Release();
}
示例14: OSCreateThread
HANDLE STDCALL OSCreateThread(XTHREAD lpThreadFunc, LPVOID param)
{
HANDLE hThread;
DWORD dummy;
hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)lpThreadFunc, param, 0, &dummy);
if (!hThread)
CrashError (TEXT("CreateThread 0x%p failed: %d"), (LPVOID)lpThreadFunc, GetLastError());
return hThread;
}
示例15: OSEnterMutex
void * FastAlloc::_Allocate(size_t dwSize)
{
OSEnterMutex(hAllocationMutex);
//assert(dwSize);
if(!dwSize) dwSize = 1;
LPVOID lpMemory;
Pool *pool;
if(dwSize < 0x8001)
{
MemInfo *meminfo = GetMemInfo(dwSize);
if(!meminfo->nextFree) //no pools have been created for this section
{
lpMemory = OSVirtualAlloc(0x10000);
if(!lpMemory) CrashError(TEXT("Out of memory"));
Pool *&poollist = PoolList[PtrTo32(lpMemory)>>24];
if(!poollist)
{
poollist = (Pool*)OSVirtualAlloc(sizeof(Pool)*256);
if(!poollist) CrashError(TEXT("Out of memory"));
zero(poollist, sizeof(Pool)*256);
}
pool = &poollist[(PtrTo32(lpMemory)>>16)&0xFF];
pool->lpMem = lpMemory;
pool->bytesTotal = 0x10000;
pool->meminfo = meminfo;
pool->firstFreeMem = (FreeMemInfo*)lpMemory;
pool->lastFreeMem = (FreeMemInfo*)lpMemory;
meminfo->nextFree = (FreeMemInfo*)lpMemory;
meminfo->nextFree->num = meminfo->maxBlocks;
meminfo->nextFree->lpPool = pool;
meminfo->nextFree->lpPrev = meminfo->nextFree->lpNext = NULL;
}