Skip to content

Commit

Permalink
Fix hang issue when stopping stream
Browse files Browse the repository at this point in the history
  • Loading branch information
cozycactus committed Jul 19, 2024
1 parent 50d2937 commit 73a9690
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions Core/arch/linux/streaming.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,17 +268,6 @@ int streaming_stop(streaming_t *this)
}

this->status = STREAMING_STATUS_CANCELLED;
/* cancel all the active transfers */
for (uint32_t i = 0; i < this->num_frames; ++i) {
int ret = libusb_cancel_transfer(this->transfers[i]);
if (ret < 0) {
if (ret == LIBUSB_ERROR_NOT_FOUND) {
continue;
}
log_usb_error(ret, __func__, __FILE__, __LINE__);
this->status = STREAMING_STATUS_FAILED;
}
}

/* flush all the events */
struct timeval noblock = { 0, 0 };
Expand All @@ -291,6 +280,19 @@ int streaming_stop(streaming_t *this)
usleep(100);
}

/* cancel all the active transfers */
for (uint32_t i = 0; i < this->num_frames; ++i) {
int ret = libusb_cancel_transfer(this->transfers[i]);
if (ret < 0) {
if (ret == LIBUSB_ERROR_NOT_FOUND) {
continue;
}
log_usb_error(ret, __func__, __FILE__, __LINE__);
this->status = STREAMING_STATUS_FAILED;
}
}


return 0;
}

Expand Down

0 comments on commit 73a9690

Please sign in to comment.