mpegts: fix handling of files smaller than 8kb
Fixes Ticket1094 Analyzed-by: mjs973 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
0db047cd0f
commit
04064e1c20
@ -1929,16 +1929,14 @@ static int mpegts_read_header(AVFormatContext *s)
|
|||||||
{
|
{
|
||||||
MpegTSContext *ts = s->priv_data;
|
MpegTSContext *ts = s->priv_data;
|
||||||
AVIOContext *pb = s->pb;
|
AVIOContext *pb = s->pb;
|
||||||
uint8_t buf[8*1024];
|
uint8_t buf[8*1024]={0};
|
||||||
int len;
|
int len;
|
||||||
int64_t pos;
|
int64_t pos;
|
||||||
|
|
||||||
/* read the first 8192 bytes to get packet size */
|
/* read the first 8192 bytes to get packet size */
|
||||||
pos = avio_tell(pb);
|
pos = avio_tell(pb);
|
||||||
len = avio_read(pb, buf, sizeof(buf));
|
len = avio_read(pb, buf, sizeof(buf));
|
||||||
if (len != sizeof(buf))
|
ts->raw_packet_size = get_packet_size(buf, len);
|
||||||
goto fail;
|
|
||||||
ts->raw_packet_size = get_packet_size(buf, sizeof(buf));
|
|
||||||
if (ts->raw_packet_size <= 0) {
|
if (ts->raw_packet_size <= 0) {
|
||||||
av_log(s, AV_LOG_WARNING, "Could not detect TS packet size, defaulting to non-FEC/DVHS\n");
|
av_log(s, AV_LOG_WARNING, "Could not detect TS packet size, defaulting to non-FEC/DVHS\n");
|
||||||
ts->raw_packet_size = TS_PACKET_SIZE;
|
ts->raw_packet_size = TS_PACKET_SIZE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user