All of lore.kernel.org
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: Daniel Mack <zonque@gmail.com>
Cc: alsa-devel@alsa-project.org,
	=?UTF-8?B?QXVyw6lsaWVuIExlYmxv?=@alsa-project.org,
	"Takashi Iwai" <tiwai@suse.de>,
	"Grant Diffey" <gdiffey@gmail.com>,
	"Felix Homann" <linuxaudio@showlabor.de>, nd <blablack@gmail.com>
Subject: Re: M-Audio FTU issues
Date: Fri, 24 Jun 2011 17:58:38 +0200	[thread overview]
Message-ID: <4E04B42E.2080906@ladisch.de> (raw)
In-Reply-To: <BANLkTi=Bj7DFbSFs9p1go-ACzCAtZ=ij6w@mail.gmail.com>

Daniel Mack wrote:
> 1. Like I posted last year, I wanted to just collect the number of
> received frames when capturing data and modify
> snd_audio_next_packet_size() so that it approximates to the number of
> samples received in the record stream. This didn't work as easily
> because the streaming loop ended up queueing 0-byte packets which the
> hardware doesn't like at all. It will stop streaming and won't recover
> after the first empty packet was sent.

There are other devices with the same bug.

> 3. The most promising approach (the one implemented in the attached
> patch) splits the urb's size calculation from the actual ops.prepare()
> handler and re-uses the ops.prepare() from a new function called
> queue_next_out_urb(). For this, our complete_urb function must be
> modified to not automatically requeue the next out urb but leave it to
> the capture stream's retire callbacks when to fire the next out packet
> (and here, we will ignore 0-byte input packets and not send out 0-byte
> out urbs). A new counter variable (next_out_urb) is needed for that.
> 
> The problem, however, is that we now have to check when to actually
> start and stop the capture stream:
> 
> - We have to start it (and put it to pause mode) once the playback
> starts and switch over to the real callback once the user starts the
> capture PCM stream
> - We also have to start it if the user only wants to capture PCM,
> without playback.
> - We can stop it if the user was only using capture PCM or playback PCM streams.
> - But we cannot stop it if it still serves as feedback source for a
> running playback PCM.

The same logic is implemented in ua101.c.

> I started to implement some logic for this, but I'm not really happy
> with it yet. Some reference counting would be much better than what I
> currently have, but I don't see a good solution yet. Maybe I've been
> looking at this for too long now, and someone else has an idea?

The overall structure of the code handling the PCM streams becomes
different: not only must the starting/stopping of the USB capture stream
be decoupled from the ALSA stream, but the handling of audio formats and
URB buffers changes because capturing can be started before the ALSA PCM
capture stream is configured.

I think the best solution would be to move the USB streaming into
a module, add implicit feedback support there, and create a separate
driver for the FTU and similar devices.  (I'm doing this for FireWire
streaming right now, and always wanted to do the same for USB.  Many
thanks for volunteering!  :-)


Regards,
Clemens

  reply	other threads:[~2011-06-24 15:58 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-24  1:14 M-Audio FTU issues Daniel Mack
2011-06-24  3:27 ` Grant Diffey
2011-06-24  7:35 ` Felix Homann
2011-06-24  8:52 ` Felix Homann
2011-06-24 15:23   ` Daniel Mack
2011-06-24 15:58     ` Clemens Ladisch [this message]
2011-06-24 16:10       ` Daniel Mack
2011-06-28 20:37         ` Aurélien Leblond
2011-06-29  8:08           ` Daniel Mack
2011-07-03 11:52             ` Grant Diffey
2011-07-04 17:14               ` Aurélien Leblond
2011-07-04 17:23               ` Daniel Mack
2011-07-13 21:18               ` Juan Pablo Bouza
2011-07-21  5:08               ` Juan Pablo Bouza
2011-07-21  7:55                 ` Daniel Mack
2011-07-21  8:25                   ` Felix Homann
2011-07-24 14:12                     ` Aurélien Leblond
2011-07-24 14:46                       ` Daniel Mack
2011-07-21 20:31                   ` Juan Pablo Bouza
2011-07-22  8:42                     ` Daniel Mack
2011-07-23  4:25                       ` Juan Pablo Bouza
2011-07-25 13:07         ` Clemens Ladisch
2011-06-27  8:52     ` Felix Homann
2011-06-24  9:08 ` Felix Homann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E04B42E.2080906@ladisch.de \
    --to=clemens@ladisch.de \
    --cc==?UTF-8?B?QXVyw6lsaWVuIExlYmxv?=@alsa-project.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=blablack@gmail.com \
    --cc=gdiffey@gmail.com \
    --cc=linuxaudio@showlabor.de \
    --cc=tiwai@suse.de \
    --cc=zonque@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.