diff options
-rw-r--r-- | sound/usb/usbaudio.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index a1bd8040dea4..95729730bcdc 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -478,22 +478,38 @@ static int retire_playback_sync_urb_hs(struct snd_usb_substream *subs, | |||
478 | /* | 478 | /* |
479 | * Prepare urb for streaming before playback starts. | 479 | * Prepare urb for streaming before playback starts. |
480 | * | 480 | * |
481 | * We don't care about (or have) any data, so we just send a transfer delimiter. | 481 | * We don't yet have data, so we send a frame of silence. |
482 | */ | 482 | */ |
483 | static int prepare_startup_playback_urb(struct snd_usb_substream *subs, | 483 | static int prepare_startup_playback_urb(struct snd_usb_substream *subs, |
484 | struct snd_pcm_runtime *runtime, | 484 | struct snd_pcm_runtime *runtime, |
485 | struct urb *urb) | 485 | struct urb *urb) |
486 | { | 486 | { |
487 | unsigned int i; | 487 | unsigned int i, offs, counts; |
488 | struct snd_urb_ctx *ctx = urb->context; | 488 | struct snd_urb_ctx *ctx = urb->context; |
489 | int stride = runtime->frame_bits >> 3; | ||
489 | 490 | ||
491 | offs = 0; | ||
490 | urb->dev = ctx->subs->dev; | 492 | urb->dev = ctx->subs->dev; |
491 | urb->number_of_packets = subs->packs_per_ms; | 493 | urb->number_of_packets = subs->packs_per_ms; |
492 | for (i = 0; i < subs->packs_per_ms; ++i) { | 494 | for (i = 0; i < subs->packs_per_ms; ++i) { |
493 | urb->iso_frame_desc[i].offset = 0; | 495 | /* calculate the size of a packet */ |
494 | urb->iso_frame_desc[i].length = 0; | 496 | if (subs->fill_max) |
497 | counts = subs->maxframesize; /* fixed */ | ||
498 | else { | ||
499 | subs->phase = (subs->phase & 0xffff) | ||
500 | + (subs->freqm << subs->datainterval); | ||
501 | counts = subs->phase >> 16; | ||
502 | if (counts > subs->maxframesize) | ||
503 | counts = subs->maxframesize; | ||
504 | } | ||
505 | urb->iso_frame_desc[i].offset = offs * stride; | ||
506 | urb->iso_frame_desc[i].length = counts * stride; | ||
507 | offs += counts; | ||
495 | } | 508 | } |
496 | urb->transfer_buffer_length = 0; | 509 | urb->transfer_buffer_length = offs * stride; |
510 | memset(urb->transfer_buffer, | ||
511 | subs->cur_audiofmt->format == SNDRV_PCM_FORMAT_U8 ? 0x80 : 0, | ||
512 | offs * stride); | ||
497 | return 0; | 513 | return 0; |
498 | } | 514 | } |
499 | 515 | ||