Wrap SDL thread functions into scrcpy-specific API

The goal is to expose a consistent API for system tools, and paves the
way to make the "core" independant of SDL in the future.
This commit is contained in:
Romain Vimont
2021-01-31 18:24:35 +01:00
parent 30e619d37f
commit f6320c7e31
24 changed files with 395 additions and 274 deletions

View File

@@ -8,7 +8,6 @@
#include "scrcpy.h"
#include "tiny_xpm.h"
#include "video_buffer.h"
#include "util/lock.h"
#include "util/log.h"
#define DISPLAY_MARGINS 96
@@ -454,15 +453,15 @@ update_texture(struct screen *screen, const AVFrame *frame) {
bool
screen_update_frame(struct screen *screen, struct video_buffer *vb) {
mutex_lock(vb->mutex);
sc_mutex_lock(&vb->mutex);
const AVFrame *frame = video_buffer_consume_rendered_frame(vb);
struct size new_frame_size = {frame->width, frame->height};
if (!prepare_for_frame(screen, new_frame_size)) {
mutex_unlock(vb->mutex);
sc_mutex_unlock(&vb->mutex);
return false;
}
update_texture(screen, frame);
mutex_unlock(vb->mutex);
sc_mutex_unlock(&vb->mutex);
screen_render(screen, false);
return true;