提交 1149a64f 编写于 作者: C Clemens Ladisch 提交者: Jaroslav Kysela

[ALSA] usb-audio - use proper interval between synchronization packets

USB generic driver
Add sanity checks when reading the bRefresh value, and actually use it
for the synchronization packets instead of polling at 1000 Hz.
Signed-off-by: NClemens Ladisch <clemens@ladisch.de>
上级 4dc40a3c
...@@ -1051,10 +1051,7 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by ...@@ -1051,10 +1051,7 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by
u->urb->pipe = subs->syncpipe; u->urb->pipe = subs->syncpipe;
u->urb->transfer_flags = URB_ISO_ASAP; u->urb->transfer_flags = URB_ISO_ASAP;
u->urb->number_of_packets = u->packets; u->urb->number_of_packets = u->packets;
if (snd_usb_get_speed(subs->dev) == USB_SPEED_HIGH) u->urb->interval = 1 << subs->syncinterval;
u->urb->interval = 8;
else
u->urb->interval = 1;
u->urb->context = u; u->urb->context = u;
u->urb->complete = snd_usb_complete_callback(snd_complete_sync_urb); u->urb->complete = snd_usb_complete_callback(snd_complete_sync_urb);
} }
...@@ -1272,7 +1269,12 @@ static int set_format(snd_usb_substream_t *subs, struct audioformat *fmt) ...@@ -1272,7 +1269,12 @@ static int set_format(snd_usb_substream_t *subs, struct audioformat *fmt)
subs->syncpipe = usb_rcvisocpipe(dev, ep); subs->syncpipe = usb_rcvisocpipe(dev, ep);
else else
subs->syncpipe = usb_sndisocpipe(dev, ep); subs->syncpipe = usb_sndisocpipe(dev, ep);
if (get_endpoint(alts, 1)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE &&
get_endpoint(alts, 1)->bRefresh >= 1 &&
get_endpoint(alts, 1)->bRefresh <= 9)
subs->syncinterval = get_endpoint(alts, 1)->bRefresh; subs->syncinterval = get_endpoint(alts, 1)->bRefresh;
else
subs->syncinterval = 1;
} }
/* always fill max packet size */ /* always fill max packet size */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册