Commit 5bc5e075 authored by Edward Hervey's avatar Edward Hervey Committed by Edward Hervey

dcaparse: Really fix "usage before unmap"

Previous patch would try to unref a buffer that was pushed downstream.

Instead only unref when/if needed and keep usage of the cleanup: goto
block
parent 5cf368b3
...@@ -446,6 +446,7 @@ gst_dca_parse_handle_frame (GstBaseParse * parse, ...@@ -446,6 +446,7 @@ gst_dca_parse_handle_frame (GstBaseParse * parse,
gst_base_parse_set_frame_rate (parse, rate, block_size, 0, 0); gst_base_parse_set_frame_rate (parse, rate, block_size, 0, 0);
} }
cleanup:
/* it is possible that DTS HD substream after DTS core */ /* it is possible that DTS HD substream after DTS core */
if (parse->flags & GST_BASE_PARSE_FLAG_DRAINING || map.size >= size + 9) { if (parse->flags & GST_BASE_PARSE_FLAG_DRAINING || map.size >= size + 9) {
extra_size = 0; extra_size = 0;
...@@ -469,17 +470,15 @@ gst_dca_parse_handle_frame (GstBaseParse * parse, ...@@ -469,17 +470,15 @@ gst_dca_parse_handle_frame (GstBaseParse * parse,
} }
} }
} }
gst_buffer_unmap (buf, &map);
if (ret == GST_FLOW_OK && size + extra_size <= map.size) { if (ret == GST_FLOW_OK && size + extra_size <= map.size) {
ret = gst_base_parse_finish_frame (parse, frame, size + extra_size); ret = gst_base_parse_finish_frame (parse, frame, size + extra_size);
} else { } else {
ret = GST_FLOW_OK; ret = GST_FLOW_OK;
} }
} else { } else {
ret = GST_FLOW_OK;
}
cleanup:
gst_buffer_unmap (buf, &map); gst_buffer_unmap (buf, &map);
}
return ret; return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment