From 2251fff1db1a36445167a409599e5a3a2c6554c4 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 30 Dec 2015 21:41:05 +0100 Subject: [PATCH] MPEG TS: re-factor to simplify control flow & "send to packetizer" logic --- src/input/r_mpeg_ts.cpp | 11 +---------- src/input/r_mpeg_ts.h | 1 - 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/src/input/r_mpeg_ts.cpp b/src/input/r_mpeg_ts.cpp index 2dfc5b13b..3a854f789 100644 --- a/src/input/r_mpeg_ts.cpp +++ b/src/input/r_mpeg_ts.cpp @@ -643,7 +643,6 @@ mpeg_ts_reader_c::mpeg_ts_reader_c(const track_info_c &ti, , m_global_timecode_offset{} , m_stream_timecode{timestamp_c::ns(0)} , m_probing{true} - , track_buffer_ready(-1) , file_done{} , m_packet_sent_to_packetizer{} , m_dont_use_audio_pts{ "mpeg_ts|mpeg_ts_dont_use_audio_pts"} @@ -1239,8 +1238,7 @@ mpeg_ts_reader_c::parse_packet(unsigned char *buf) { probe_packet_complete(track); else - // PES completed, set track to quicly send it to the rightpacketizer - track_buffer_ready = tidx; + track->send_to_packetizer(); return true; } @@ -1611,8 +1609,6 @@ mpeg_ts_reader_c::read(generic_packetizer_c *requested_ptzr, unsigned char buf[TS_MAX_PACKET_SIZE + 1]; - track_buffer_ready = -1; - if (file_done) return flush_packetizers(); @@ -1628,11 +1624,6 @@ mpeg_ts_reader_c::read(generic_packetizer_c *requested_ptzr, parse_packet(buf); - if (track_buffer_ready != -1) { // ES buffer ready - tracks[track_buffer_ready]->send_to_packetizer(); - track_buffer_ready = -1; - } - if (m_packet_sent_to_packetizer) return FILE_STATUS_MOREDATA; } diff --git a/src/input/r_mpeg_ts.h b/src/input/r_mpeg_ts.h index 0ac3f204c..1c1ec5365 100644 --- a/src/input/r_mpeg_ts.h +++ b/src/input/r_mpeg_ts.h @@ -396,7 +396,6 @@ protected: timestamp_c m_global_timecode_offset, m_stream_timecode; bool m_probing; - int track_buffer_ready; bool file_done, m_packet_sent_to_packetizer;