[host] capture: switch all asserts to DEBUG_ASSERT

This commit is contained in:
Quantum 2021-08-13 19:30:41 -04:00 committed by Geoffrey McRae
parent a9241f6710
commit 4f7ce91e7f
3 changed files with 19 additions and 22 deletions

View File

@ -23,7 +23,6 @@
#include "common/debug.h"
#include "common/event.h"
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include <inttypes.h>
#include <xcb/shm.h>
@ -64,7 +63,7 @@ static const char * xcb_getName(void)
static bool xcb_create(CaptureGetPointerBuffer getPointerBufferFn, CapturePostPointerBuffer postPointerBufferFn)
{
assert(!this);
DEBUG_ASSERT(!this);
this = (struct xcb *)calloc(sizeof(struct xcb), 1);
this->shmID = -1;
this->data = (void *)-1;
@ -82,8 +81,8 @@ static bool xcb_create(CaptureGetPointerBuffer getPointerBufferFn, CapturePostPo
static bool xcb_init(void)
{
assert(this);
assert(!this->initialized);
DEBUG_ASSERT(this);
DEBUG_ASSERT(!this->initialized);
lgResetEvent(this->frameEvent);
@ -134,7 +133,7 @@ fail:
static bool xcb_deinit(void)
{
assert(this);
DEBUG_ASSERT(this);
if ((uintptr_t)this->data != -1)
{
@ -167,8 +166,8 @@ static void xcb_free(void)
static CaptureResult xcb_capture(void)
{
assert(this);
assert(this->initialized);
DEBUG_ASSERT(this);
DEBUG_ASSERT(this->initialized);
if (!this->hasFrame)
{
@ -211,8 +210,8 @@ static CaptureResult xcb_waitFrame(CaptureFrame * frame,
static CaptureResult xcb_getFrame(FrameBuffer * frame,
const unsigned int height, int frameIndex)
{
assert(this);
assert(this->initialized);
DEBUG_ASSERT(this);
DEBUG_ASSERT(this->initialized);
xcb_shm_get_image_reply_t * img;
img = xcb_shm_get_image_reply(this->xcb, this->imgC, NULL);

View File

@ -30,7 +30,6 @@
#include "common/runningavg.h"
#include "common/KVMFR.h"
#include <assert.h>
#include <stdatomic.h>
#include <unistd.h>
#include <dxgi.h>
@ -170,7 +169,7 @@ static void dxgi_initOptions(void)
static bool dxgi_create(CaptureGetPointerBuffer getPointerBufferFn, CapturePostPointerBuffer postPointerBufferFn)
{
assert(!this);
DEBUG_ASSERT(!this);
this = calloc(sizeof(struct iface), 1);
if (!this)
{
@ -200,7 +199,7 @@ static bool dxgi_create(CaptureGetPointerBuffer getPointerBufferFn, CapturePostP
static bool dxgi_init(void)
{
assert(this);
DEBUG_ASSERT(this);
this->desktop = OpenInputDesktop(0, FALSE, GENERIC_READ);
if (!this->desktop)
@ -601,7 +600,7 @@ static void dxgi_stop(void)
static bool dxgi_deinit(void)
{
assert(this);
DEBUG_ASSERT(this);
for (int i = 0; i < this->maxTextures; ++i)
{
@ -677,7 +676,7 @@ static bool dxgi_deinit(void)
static void dxgi_free(void)
{
assert(this);
DEBUG_ASSERT(this);
if (this->initialized)
dxgi_deinit();
@ -785,8 +784,8 @@ static void computeFrameDamage(Texture * tex)
static CaptureResult dxgi_capture(void)
{
assert(this);
assert(this->initialized);
DEBUG_ASSERT(this);
DEBUG_ASSERT(this->initialized);
Texture * tex = NULL;
CaptureResult result;
@ -1008,8 +1007,8 @@ static CaptureResult dxgi_capture(void)
static CaptureResult dxgi_waitFrame(CaptureFrame * frame, const size_t maxFrameSize)
{
assert(this);
assert(this->initialized);
DEBUG_ASSERT(this);
DEBUG_ASSERT(this->initialized);
// NOTE: the event may be signaled when there are no frames available
if (atomic_load_explicit(&this->texReady, memory_order_acquire) == 0)
@ -1080,8 +1079,8 @@ static CaptureResult dxgi_waitFrame(CaptureFrame * frame, const size_t maxFrameS
static CaptureResult dxgi_getFrame(FrameBuffer * frame,
const unsigned int height, int frameIndex)
{
assert(this);
assert(this->initialized);
DEBUG_ASSERT(this);
DEBUG_ASSERT(this->initialized);
Texture * tex = &this->texture[this->texRIndex];
@ -1127,7 +1126,7 @@ static CaptureResult dxgi_getFrame(FrameBuffer * frame,
static CaptureResult dxgi_releaseFrame(void)
{
assert(this);
DEBUG_ASSERT(this);
if (!this->needsRelease)
return CAPTURE_RESULT_OK;

View File

@ -30,7 +30,6 @@
#include "common/rects.h"
#include "common/thread.h"
#include "common/KVMFR.h"
#include <assert.h>
#include <stdlib.h>
#include <stdatomic.h>
#include <windows.h>