mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2024-12-18 11:39:31 +01:00
Fix chromaprinter unref buffer crash
This commit is contained in:
parent
3c6c9741ff
commit
984abc89a8
@ -133,7 +133,6 @@ QString Chromaprinter::CreateFingerprint() {
|
||||
|
||||
// Wait until EOS or error
|
||||
GstMessage *msg = gst_bus_timed_pop_filtered(bus, kTimeoutSecs * GST_SECOND, static_cast<GstMessageType>(GST_MESSAGE_EOS | GST_MESSAGE_ERROR));
|
||||
|
||||
if (msg != nullptr) {
|
||||
if (msg->type == GST_MESSAGE_ERROR) {
|
||||
// Report error
|
||||
@ -220,12 +219,16 @@ GstFlowReturn Chromaprinter::NewBufferCallback(GstAppSink *app_sink, gpointer se
|
||||
Chromaprinter *me = reinterpret_cast<Chromaprinter*>(self);
|
||||
|
||||
GstSample *sample = gst_app_sink_pull_sample(app_sink);
|
||||
if (!sample) return GST_FLOW_ERROR;
|
||||
GstBuffer *buffer = gst_sample_get_buffer(sample);
|
||||
if (buffer) {
|
||||
GstMapInfo map;
|
||||
gst_buffer_map(buffer, &map, GST_MAP_READ);
|
||||
if (gst_buffer_map(buffer, &map, GST_MAP_READ)) {
|
||||
me->buffer_.write(reinterpret_cast<const char*>(map.data), map.size);
|
||||
gst_buffer_unmap(buffer, &map);
|
||||
gst_buffer_unref(buffer);
|
||||
}
|
||||
}
|
||||
gst_sample_unref(sample);
|
||||
|
||||
return GST_FLOW_OK;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user