libcamera: Fixed the crash issue when rtkit is enabled.

This commit is contained in:
raghu447 2020-06-11 19:34:21 +05:30
parent 2c70106728
commit 40ef322a34
4 changed files with 46 additions and 32 deletions

View file

@ -134,9 +134,11 @@ struct port {
struct impl {
struct spa_handle handle;
struct spa_node node;
bool have_source;
struct spa_log *log;
struct spa_loop *data_loop;
struct spa_system *system;
uint64_t info_all;
struct spa_node_info info;
@ -901,7 +903,10 @@ static int impl_clear(struct spa_handle *handle)
free(port->dev.camera);
port->dev.camera = NULL;
}
if(this->have_source) {
spa_system_close(this->system, port->source.fd);
this->have_source = false;
}
return 0;
}
@ -935,12 +940,18 @@ impl_init(const struct spa_handle_factory *factory,
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
this->data_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
this->system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_System);
if (this->data_loop == NULL) {
spa_log_error(this->log, "a data_loop is needed");
return -EINVAL;
}
if (this->system == NULL) {
spa_log_error(this->log, "a system is needed");
return -EINVAL;
}
this->node.iface = SPA_INTERFACE_INIT(
SPA_TYPE_INTERFACE_Node,
SPA_VERSION_NODE,