Mercurial > mplayer.hg
changeset 33909:50489783444d
Simply drop packets for which new_demux_packet allocation fails.
This allows to play some corrupted files instead of crashing.
author | reimar |
---|---|
date | Thu, 18 Aug 2011 18:32:53 +0000 |
parents | 02f1dc5c8bda |
children | 645a13a163a6 |
files | libmpdemux/demuxer.c |
diffstat | 1 files changed, 3 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/demuxer.c Mon Aug 15 21:28:19 2011 +0000 +++ b/libmpdemux/demuxer.c Thu Aug 18 18:32:53 2011 +0000 @@ -593,6 +593,7 @@ ds_add_packet_internal(ds, dp); } else if (parsed_len) { demux_packet_t *dp2 = new_demux_packet(parsed_len); + if (!dp2) return; dp2->pos = dp->pos; dp2->pts = dp->pts; // should be parser->pts but that works badly memcpy(dp2->buffer, parsed_start, parsed_len); @@ -608,6 +609,7 @@ double pts, off_t pos, int flags) { demux_packet_t *dp = new_demux_packet(len); + if (!dp) return; len = stream_read(stream, dp->buffer, len); resize_demux_packet(dp, len); dp->pts = pts; @@ -713,6 +715,7 @@ ds_parse(ds->sh, &parsed_start, &parsed_len, MP_NOPTS_VALUE, 0); if (parsed_len) { demux_packet_t *dp2 = new_demux_packet(parsed_len); + if (!dp2) continue; dp2->pts = MP_NOPTS_VALUE; memcpy(dp2->buffer, parsed_start, parsed_len); ds_add_packet_internal(ds, dp2);