diff options
author | van <[email protected]> | 2008-03-02 09:18:19 +0000 |
---|---|---|
committer | van <[email protected]> | 2008-03-02 09:18:19 +0000 |
commit | 3c6320cb60b635e2dd2d14862f3a784d38237f4b (patch) | |
tree | 4a48388d8ced6a1cc8c06571605977e68cd2868a /libhb | |
parent | 51a12d1cd4a2198b3d8e5ae0b339ed901522e5a3 (diff) |
DVB teletext streams and ATSC AC3 audio streams use the same code points. If we misclassify teletext as audio we'll die early in the encode while trying to find an AC3 sync frame. So, if we don't find a sync frame after searching a megabyte of the stream decide it's not AC3, delete the audio entry & keep going.
Problem & test case from ncbp http://forum.handbrake.fr/viewtopic.php?p=29137#p29137.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1325 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rwxr-xr-x | libhb/stream.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/libhb/stream.c b/libhb/stream.c index ed91f48e3..5cc1be190 100755 --- a/libhb/stream.c +++ b/libhb/stream.c @@ -2197,13 +2197,30 @@ static void hb_ts_stream_decode(hb_stream_t *stream) if (!stream->ts_skipbad[curstream] && stream->ts_foundfirst[curstream] && (184 - adapt_len) > 0) { - // XXX this shouldn't happen but we'll be paranoid if (stream->ts_packetpos[curstream] + 184 - adapt_len > 1024*1024) { - hb_log("hb_ts_stream_decode: ts_packetbuf overflow, pos = %d ," - "len = %d", stream->ts_packetpos[curstream], - 184 - adapt_len ); - return; + int aindx = curstream - stream->ts_number_video_pids; + if ( aindx >= 0 && stream->ts_audio_stream_type[aindx] == 0x81) + { + /* we've searched through a megabyte & didn't find an AC3 + * sync frame so this probably isn't AC3. (DVB standard + * teletext uses the same code points as ATSC AC3 so we + * could easily have guessed wrong.) Delete this pid from + * the audio list so we don't waste any more time on it. */ + hb_log("hb_ts_stream_decode: removing pid 0x%x - " + "it isn't an AC3 stream.", stream->ts_audio_pids[aindx]); + hb_stream_delete_audio_entry( stream, aindx ); + } + else + { + hb_log("hb_ts_stream_decode: pid 0x%x ts_packetbuf overflow " + "pos %d len = %d", + aindx < 0 ? stream->ts_video_pids[curstream] : + stream->ts_audio_pids[aindx], + stream->ts_packetpos[curstream], 184 - adapt_len ); + } + stream->ts_packetpos[curstream] = 0; + continue; } memcpy(stream->ts_packetbuf[curstream] + stream->ts_packetpos[curstream], buf + 4 + adapt_len, 184 - adapt_len); stream->ts_packetpos[curstream] += 184 - adapt_len; |