Make SKIP_FRAMES a compilation flag

The skip_frames flag was a non-configurable runtime flag. Since it is
not exposed to the user, there is no need for a (possible) runtime cost.

For testing purpose, we still want it to be configurable, so make it a
compilation flag.
This commit is contained in:
Romain Vimont
2018-02-07 12:25:52 +01:00
parent 53ff1aa410
commit 8d30d40b79
6 changed files with 30 additions and 13 deletions

View File

@@ -17,16 +17,17 @@ SDL_bool frames_init(struct frames *frames) {
goto error_2;
}
#ifndef SKIP_FRAMES
if (!(frames->rendering_frame_consumed_cond = SDL_CreateCond())) {
goto error_3;
SDL_DestroyMutex(frames->mutex);
goto error_2;
}
#endif
frames->rendering_frame_consumed = SDL_TRUE;
return SDL_TRUE;
error_3:
SDL_DestroyMutex(frames->mutex);
error_2:
av_frame_free(&frames->rendering_frame);
error_1:
@@ -36,7 +37,9 @@ error_0:
}
void frames_destroy(struct frames *frames) {
#ifndef SKIP_FRAMES
SDL_DestroyCond(frames->rendering_frame_consumed_cond);
#endif
SDL_DestroyMutex(frames->mutex);
av_frame_free(&frames->rendering_frame);
av_frame_free(&frames->decoding_frame);