Ticket #5116: libs_libmythtv_NuppelVideoRecorder.cpp-check-avcodec_encode_video-return-value.patch

File libs_libmythtv_NuppelVideoRecorder.cpp-check-avcodec_encode_video-return-value.patch, 1.0 KB (added by Erik Hovland <erik@…>, 12 years ago)

checks avcodec_encode_video before progressing

  • libs/libmythtv/NuppelVideoRecorder.cpp

    avcodec_encode_video can return -1 if things went wrong. It should be checked before
    
    From: Erik Hovland <erik@hovland.org>
    
    any action is made with the returned value.
    ---
    
     libs/libmythtv/NuppelVideoRecorder.cpp |    7 +++++++
     1 files changed, 7 insertions(+), 0 deletions(-)
    
    diff --git a/libs/libmythtv/NuppelVideoRecorder.cpp b/libs/libmythtv/NuppelVideoRecorder.cpp
    index d24e38a..b599847 100644
    a b void NuppelVideoRecorder::WriteVideo(VideoFrame *frame, bool skipsync, 
    30813081            QMutexLocker locker(&avcodeclock);
    30823082            tmp = avcodec_encode_video(mpa_vidctx, (unsigned char *)strm,
    30833083                                       len, &mpa_picture);
     3084            if (tmp == -1)
     3085            {
     3086                VERBOSE(VB_IMPORTANT,
     3087                        LOC_ERR + "NuppelVideoRecorder::WriteVideo : "
     3088                                  "avcodec_encode_video() failed");
     3089                return;
     3090            }
    30843091        }
    30853092    }
    30863093    else