/* confirm submitted packet */ void fhci_transaction_confirm(struct fhci_usb *usb, struct packet *pkt) { struct td *td; struct packet *td_pkt; struct ed *ed; u32 trans_len; bool td_done = false; td = fhci_remove_td_from_frame(usb->actual_frame); td_pkt = td->pkt; trans_len = pkt->len; td->status = pkt->status; if (td->type == FHCI_TA_IN && td_pkt->info & PKT_DUMMY_PACKET) { if ((td->data + td->actual_len) && trans_len) memcpy(td->data + td->actual_len, pkt->data, trans_len); cq_put(usb->ep0->dummy_packets_Q, pkt->data); } recycle_frame(usb, pkt); ed = td->ed; if (ed->mode == FHCI_TF_ISO) { if (ed->td_list.next->next != &ed->td_list) { struct td *td_next = list_entry(ed->td_list.next->next, struct td, node); td_next->start_frame = usb->actual_frame->frame_num; } td->actual_len = trans_len; td_done = true; } else if ((td->status & USB_TD_ERROR) &&
void CallbackPipeline::do_capture(JNIEnv *env) { ENTER(); uvc_frame_t *frame; uvc_frame_t *temp = get_frame(default_frame_size); uvc_frame_t *callback_frame; uint32_t width = 0, height = 0; size_t sz = default_frame_size; if (LIKELY(temp)) { for (; isRunning() && isCapturing();) { frame = waitCaptureFrame(); if ((LIKELY(frame))) { if (UNLIKELY((width != frame->width) || (height != frame->height))) { width = frame->width; height = frame->height; callbackPixelFormatChanged(width, height); uvc_ensure_frame_size(temp, callbackPixelBytes); sz = callbackPixelBytes; } if (mFrameCallbackObj) { callback_frame = frame; sz = frame->actual_bytes; if (mFrameCallbackFunc) { callback_frame = temp; sz = callbackPixelBytes; int b = mFrameCallbackFunc(frame, temp); if (UNLIKELY(b)) { LOGW("failed to convert to callback frame"); goto SKIP; } } jobject buf = env->NewDirectByteBuffer(callback_frame->data, callbackPixelBytes); env->CallVoidMethod(mFrameCallbackObj, iframecallback_fields.onFrame, buf); env->ExceptionClear(); env->DeleteLocalRef(buf); } SKIP: recycle_frame(frame); } } recycle_frame(temp); } EXIT(); }
int ConvertPipeline::handle_frame(uvc_frame_t *frame) { ENTER(); Mutex::Autolock lock(pipeline_mutex); if (next_pipeline) { uvc_frame_t *copy = frame; if (mFrameConvFunc) { copy = get_frame(frame->actual_bytes); if (LIKELY(copy)) { const uvc_error_t r = mFrameConvFunc(frame, copy); if (UNLIKELY(r)) { LOGW("failed to convert:%d", r); recycle_frame(copy); copy = frame; } } } next_pipeline->queueFrame(copy); } RETURN(1, int); }