audio: don't deref NULL

gst_buffer_copy_region() can return NULL when the buffer meta-data is invalid.

See https://bugzilla.gnome.org/show_bug.cgi?id=772200
This commit is contained in:
Stefan Sauer 2016-10-14 14:23:38 +02:00
parent a32b25db6a
commit 7986a8ed3d

View file

@ -224,14 +224,18 @@ gst_audio_buffer_clip (GstBuffer * buffer, const GstSegment * segment,
gst_buffer_unref (buffer);
GST_DEBUG ("timestamp %" GST_TIME_FORMAT, GST_TIME_ARGS (timestamp));
GST_BUFFER_TIMESTAMP (ret) = timestamp;
if (ret) {
GST_BUFFER_TIMESTAMP (ret) = timestamp;
if (change_duration)
GST_BUFFER_DURATION (ret) = duration;
if (change_offset)
GST_BUFFER_OFFSET (ret) = offset;
if (change_offset_end)
GST_BUFFER_OFFSET_END (ret) = offset_end;
if (change_duration)
GST_BUFFER_DURATION (ret) = duration;
if (change_offset)
GST_BUFFER_OFFSET (ret) = offset;
if (change_offset_end)
GST_BUFFER_OFFSET_END (ret) = offset_end;
} else {
GST_ERROR ("copy_region failed");
}
}
return ret;
}