win-capture: Fix memory capture crash on new capture

If the target process re-creates its D3D context, the game capture tick
can trigger before the capture is setup, in which case OBS gets a
CAPTURE_RETRY message. However with the memory capture method, it
continues to try and copy from the shared memory pointer which is no
longer valid, resulting in a crash. The fix uses the old texture until
the next tick at which point the new capture should be ready for use.
master
Richard Stanway 2017-12-14 16:40:14 +01:00
parent cf9f016820
commit 66ec96d52c
No known key found for this signature in database
GPG Key ID: AAC1E5265D71B3FD
1 changed files with 6 additions and 1 deletions

View File

@ -1429,12 +1429,17 @@ static inline void copy_16bit_tex(struct game_capture *gc, int cur_texture,
static void copy_shmem_tex(struct game_capture *gc)
{
int cur_texture = gc->shmem_data->last_tex;
int cur_texture;
HANDLE mutex = NULL;
uint32_t pitch;
int next_texture;
uint8_t *data;
if (!gc->shmem_data)
return;
cur_texture = gc->shmem_data->last_tex;
if (cur_texture < 0 || cur_texture > 1)
return;