Re: Audio I/O parameters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 25 Jul 2013, James Stone wrote:

> On Thu, Jul 25, 2013 at 7:26 PM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> > On Thu, 25 Jul 2013, James Stone wrote:
> >
> >> > Please try the patch from here:
> >> >
> >> >         http://marc.info/?l=linux-usb&m=137476385206265&w=2
> >> >
> >> > instead of the one I sent to you yesterday.  I think it will fix this
> >> > problem.
> >> >
> >> > Alan Stern
> >> >
> >>
> >> Perfect! All fixed!
> >
> > Can you provide a usbmon trace showing the start of a session using the
> > new patch?
> >
> > Alan Stern
> >
> 
> Sure - will send off list. The only slight difference I can see is
> that maybe the 3.10 uses slightly higher CPU load than 3.5 at the
> ridiculously low latency of 64 frames/period duplex.

With the new patch, what you actually get is 44.1 frames/period (on
average).  That's quite sustainable.

However, something's not working right.  The number of packets in each
playback URB changes each time the URB is reused!  That's not supposed
to happen.  The number of packets should remain fixed while the number
of samples in each packet changes, based on the feedback info.

I don't get it.  The usbmon trace shows three URBs, and the number of 
packets goes like this:

	8 8 8   8 4 8   4 8 3   8 4 8   4 8 3   8 4 8   3 8 4   8 4 8
	etc...

I'm at a complete loss.  It's not caused by confusion on the feedback
endpoint; in fact the driver doesn't change this number anywhere once
it has been set up.  What's going on?

James, please apply the diagnostic patch below on top of everything 
else.  It will write entries into the kernel log which hopefully will 
pin down where this number gets changed.

Another problem, not necessarily a bad one: The feedback data from the 
sound device indicates that its internal clock is actually running at 
45168 Hz, even though it claims to be running at 44100.

Alan Stern



Index: usb-3.10/sound/usb/endpoint.c
===================================================================
--- usb-3.10.orig/sound/usb/endpoint.c
+++ usb-3.10/sound/usb/endpoint.c
@@ -33,6 +33,8 @@
 #include "pcm.h"
 #include "quirks.h"
 
+static int alancnt = -1;
+
 #define EP_FLAG_ACTIVATED	0
 #define EP_FLAG_RUNNING		1
 #define EP_FLAG_STOPPING	2
@@ -358,10 +360,16 @@ static void snd_complete_urb(struct urb
 		goto exit_clear;
 
 	if (usb_pipeout(ep->pipe)) {
+		if (alancnt > 0)
+			printk(KERN_INFO "B urb %p cnt %d\n",
+					urb, urb->number_of_packets);
 		retire_outbound_urb(ep, ctx);
 		/* can be stopped during retire callback */
 		if (unlikely(!test_bit(EP_FLAG_RUNNING, &ep->flags)))
 			goto exit_clear;
+		if (alancnt > 0)
+			printk(KERN_INFO "C urb %p cnt %d\n",
+					urb, urb->number_of_packets);
 
 		if (snd_usb_endpoint_implicit_feedback_sink(ep)) {
 			unsigned long flags;
@@ -375,6 +383,13 @@ static void snd_complete_urb(struct urb
 		}
 
 		prepare_outbound_urb(ep, ctx);
+		if (urb->number_of_packets != 8 && alancnt < 0)
+			alancnt = 20;
+		if (alancnt > 0) {
+			printk(KERN_INFO "A urb %p cnt %d\n",
+					urb, urb->number_of_packets);
+			--alancnt;
+		}
 	} else {
 		retire_inbound_urb(ep, ctx);
 		/* can be stopped during retire callback */

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux