rtpmparobustdepay: update available bytewriter space when repositioning

... and add some more assert to catch potential surprises early on.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=680558
This commit is contained in:
Mark Nauwelaerts 2012-08-06 12:34:55 +02:00
parent 7b5925b5a4
commit 31a1cb0a11

View file

@ -531,6 +531,7 @@ gst_rtp_mpa_robust_depay_push_mp3_frames (GstRtpMPARobustDepay * rtpmpadepay)
gst_byte_writer_set_pos (rtpmpadepay->mp3_frame, 0);
/* bytewriter corresponds to head frame,
* i.e. the header and the side info must match */
g_assert (4 + head->side_info <= head->size);
gst_buffer_map (head->buffer, &map, GST_MAP_READ);
gst_byte_writer_put_data_unchecked (rtpmpadepay->mp3_frame,
map.data, 4 + head->side_info);
@ -595,6 +596,8 @@ gst_rtp_mpa_robust_depay_push_mp3_frames (GstRtpMPARobustDepay * rtpmpadepay)
gst_buffer_map (buf, &map, GST_MAP_READ);
GST_LOG_OBJECT (rtpmpadepay, "adding to current MP3 frame");
gst_byte_writer_set_pos (rtpmpadepay->mp3_frame, tpos);
av -= (tpos - pos);
g_assert (map.size >= 4 + frame->side_info);
av = MIN (av, map.size - 4 - frame->side_info);
gst_byte_writer_put_data_unchecked (rtpmpadepay->mp3_frame,
map.data + 4 + frame->side_info, av);