mpegtsdemux: Fix for compiling without GST_DEBUG

Protect debug-only variables/usage, and in one case remove a useless
variable.
This commit is contained in:
Edward Hervey 2013-06-05 15:51:58 +02:00
parent e66d543f00
commit 79e63e3daf
3 changed files with 17 additions and 2 deletions

View file

@ -37,14 +37,20 @@ GST_DEBUG_CATEGORY (gstmpegtsdesc_debug);
static guint static guint
gst_mpeg_descriptor_parse_1 (guint8 * data, guint size) gst_mpeg_descriptor_parse_1 (guint8 * data, guint size)
{ {
#ifndef GST_DISABLE_GST_DEBUG
guint8 tag; guint8 tag;
#endif
guint8 length; guint8 length;
/* need at least 2 bytes for tag and length */ /* need at least 2 bytes for tag and length */
if (size < 2) if (size < 2)
return 0; return 0;
#ifndef GST_DISABLE_GST_DEBUG
tag = *data++; tag = *data++;
#else
data++;
#endif
length = *data++; length = *data++;
size -= 2; size -= 2;

View file

@ -2741,7 +2741,9 @@ mpegts_packetizer_push_section (MpegTSPacketizer2 * packetizer,
gboolean res = FALSE; gboolean res = FALSE;
MpegTSPacketizerStream *stream; MpegTSPacketizerStream *stream;
guint8 pointer, table_id; guint8 pointer, table_id;
#ifndef GST_DISABLE_GST_DEBUG
guint16 subtable_extension; guint16 subtable_extension;
#endif
guint section_length; guint section_length;
guint8 *data, *data_start; guint8 *data, *data_start;
@ -2793,6 +2795,7 @@ mpegts_packetizer_push_section (MpegTSPacketizer2 * packetizer,
if (packet->payload_unit_start_indicator) { if (packet->payload_unit_start_indicator) {
table_id = *data++; table_id = *data++;
#ifndef GST_DISABLE_GST_DEBUG
/* subtable_extension should be read from 4th and 5th bytes only if /* subtable_extension should be read from 4th and 5th bytes only if
* section_syntax_indicator is 1 */ * section_syntax_indicator is 1 */
if ((data[0] & 0x80) == 0) if ((data[0] & 0x80) == 0)
@ -2801,6 +2804,7 @@ mpegts_packetizer_push_section (MpegTSPacketizer2 * packetizer,
subtable_extension = GST_READ_UINT16_BE (data + 2); subtable_extension = GST_READ_UINT16_BE (data + 2);
GST_DEBUG ("pid: 0x%04x table_id 0x%02x sub_table_extension %d", GST_DEBUG ("pid: 0x%04x table_id 0x%02x sub_table_extension %d",
packet->pid, table_id, subtable_extension); packet->pid, table_id, subtable_extension);
#endif
section_length = (GST_READ_UINT16_BE (data) & 0x0FFF) + 3; section_length = (GST_READ_UINT16_BE (data) & 0x0FFF) + 3;
@ -3385,7 +3389,9 @@ calculate_skew (MpegTSPCR * pcr, guint64 pcrtime, GstClockTime time)
gint64 old; gint64 old;
gint pos, i; gint pos, i;
GstClockTime gstpcrtime, out_time; GstClockTime gstpcrtime, out_time;
#ifndef GST_DISABLE_GST_DEBUG
guint64 slope; guint64 slope;
#endif
gstpcrtime = PCRTIME_TO_GSTTIME (pcrtime) + pcr->pcroffset; gstpcrtime = PCRTIME_TO_GSTTIME (pcrtime) + pcr->pcroffset;
@ -3474,10 +3480,12 @@ calculate_skew (MpegTSPCR * pcr, guint64 pcrtime, GstClockTime time)
/* measure the diff */ /* measure the diff */
delta = ((gint64) recv_diff) - ((gint64) send_diff); delta = ((gint64) recv_diff) - ((gint64) send_diff);
#ifndef GST_DISABLE_GST_DEBUG
/* measure the slope, this gives a rought estimate between the sender speed /* measure the slope, this gives a rought estimate between the sender speed
* and the receiver speed. This should be approximately 8, higher values * and the receiver speed. This should be approximately 8, higher values
* indicate a burst (especially when the connection starts) */ * indicate a burst (especially when the connection starts) */
slope = recv_diff > 0 ? (send_diff * 8) / recv_diff : 8; slope = recv_diff > 0 ? (send_diff * 8) / recv_diff : 8;
#endif
GST_DEBUG ("time %" GST_TIME_FORMAT ", base %" GST_TIME_FORMAT ", recv_diff %" GST_DEBUG ("time %" GST_TIME_FORMAT ", base %" GST_TIME_FORMAT ", recv_diff %"
GST_TIME_FORMAT ", slope %" G_GUINT64_FORMAT, GST_TIME_ARGS (time), GST_TIME_FORMAT ", slope %" G_GUINT64_FORMAT, GST_TIME_ARGS (time),

View file

@ -1228,7 +1228,6 @@ static void
gst_ts_demux_parse_pes_header (GstTSDemux * demux, TSDemuxStream * stream, gst_ts_demux_parse_pes_header (GstTSDemux * demux, TSDemuxStream * stream,
guint8 * data, guint32 length, guint64 bufferoffset) guint8 * data, guint32 length, guint64 bufferoffset)
{ {
MpegTSBase *base = (MpegTSBase *) demux;
PESHeader header; PESHeader header;
gint offset = 0; gint offset = 0;
PESParsingResult parseres; PESParsingResult parseres;
@ -1247,7 +1246,7 @@ gst_ts_demux_parse_pes_header (GstTSDemux * demux, TSDemuxStream * stream,
gst_ts_demux_record_dts (demux, stream, header.DTS, bufferoffset); gst_ts_demux_record_dts (demux, stream, header.DTS, bufferoffset);
gst_ts_demux_record_pts (demux, stream, header.PTS, bufferoffset); gst_ts_demux_record_pts (demux, stream, header.PTS, bufferoffset);
GST_DEBUG_OBJECT (base, GST_DEBUG_OBJECT (demux,
"stream PTS %" GST_TIME_FORMAT " DTS %" GST_TIME_FORMAT, "stream PTS %" GST_TIME_FORMAT " DTS %" GST_TIME_FORMAT,
GST_TIME_ARGS (stream->pts), GST_TIME_ARGS (stream->dts)); GST_TIME_ARGS (stream->pts), GST_TIME_ARGS (stream->dts));
@ -1472,7 +1471,9 @@ static GstFlowReturn
gst_ts_demux_push_pending_data (GstTSDemux * demux, TSDemuxStream * stream) gst_ts_demux_push_pending_data (GstTSDemux * demux, TSDemuxStream * stream)
{ {
GstFlowReturn res = GST_FLOW_OK; GstFlowReturn res = GST_FLOW_OK;
#ifndef GST_DISABLE_GST_DEBUG
MpegTSBaseStream *bs = (MpegTSBaseStream *) stream; MpegTSBaseStream *bs = (MpegTSBaseStream *) stream;
#endif
GstBuffer *buffer = NULL; GstBuffer *buffer = NULL;
GST_DEBUG_OBJECT (stream->pad, GST_DEBUG_OBJECT (stream->pad,