Abramo Bagnara wrote:

>Tim Goetze wrote:
>> 
>> Jaroslav Kysela wrote:
>> 
>> >Hello all,
>> >
>> >       I need your advice here. The current snd_pcm_mmap_commit()
>> >function returns zero or an error. I've added a new function
>> >snd_pcm_mmap_commit_partial() to detect partial transfers as well:
>> >
>> >int snd_pcm_mmap_commit(snd_pcm_t *pcm,
>> >                        snd_pcm_uframes_t offset,
>> >                        snd_pcm_uframes_t frames);
>> >int snd_pcm_mmap_commit_partial(snd_pcm_t *pcm,
>> >                                snd_pcm_uframes_t offset,
>> >                                snd_pcm_uframes_t frames,
>> >                                snd_pcm_uframes_t *commited);
>> >
>> >Abramo doesn't like new function so much, so I need your vote here, if:
>> >
>> >1) change snd_pcm_mmap_commit prototype to
>> >
>> >snd_pcm_sframes_t snd_pcm_mmap_commit(snd_pcm_t *pcm,
>> >                                     snd_pcm_uframes_t offset,
>> >                                     snd_pcm_uframes_t frames);
>> >
>> >2) leave the current API as is (two separate commit functions)
>> >
>> >3) remove snd_pcm_mmap_commit() and rename
>> >   snd_pcm_mmap_commit_partial() to snd_pcm_mmap_commit() although
>> >   it makes necessary to add an extra parameter to all existing
>> >   applications (NULL can be taken as "I don't care")
>> >
>> >
>> >I see the benefit of the extra parameter, that we can return the error
>> >code and transfer count in one pass. Otherwise the error code can be lost
>> >or returned later using another function like snd_pcm_avail_update() etc..
>> 
>> as a programmer i'd say, yes i'd like to be informed about partial
>> transfers.
>> 
>> i'd make snd_pcm_mmap_commit return -errno in case of error and number of
>> frames commited otherwise.
>> that's approximately what read/write(2) do, and that's what i'd prefer.
>
>Jaroslav point is that in this way you can't know *both* error and
>frames count.
>
>You lose the error info (or delay its return). 

if the error case takes longer to complete, this is fine by me -- we'll 
have to stop the device in this case anyway. i think the API should be 
optimized for normal operations (and i haven't ever had an error return 
by mmap_commit afaicr).

tim


_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to