Skip to contentSkip to conversation

period_size, periods, count parameters

DISCUSSION Mathieu Rondonneau 2 participants 6 messages Feb 22, 2004 – Feb 27, 2004

lore
Share & tools
lore
#0 lore raw

Hi,

I've a question according to the ¨period_size¨ and the ¨periods¨ parameters in the ¨runtime¨ structure.

my wav file is 34184 bytes long, and my hardware parameter are:

	.rate_min	  = 8000,
	.rate_max	  = 48000,
	.channels_min	  = 1,
	.channels_max	  = 2,
	.buffer_bytes_max = 64*1024,
	.period_bytes_min = 1092,
	.period_bytes_max = 32768,
	.periods_min	  = 8, 
	.periods_max	  = 512,

When i start to send a file, I Don't know why:
runtime->period_size = 8192
runtime->periods: 8
and the ¨count¨ parameter in the copy operator is 1024

I tryed to change
.period_bytes_min = 8192,
.periods_min = 1,

but the ¨count¨ parameter, the ¨periode_size¨ and ¨periods¨ remain the same.

Is it possible to change the ¨count¨ parameter in the copy operator?

Thank you very much for your help.
Mathieu Rondonneau

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click

#1 lore raw
Quoted 9 lines · Mathieu Rondonneau
	.period_bytes_min = 1092,
	.period_bytes_max = 32768,
	.periods_min	  = 8,
	.periods_max	  = 512,

When i start to send a file, I Don't know why:
runtime->period_size = 8192
runtime->periods: 8
and the ¨count¨ parameter in the copy operator is 1024

These values fit into the constraints defined above.

Quoted 6 lines

I tryed to change
.period_bytes_min = 8192,
.periods_min = 1,

but the ¨count¨ parameter, the ¨periode_size¨ and ¨periods¨ remain the same.

The same for these values.

Quoted 2 lines

Is it possible to change the ¨count¨ parameter in the copy operator?

Apparently, your copy operator is to copy one period.

Probably you have to force another period size.

What's wrong with these parameters?

Regards,
Clemens

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click

#2 lore raw

Selon Clemens Ladisch <[email protected]>:

Quoted 6 lines
Quoted 5 lines · Mathieu Rondonneau
	.period_bytes_min = 1024,
	.period_bytes_max = 32768,
	.periods_min	  = 8,
	.periods_max	  = 512,
Quoted 6 lines
Quoted 4 lines

When i start to send a file, I Don't know why:
runtime->period_size = 8192
runtime->periods: 8
and the ¨count¨ parameter in the copy operator is 1024

These values fit into the constraints defined above.

Thank you for your help Clemens.
Now, I understand a part of my problem.
According to the constraints values, I totaly agree with you.
But i miss something about the count parameter.
Why the count parameter is not equal to the size of the period in the runtime pointer (i.e. in my example above: 8192) in the copy operator?

I tried with new parameter:

	.period_bytes_min = 16*1024,
	.period_bytes_max = 64*1024,
	.periods_min	  = 2,
	.periods_max	  = 4,

and the result were:
runtime->period_size: 16*1024
runtime->periods: 4

I agree that values fit into constraints but the count parameter is always 1024. I don't understand why count is 1024 ?
why count is not equal to runtime->period_size (i.e. 16*1024)?

I'm shure i miss something.
Maybe you can help me.
I thank you very much for your help.

regards,
Mathieu

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click

#3 lore raw
Quoted 2 lines · Mathieu Rondonneau

I don't understand why count is 1024 ?
why count is not equal to runtime->period_size (i.e. 16*1024)?

If your frame size is 4, this is the size of a memory page. I guess ALSA wants to copy the data one page at a time, and this is required if the buffer isn't contiguous.

Regards,
Clemens

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click

#4 lore raw

Selon Clemens Ladisch <[email protected]>:

Quoted 7 lines
Quoted 2 lines · Mathieu Rondonneau

I don't understand why count is 1024 ?
why count is not equal to runtime->period_size (i.e. 16*1024)?

If your frame size is 4, this is the size of a memory page. I guess ALSA wants to copy the data one page at a time, and this is required if the buffer isn't contiguous.

How do i know the frame size?
Is it the runtime->frame_bits value?
the frame_bits is 16.

I'm using snd_pcm_lib_preallocate_pages_for_all api for memory space allocation. Does it mean the buffer isn't contiguous?

Thank you for your help.

Mathieu

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click

#5 lore raw
Quoted 6 lines · Mathieu Rondonneau

Selon Clemens Ladisch <[email protected]>:

Quoted 4 lines
Quoted 2 lines · Mathieu Rondonneau

I don't understand why count is 1024 ?
why count is not equal to runtime->period_size (i.e. 16*1024)?

Quoted 6 lines
Quoted 3 lines

If your frame size is 4, this is the size of a memory page. I guess ALSA wants to copy the data one page at a time, and this is required if the buffer isn't contiguous.

How do i know the frame size?
Is it the runtime->frame_bits value?

Yes IIRC

Quoted 2 lines

I'm using snd_pcm_lib_preallocate_pages_for_all api for memory space allocation. Does it mean the buffer isn't contiguous?

The buffer usually is contiguous. But the copy callback is used for cases where the real buffer is somewhere else, so it wouldn't need to be contiguous.

Regards,
Clemens

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click