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,
|
1182 | 1182 | } |
1183 | 1183 | |
1184 | 1184 | player_ctx->buffer->Start(); |
1185 | | char testbuf[kDecoderProbeBufferSize]; |
| 1185 | char *testbuf = new char[kDecoderProbeBufferSize]; |
1186 | 1186 | player_ctx->buffer->Unpause(); // so we can read testbuf if we were paused |
1187 | 1187 | |
1188 | 1188 | // delete any pre-existing recorder |
… |
… |
int NuppelVideoPlayer::OpenFile(bool skipDsp, uint retries,
|
1196 | 1196 | VERBOSE(VB_IMPORTANT, |
1197 | 1197 | QString("NVP::OpenFile(): Error, couldn't read file: %1") |
1198 | 1198 | .arg(player_ctx->buffer->GetFilename())); |
1199 | | return -1; |
| 1199 | goto error; |
1200 | 1200 | } |
1201 | 1201 | |
1202 | 1202 | player_ctx->LockPlayingInfo(__FILE__, __LINE__); |
… |
… |
int NuppelVideoPlayer::OpenFile(bool skipDsp, uint retries,
|
1223 | 1223 | QString("Couldn't find an A/V decoder for: '%1'") |
1224 | 1224 | .arg(player_ctx->buffer->GetFilename())); |
1225 | 1225 | |
1226 | | return -1; |
| 1226 | goto error; |
1227 | 1227 | } |
1228 | 1228 | else if (GetDecoder()->IsErrored()) |
1229 | 1229 | { |
1230 | 1230 | VERBOSE(VB_IMPORTANT, LOC_ERR + "Could not initialize A/V decoder."); |
1231 | 1231 | SetDecoder(NULL); |
1232 | | return -1; |
| 1232 | goto error; |
1233 | 1233 | } |
1234 | 1234 | |
1235 | 1235 | GetDecoder()->setExactSeeks(exactseeks); |
… |
… |
int NuppelVideoPlayer::OpenFile(bool skipDsp, uint retries,
|
1241 | 1241 | eof = false; |
1242 | 1242 | |
1243 | 1243 | // Set 'no_video_decode' to true for audio only decodeing |
1244 | | bool no_video_decode = false; |
| 1244 | // bool no_video_decode = false; |
1245 | 1245 | |
1246 | 1246 | // We want to locate decoder for video even if using_null_videoout |
1247 | 1247 | // is true, only disable if no_video_decode is true. |
1248 | 1248 | int ret = GetDecoder()->OpenFile( |
1249 | | player_ctx->buffer, no_video_decode, testbuf, testreadsize); |
| 1249 | player_ctx->buffer, false, testbuf, testreadsize); |
1250 | 1250 | |
1251 | 1251 | if (ret < 0) |
1252 | 1252 | { |
1253 | 1253 | VERBOSE(VB_IMPORTANT, QString("Couldn't open decoder for: %1") |
1254 | 1254 | .arg(player_ctx->buffer->GetFilename())); |
1255 | | return -1; |
| 1255 | goto error; |
1256 | 1256 | } |
1257 | 1257 | |
1258 | 1258 | if (audio_bits == -1) |
… |
… |
int NuppelVideoPlayer::OpenFile(bool skipDsp, uint retries,
|
1276 | 1276 | |
1277 | 1277 | bookmarkseek = GetBookmark(); |
1278 | 1278 | |
| 1279 | delete [] testbuf; |
| 1280 | |
1279 | 1281 | return IsErrored() ? -1 : 0; |
| 1282 | |
| 1283 | error: |
| 1284 | |
| 1285 | delete [] testbuf; |
| 1286 | return -1; |
1280 | 1287 | } |
1281 | 1288 | |
1282 | 1289 | void NuppelVideoPlayer::SetVideoFilters(const QString &override) |
diff --git a/mythtv/libs/libmythtv/decoderbase.h b/mythtv/libs/libmythtv/decoderbase.h
index 693066a..8748e75 100644
a
|
b
|
class RingBuffer;
|
17 | 17 | class TeletextViewer; |
18 | 18 | class NuppelVideoPlayer; |
19 | 19 | |
20 | | const int kDecoderProbeBufferSize = 128 * 1024; |
| 20 | const int kDecoderProbeBufferSize = 1024 * 1024; |
21 | 21 | |
22 | 22 | /// Track types |
23 | 23 | typedef enum TrackTypes |