summaryrefslogtreecommitdiff
path: root/src/video.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/video.c')
-rw-r--r--src/video.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/video.c b/src/video.c
index 2fe019a..ff77fcb 100644
--- a/src/video.c
+++ b/src/video.c
@@ -375,12 +375,11 @@ static int setup_vaapi_pipeline(struct shadow_fd *sfd, struct render_data *rd,
static void cleanup_vaapi_pipeline(struct shadow_fd *sfd)
{
- if (!sfd->video_context) {
- return;
- }
- if (!sfd->video_context->hw_device_ctx) {
+ if (!sfd->video_va_surface && !sfd->video_va_context &&
+ !sfd->video_va_pipeline) {
return;
}
+
AVHWDeviceContext *vwdc =
(AVHWDeviceContext *)
sfd->video_context->hw_device_ctx->data;
@@ -853,6 +852,12 @@ fail_alignment:
int setup_video_encode(struct shadow_fd *sfd, struct render_data *rd)
{
+ if (sfd->video_context) {
+ wp_error("Video context already set up for sfd RID=%d",
+ sfd->remote_id);
+ return -1;
+ }
+
bool has_hw = init_hwcontext(rd) == 0;
/* Attempt hardware encoding, and if it doesn't succeed, fall back
* to software encoding */