GNOME Bugzilla – Bug 665003
[0.11] GstAudioEncoder shouldn't keep adapter mapped while calling handle_frame
Last modified: 2012-01-14 20:00:23 UTC
Created attachment 202269 [details] [review] patch handle_frame implementation can call gst_audio_encoder_finish_frame, which potentially clears the adapter making gst_adapter_unmap cause crash. void gst_adapter_unmap (GstAdapter * adapter) { g_return_if_fail (GST_IS_ADAPTER (adapter)); if (adapter->priv->cdata) { GstBuffer *cur = adapter->buflist->data; ^^^^^ - crashes because priv->cdata is not null on mapped buffer while adapter->buflist is null - cleared in gst_audio_encoder_finish frame which was called from handle_frame gst_buffer_unmap (cur, adapter->priv->cdata, adapter->priv->csize); adapter->priv->cdata = NULL; } }
See https://bugzilla.gnome.org/show_bug.cgi?id=664133 for another solution. If this is applied, 664133 should be closed.
FWIW, the suggested fix here introduces another copy, which is a bit sub-optimal. Even if that is not particular cared about, tend to favour fixing adapter probably to deal with such situation anyway even if the audiocodec classes would not do so. That would also somewhat maintain 0.10 semantics where it was possible to do a _peek, and then a _flush which would invalidate the obtained pointer anyway, and same would then be with a _map followed by _flush (and _unmap, all fixed to handle this sequence preferably/obviously).
Has the adapter been fixed? Is this bug still relevant?
Adapter has been fixed in bug #644133, and IMO that renders this obsolete.
Obsolete due #664133