static int do_for_all_streams(struct sip_msg* msg, str* str1,str * str2, regex_t* re, int op,int desc) { struct sdp_session_cell * cur_session; int rez; if (msg==NULL || msg==FAKED_REPLY) return -1; if(parse_sdp(msg)) { LM_DBG("Message has no SDP\n"); return -1; } if (get_codec_lumps(msg)<0) { LM_ERR("failed to prepare changes for codecs\n"); return -1; } cur_session = msg->sdp->sessions; rez = 0; while(cur_session) { struct sdp_stream_cell * cur_cell = cur_session->streams; while(cur_cell) { rez |= stream_process(msg,cur_cell,str1,str2,re,op,desc); cur_cell = cur_cell->next; } cur_session = cur_session->next; } if( rez <0 ) rez = 0; return rez; }
/** * @param urb URB structure * * @brief ISOC handler * * This function is called as an URB transfert is complete (Isochronous pipe). * So, the traitement is done in interrupt time, so it has be fast, not crash, * ans not stall. Neat. */ void usb_linect_isoc_handler(struct urb *urb) { int i; int ret; int awake = 0; int framestatus; int framelen; unsigned char *fill = NULL; unsigned char *iso_buf = NULL; struct usb_linect *dev; fnusb_isoc_stream *isoc_stream; struct linect_frame_buf *framebuf; int got_frame; //LNT_DEBUG("Isoc handler\n"); isoc_stream = (fnusb_isoc_stream *) urb->context; dev = isoc_stream->dev; if (dev == NULL) { LNT_ERROR("isoc_handler called with NULL device !\n"); return; } if (urb->status == -ENOENT || urb->status == -ECONNRESET) { LNT_DEBUG("URB unlinked synchronuously !\n"); return; } if (urb->status != -EINPROGRESS && urb->status != 0) { const char *errmsg; errmsg = "Unknown"; switch(urb->status) { case -ENOSR: errmsg = "Buffer error (overrun)"; break; case -EPIPE: errmsg = "Stalled (device not responding)"; break; case -EOVERFLOW: errmsg = "Babble (bad cable?)"; break; case -EPROTO: errmsg = "Bit-stuff error (bad cable?)"; break; case -EILSEQ: errmsg = "CRC/Timeout (could be anything)"; break; case -ETIMEDOUT: errmsg = "NAK (device does not respond)"; break; } LNT_ERROR("isoc_handler() called with status %d [%s].\n", urb->status, errmsg); dev->cam->visoc_errors++; if (isoc_stream->type == ISOC_RGB) wake_up_interruptible(&dev->cam->wait_rgb_frame); else wake_up_interruptible(&dev->cam->wait_depth_frame); urb->dev = dev->cam->udev; ret = usb_submit_urb(urb, GFP_ATOMIC); if (ret != 0) { LNT_ERROR("Error (%d) re-submitting urb in linect_isoc_handler.\n", ret); } return; } if (isoc_stream->type == ISOC_RGB) framebuf = dev->cam->fill_frame; else framebuf = dev->cam->fill_frame_depth; if (framebuf == NULL) { LNT_ERROR("isoc_handler without valid fill frame !\n"); if (isoc_stream->type == ISOC_RGB) wake_up_interruptible(&dev->cam->wait_rgb_frame); else wake_up_interruptible(&dev->cam->wait_depth_frame); urb->dev = dev->cam->udev; ret = usb_submit_urb(urb, GFP_ATOMIC); if (ret != 0) { LNT_ERROR("Error (%d) re-submitting urb in linect_isoc_handler.\n", ret); } return; } else { //fill = framebuf->data + framebuf->filled; fill = framebuf->data; } // Reset ISOC error counter dev->cam->visoc_errors = 0; // Compact data for (i=0; i<urb->number_of_packets; i++) { framestatus = urb->iso_frame_desc[i].status; framelen = urb->iso_frame_desc[i].actual_length; iso_buf = urb->transfer_buffer + urb->iso_frame_desc[i].offset; if (framestatus == 0) { if (isoc_stream->type == ISOC_RGB) { got_frame = stream_process(&dev->cam->rgb_stream, fill, iso_buf, framelen); if (got_frame) { // If there are errors, we skip a frame... if (linect_next_rgb_frame(dev)) dev->cam->vframes_dumped++; awake = 1; framebuf = dev->cam->fill_frame; framebuf->filled = 0; framebuf->errors = 0; fill = framebuf->data; } else { framebuf->filled += RGB_PKTDSIZE; } } else if (isoc_stream->type == ISOC_DEPTH) { // DEPTH got_frame = stream_process(&dev->cam->depth_stream, fill, iso_buf, framelen); if (got_frame) { // If there are errors, we skip a frame... if (linect_next_depth_frame(dev)) dev->cam->vframes_dumped++; awake = 1; framebuf = dev->cam->fill_frame_depth; framebuf->filled = 0; framebuf->errors = 0; fill = framebuf->data; } else { framebuf->filled += DEPTH_PKTDSIZE; } } } else { LNT_ERROR("Iso frame %d of USB has error %d\n", i, framestatus); } } if (awake == 1) { if (isoc_stream->type == ISOC_RGB) wake_up_interruptible(&dev->cam->wait_rgb_frame); else wake_up_interruptible(&dev->cam->wait_depth_frame); } urb->dev = dev->cam->udev; ret = usb_submit_urb(urb, GFP_ATOMIC); if (ret != 0) { LNT_ERROR("Error (%d) re-submitting urb in linect_isoc_handler.\n", ret); } }