Ticket #10878: 0001-mythplayer-Don-t-call-DoneDisplayingFrame-for-PiP-un.patch

File 0001-mythplayer-Don-t-call-DoneDisplayingFrame-for-PiP-un.patch, 2.0 KB (added by Lawrence Rust <lvr@…>, 9 years ago)
  • mythtv/libs/libmythtv/mythplayer.cpp

    From 0195b902c7b9b8c9a9ae891f2f2d4d1dc0c57584 Mon Sep 17 00:00:00 2001
    From: Lawrence Rust <lvr@softsystem.co.uk>
    Date: Wed, 4 Jul 2012 16:39:13 +0200
    Subject: [PATCH] mythplayer: Don't call DoneDisplayingFrame for PiP until next frame is ready
    
    When displaying 'pictute in picture' (PiP), VideoOutput::ShowPIP
    composites the PiP windows onto the main video frame.  To do so, it uses
    the player's GetCurrentFrame method to obtain the most recently displayed
    PiP frame.  However, MythPlayer::DisplayNormalFrames immediately releases
    the last frame displayed back to the decoding queue.  Consequently when
    GetCurrentFrame calls GetLastShownFrame to obtain that frame it may have been
    overwritten by the decoder thread.
    
    This patch defers calling DoneDisplayingFrame if the player is a PiP
    player so that future calls to GetLastShownFrame return an intact frame.
    
    Signed-off-by: Lawrence Rust <lvr@softsystem.co.uk>
    ---
     mythtv/libs/libmythtv/mythplayer.cpp |    8 +++++++-
     1 files changed, 7 insertions(+), 1 deletions(-)
    
    diff --git a/mythtv/libs/libmythtv/mythplayer.cpp b/mythtv/libs/libmythtv/mythplayer.cpp
    index 5a637f7..5c92280 100644
    a b void MythPlayer::DisplayNormalFrame(bool check_prebuffer) 
    21552155    // clear the buffering state
    21562156    SetBuffering(false);
    21572157
     2158    // If PiP then release the last shown frame to the decoding queue
     2159    if (player_ctx->IsPIP())
     2160        videoOutput->DoneDisplayingFrame(videoOutput->GetLastShownFrame());
     2161
    21582162    // retrieve the next frame
    21592163    videoOutput->StartDisplayingFrame();
    21602164    VideoFrame *frame = videoOutput->GetLastShownFrame();
    void MythPlayer::DisplayNormalFrame(bool check_prebuffer) 
    21802184    osdLock.unlock();
    21812185
    21822186    AVSync(frame, 0);
    2183     videoOutput->DoneDisplayingFrame(frame);
     2187    // If PiP then keep this frame for MythPlayer::GetCurrentFrame
     2188    if (!player_ctx->IsPIP())
     2189        videoOutput->DoneDisplayingFrame(frame);
    21842190}
    21852191
    21862192void MythPlayer::PreProcessNormalFrame(void)