summaryrefslogtreecommitdiffstats
path: root/demux/demux_tv.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-09-16 18:11:00 +0200
committerwm4 <wm4@nowhere>2014-09-16 18:11:00 +0200
commitcaaeb15318dbdd38344f15a8919540f188de5c46 (patch)
treee0416e67067fcbb4485d96deaacd7dd55f55a51e /demux/demux_tv.c
parent26e0cce9699e672b3d56c3b184a662955c4815bc (diff)
downloadmpv-caaeb15318dbdd38344f15a8919540f188de5c46.tar.bz2
mpv-caaeb15318dbdd38344f15a8919540f188de5c46.tar.xz
demux: gracefully handle packet allocation failures
Now the packet allocation functions can fail.
Diffstat (limited to 'demux/demux_tv.c')
-rw-r--r--demux/demux_tv.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/demux/demux_tv.c b/demux/demux_tv.c
index f0ee9793e3..fe7584a387 100644
--- a/demux/demux_tv.c
+++ b/demux/demux_tv.c
@@ -204,26 +204,30 @@ static int demux_tv_fill_buffer(demuxer_t *demux)
if (want_audio && tvh->tv_param->audio &&
tvh->functions->control(tvh->priv,
TVI_CONTROL_IS_AUDIO, 0) == TVI_CONTROL_TRUE)
- {
+ {
len = tvh->functions->get_audio_framesize(tvh->priv);
dp=new_demux_packet(len);
- dp->keyframe = true;
- dp->pts=tvh->functions->grab_audio_frame(tvh->priv, dp->buffer,len);
- demux_add_packet(want_audio, dp);
+ if (dp) {
+ dp->keyframe = true;
+ dp->pts=tvh->functions->grab_audio_frame(tvh->priv, dp->buffer,len);
+ demux_add_packet(want_audio, dp);
}
+ }
/* ================== ADD VIDEO PACKET =================== */
if (want_video && tvh->functions->control(tvh->priv,
TVI_CONTROL_IS_VIDEO, 0) == TVI_CONTROL_TRUE)
- {
- len = tvh->functions->get_video_framesize(tvh->priv);
+ {
+ len = tvh->functions->get_video_framesize(tvh->priv);
dp=new_demux_packet(len);
- dp->keyframe = true;
- dp->pts=tvh->functions->grab_video_frame(tvh->priv, dp->buffer, len);
- demux_add_packet(want_video, dp);
- }
+ if (dp) {
+ dp->keyframe = true;
+ dp->pts=tvh->functions->grab_video_frame(tvh->priv, dp->buffer, len);
+ demux_add_packet(want_video, dp);
+ }
+ }
if (tvh->tv_param->scan) tv_scan(tvh);
return 1;