From: Steinar H. Gunderson Date: Sat, 16 Jun 2018 19:53:20 +0000 (+0200) Subject: Fix yet more Y'CbCr crashes. X-Git-Tag: 1.8.0~76^2~266 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=dd7575b55cf9b50b535cd8ba5ae973ff0c12e510;p=nageru Fix yet more Y'CbCr crashes. --- diff --git a/jpeg_frame_view.cpp b/jpeg_frame_view.cpp index 95f7453..9624352 100644 --- a/jpeg_frame_view.cpp +++ b/jpeg_frame_view.cpp @@ -271,8 +271,11 @@ void JPEGFrameView::resizeGL(int width, int height) void JPEGFrameView::paintGL() { - //glClearColor(0.0f, 1.0f, 0.0f, 1.0f); - //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + if (current_frame == nullptr) { + glClearColor(0.0f, 0.0f, 0.0f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT); + return; + } check_error(); chain->render_to_screen(); @@ -282,6 +285,9 @@ void JPEGFrameView::setDecodedFrame(std::shared_ptr frame) { post_to_main_thread([this, frame] { current_frame = frame; + ycbcr_format.chroma_subsampling_x = frame->chroma_subsampling_x; + ycbcr_format.chroma_subsampling_y = frame->chroma_subsampling_y; + ycbcr_input->change_ycbcr_format(ycbcr_format); ycbcr_input->set_width(frame->width); ycbcr_input->set_height(frame->height); ycbcr_input->set_pixel_data(0, frame->y.get()); @@ -290,9 +296,6 @@ void JPEGFrameView::setDecodedFrame(std::shared_ptr frame) ycbcr_input->set_pitch(0, frame->pitch_y); ycbcr_input->set_pitch(1, frame->pitch_chroma); ycbcr_input->set_pitch(2, frame->pitch_chroma); - ycbcr_format.chroma_subsampling_x = frame->chroma_subsampling_x; - ycbcr_format.chroma_subsampling_y = frame->chroma_subsampling_y; - ycbcr_input->change_ycbcr_format(ycbcr_format); update(); }); }