2
0
mirror of https://github.com/Genymobile/scrcpy synced 2025-08-31 22:35:37 +00:00

Move frame updating to screen.c

Replace screen_update() by a higher-level screen_update_frame() handling
the whole frame updating, so that scrcpy.c just call it without managing
implementation details.
This commit is contained in:
Romain Vimont
2018-02-09 11:14:47 +01:00
parent 7458d8271e
commit fe21d9dfb5
3 changed files with 12 additions and 17 deletions

View File

@@ -46,19 +46,6 @@ static void count_frame(void) {
}
}
static SDL_bool handle_new_frame(void) {
mutex_lock(frames.mutex);
const AVFrame *frame = frames_consume_rendered_frame(&frames);
if (!screen_update(&screen, frame)){
mutex_unlock(frames.mutex);
return SDL_FALSE;
}
mutex_unlock(frames.mutex);
screen_render(&screen);
return SDL_TRUE;
}
static void event_loop(void) {
SDL_Event event;
while (SDL_WaitEvent(&event)) {
@@ -70,7 +57,7 @@ static void event_loop(void) {
SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "User requested to quit");
return;
case EVENT_NEW_FRAME:
if (!handle_new_frame()) {
if (!screen_update_frame(&screen, &frames)) {
return;
}
count_frame(); // display fps for debug