@ -274,14 +274,16 @@ screen_frame_sink_close(struct sc_frame_sink *sink) {
static bool
static bool
screen_frame_sink_push ( struct sc_frame_sink * sink , const AVFrame * frame ) {
screen_frame_sink_push ( struct sc_frame_sink * sink , const AVFrame * frame ) {
struct screen * screen = DOWNCAST ( sink ) ;
struct screen * screen = DOWNCAST ( sink ) ;
return sc_video_buffer_push ( & screen - > vb , frame ) ;
}
bool previous_frame_skipped ;
static void
bool ok = sc_video_buffer_push ( & screen - > vb , frame , & previous_frame_skipped ) ;
sc_video_buffer_on_new_frame ( struct sc_video_buffer * vb , bool previous_skipped ,
if ( ! ok ) {
void * userdata ) {
return false ;
( void ) vb ;
}
struct screen * screen = userdata ;
if ( previous_ frame_ skipped) {
if ( previous_ skipped) {
fps_counter_add_skipped_frame ( & screen - > fps_counter ) ;
fps_counter_add_skipped_frame ( & screen - > fps_counter ) ;
// The EVENT_NEW_FRAME triggered for the previous frame will consume
// The EVENT_NEW_FRAME triggered for the previous frame will consume
// this new frame instead
// this new frame instead
@ -293,8 +295,6 @@ screen_frame_sink_push(struct sc_frame_sink *sink, const AVFrame *frame) {
// Post the event on the UI thread
// Post the event on the UI thread
SDL_PushEvent ( & new_frame_event ) ;
SDL_PushEvent ( & new_frame_event ) ;
}
}
return true ;
}
}
bool
bool
@ -304,7 +304,11 @@ screen_init(struct screen *screen, const struct screen_params *params) {
screen - > fullscreen = false ;
screen - > fullscreen = false ;
screen - > maximized = false ;
screen - > maximized = false ;
bool ok = sc_video_buffer_init ( & screen - > vb ) ;
static const struct sc_video_buffer_callbacks cbs = {
. on_new_frame = sc_video_buffer_on_new_frame ,
} ;
bool ok = sc_video_buffer_init ( & screen - > vb , & cbs , screen ) ;
if ( ! ok ) {
if ( ! ok ) {
LOGE ( " Could not initialize video buffer " ) ;
LOGE ( " Could not initialize video buffer " ) ;
return false ;
return false ;