mpegtsmux: Trivial bug fix. Don't copy data from an uninited buffer.

This commit is contained in:
Jan Schmidt 2012-02-13 23:04:12 +11:00
parent 1cbd755a2c
commit debf4984df

View file

@ -1087,11 +1087,11 @@ new_packet_m2ts (MpegTsMux * mux, guint8 * data, guint len, gint64 new_pcr)
return FALSE;
}
new_packet_common_init (mux, buf, data, len);
/* copies the TS data of 188 bytes to the m2ts buffer at an offset
of 4 bytes to leave space for writing the timestamp later */
memcpy (GST_BUFFER_DATA (buf) + 4, data, len);
/* After copying the data into the buffer, do other common init (flags and streamheaders) */
new_packet_common_init (mux, buf, data, len);
if (new_pcr < 0) {
/* If theres no pcr in current ts packet then just add the packet
@ -1198,9 +1198,10 @@ new_packet_normal_ts (MpegTsMux * mux, guint8 * data, guint len, gint64 new_pcr)
return FALSE;
}
memcpy (GST_BUFFER_DATA (buf), data, len);
/* After copying the data into the buffer, do other common init (flags and streamheaders) */
new_packet_common_init (mux, buf, data, len);
memcpy (GST_BUFFER_DATA (buf), data, len);
GST_BUFFER_TIMESTAMP (buf) = mux->last_ts;
ret = gst_pad_push (mux->srcpad, buf);