From 38dd5deb66f9aa94ad7081a4d5b9f88ceff8a5f5 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Tue, 4 Apr 2023 16:41:39 +0200 Subject: [PATCH] tsdemux: Minor refactoring Part-of: --- .../gst-plugins-bad/gst/mpegtsdemux/tsdemux.c | 37 +++++-------------- 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c b/subprojects/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c index 8a7b2082d9..ab6ad09c76 100644 --- a/subprojects/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c +++ b/subprojects/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c @@ -3446,27 +3446,20 @@ gst_ts_demux_push_pending_data (GstTSDemux * demux, TSDemuxStream * stream, if (bs->stream_type == GST_MPEGTS_STREAM_TYPE_PRIVATE_PES_PACKETS && bs->registration_id == DRF_ID_OPUS) { buffer_list = parse_opus_access_unit (stream); - if (!buffer_list) { - res = GST_FLOW_ERROR; - goto beach; - } } else if (bs->stream_type == GST_MPEGTS_STREAM_TYPE_VIDEO_JP2K) { buffer = parse_jp2k_access_unit (stream); - if (!buffer) { - res = GST_FLOW_ERROR; - goto beach; - } } else if (bs->stream_type == GST_MPEGTS_STREAM_TYPE_METADATA_PES_PACKETS && bs->registration_id == DRF_ID_KLVA) { buffer_list = parse_pes_metadata_frame (stream); - if (!buffer_list) { - res = GST_FLOW_ERROR; - goto beach; - } } else { buffer = gst_buffer_new_wrapped (stream->data, stream->current_size); } + if (buffer == NULL && buffer_list == NULL) { + res = GST_FLOW_ERROR; + goto beach; + } + stream->seeked_pts = stream->pts; stream->seeked_dts = stream->dts; stream->needs_keyframe = FALSE; @@ -3501,32 +3494,20 @@ gst_ts_demux_push_pending_data (GstTSDemux * demux, TSDemuxStream * stream, if (bs->stream_type == GST_MPEGTS_STREAM_TYPE_PRIVATE_PES_PACKETS && bs->registration_id == DRF_ID_OPUS) { buffer_list = parse_opus_access_unit (stream); - if (!buffer_list) { - res = GST_FLOW_ERROR; - goto beach; - } } else if (bs->stream_type == GST_MPEGTS_STREAM_TYPE_VIDEO_JP2K) { buffer = parse_jp2k_access_unit (stream); - if (!buffer) { - res = GST_FLOW_ERROR; - goto beach; - } } else if (bs->stream_type == GST_MPEGTS_STREAM_TYPE_AUDIO_AAC_ADTS) { buffer = parse_aac_adts_frame (stream); - if (!buffer) { - res = GST_FLOW_ERROR; - goto beach; - } } else if (bs->stream_type == GST_MPEGTS_STREAM_TYPE_METADATA_PES_PACKETS && bs->registration_id == DRF_ID_KLVA) { buffer_list = parse_pes_metadata_frame (stream); - if (!buffer_list) { - res = GST_FLOW_ERROR; - goto beach; - } } else { buffer = gst_buffer_new_wrapped (stream->data, stream->current_size); } + if (buffer == NULL && buffer_list == NULL) { + res = GST_FLOW_ERROR; + goto beach; + } if (G_UNLIKELY (stream->pending_ts && !check_pending_buffers (demux))) { if (buffer) {