Ticket #6211: 0005-Well-increasing-kDecoderProbeBufferSize-to-1MB-for-w.patch

File 0005-Well-increasing-kDecoderProbeBufferSize-to-1MB-for-w.patch, 3.5 KB (added by chr, 15 years ago)
  • mythtv/libs/libmythtv/NuppelVideoPlayer.cpp

    From 5ecc8ad8636847c149f27e6386fab01e391d6eef Mon Sep 17 00:00:00 2001
    From: chris <chris@ rudorff com>
    Date: Sun, 27 Jun 2010 01:52:22 +0200
    Subject: [PATCH 5/5] Well, increasing kDecoderProbeBufferSize to 1MB for whatever reason
     results in a stack overflow on osx.
    
    This patch allocates that test buffer on the heap ... and if I
    understood it right, the testbuf is a tmp_buf, right?
    ---
     mythtv/libs/libmythtv/NuppelVideoPlayer.cpp |   21 ++++++++++++++-------
     mythtv/libs/libmythtv/decoderbase.h         |    2 +-
     2 files changed, 15 insertions(+), 8 deletions(-)
    
    diff --git a/mythtv/libs/libmythtv/NuppelVideoPlayer.cpp b/mythtv/libs/libmythtv/NuppelVideoPlayer.cpp
    index 2fa8641..c176e35 100644
    a b int NuppelVideoPlayer::OpenFile(bool skipDsp, uint retries,  
    11821182    }
    11831183
    11841184    player_ctx->buffer->Start();
    1185     char testbuf[kDecoderProbeBufferSize];
     1185    char *testbuf = new char[kDecoderProbeBufferSize];
    11861186    player_ctx->buffer->Unpause(); // so we can read testbuf if we were paused
    11871187
    11881188    // delete any pre-existing recorder
    int NuppelVideoPlayer::OpenFile(bool skipDsp, uint retries,  
    11961196            VERBOSE(VB_IMPORTANT,
    11971197                    QString("NVP::OpenFile(): Error, couldn't read file: %1")
    11981198                    .arg(player_ctx->buffer->GetFilename()));
    1199             return -1;
     1199            goto error;
    12001200        }
    12011201
    12021202        player_ctx->LockPlayingInfo(__FILE__, __LINE__);
    int NuppelVideoPlayer::OpenFile(bool skipDsp, uint retries,  
    12231223                QString("Couldn't find an A/V decoder for: '%1'")
    12241224                .arg(player_ctx->buffer->GetFilename()));
    12251225
    1226         return -1;
     1226        goto error;
    12271227    }
    12281228    else if (GetDecoder()->IsErrored())
    12291229    {
    12301230        VERBOSE(VB_IMPORTANT, LOC_ERR + "Could not initialize A/V decoder.");
    12311231        SetDecoder(NULL);
    1232         return -1;
     1232        goto error;
    12331233    }
    12341234
    12351235    GetDecoder()->setExactSeeks(exactseeks);
    int NuppelVideoPlayer::OpenFile(bool skipDsp, uint retries,  
    12411241    eof = false;
    12421242
    12431243    // Set 'no_video_decode' to true for audio only decodeing
    1244     bool no_video_decode = false;
     1244    // bool no_video_decode = false;
    12451245
    12461246    // We want to locate decoder for video even if using_null_videoout
    12471247    // is true, only disable if no_video_decode is true.
    12481248    int ret = GetDecoder()->OpenFile(
    1249         player_ctx->buffer, no_video_decode, testbuf, testreadsize);
     1249        player_ctx->buffer, false, testbuf, testreadsize);
    12501250
    12511251    if (ret < 0)
    12521252    {
    12531253        VERBOSE(VB_IMPORTANT, QString("Couldn't open decoder for: %1")
    12541254                .arg(player_ctx->buffer->GetFilename()));
    1255         return -1;
     1255        goto error;
    12561256    }
    12571257
    12581258    if (audio_bits == -1)
    int NuppelVideoPlayer::OpenFile(bool skipDsp, uint retries,  
    12761276
    12771277    bookmarkseek = GetBookmark();
    12781278
     1279    delete [] testbuf;
     1280
    12791281    return IsErrored() ? -1 : 0;
     1282
     1283error:
     1284
     1285    delete [] testbuf;
     1286    return -1;
    12801287}
    12811288
    12821289void NuppelVideoPlayer::SetVideoFilters(const QString &override)
  • mythtv/libs/libmythtv/decoderbase.h

    diff --git a/mythtv/libs/libmythtv/decoderbase.h b/mythtv/libs/libmythtv/decoderbase.h
    index 693066a..8748e75 100644
    a b class RingBuffer;  
    1717class TeletextViewer;
    1818class NuppelVideoPlayer;
    1919
    20 const int kDecoderProbeBufferSize = 128 * 1024;
     20const int kDecoderProbeBufferSize = 1024 * 1024;
    2121
    2222/// Track types
    2323typedef enum TrackTypes