Move fps counter out of video buffer
In order to make video buffer more generic, move out its specific responsibility to count the fps between the decoder and the renderer.
This commit is contained in:
@@ -192,9 +192,11 @@ screen_update_content_rect(struct screen *screen) {
|
||||
}
|
||||
|
||||
void
|
||||
screen_init(struct screen *screen, struct video_buffer *vb) {
|
||||
screen_init(struct screen *screen, struct video_buffer *vb,
|
||||
struct fps_counter *fps_counter) {
|
||||
*screen = (struct screen) SCREEN_INITIALIZER;
|
||||
screen->vb = vb;
|
||||
screen->fps_counter = fps_counter;
|
||||
}
|
||||
|
||||
static inline SDL_Texture *
|
||||
@@ -450,6 +452,9 @@ update_texture(struct screen *screen, const AVFrame *frame) {
|
||||
static bool
|
||||
screen_update_frame(struct screen *screen) {
|
||||
const AVFrame *frame = video_buffer_take_rendering_frame(screen->vb);
|
||||
|
||||
fps_counter_add_rendered_frame(screen->fps_counter);
|
||||
|
||||
struct size new_frame_size = {frame->width, frame->height};
|
||||
if (!prepare_for_frame(screen, new_frame_size)) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user