Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
guru2000at
Posts: 101
Registered: ‎02-25-2011
My Device: Playbook, q5, z10

Loose of FPS after updating OS to 2.0.0.7111

[ Edited ]

i found a strange behavior of my application after updating the OS of my PB to  2.0.0.7111 beta.

Before the update i got 41 FPS, after the update i got 11 FPS (see the attached screenshots)

Can anybody confirm this problem ?

 

(same bar file on both)

 

Before update:

screen2.jpg

after update:

screen2.jpg

 

 

[UPDATE]

i m still looking for the decrease of frames per second and i found out, that it is some how connected to "snd_pcm_plugin_read()". 

i will update my post, if i found a solution or the exact problem :smileywink:

 

[UPDATE II]

i found a workaround: the problem is in the "snd_pcm_plugin_read()" function.  i changed the fragsize in the snd_pcm_channel_params_t variable to 1/4 of the original value, and get the same fps as on the old OS version .... but i m not happy with that ...

________________
mappau Dev Team
blackberry@mappau.com
twitter: mappau
Retired
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10

Re: Loose of FPS after updating OS to 2.0.0.7111

Hi,

 

What OS version did you update from? If you don't recall the exact version, was it still 2.0?

Could you provide the snippet of modified code being used to receive audio?

 

Regards,

Garett
@garettBeuk
--
Goodbye everybody!
Developer
guru2000at
Posts: 101
Registered: ‎02-25-2011
My Device: Playbook, q5, z10

Re: Loose of FPS after updating OS to 2.0.0.7111

[ Edited ]

hi,

thx for your answer. i updated from 2.0.0.6149

i attached some code snippet:

 

	// INIT SOUNDCARD:
	// from the example
	// not the full (and exact) source code

	int card = 22;
	int dev = 1;

	int fragsize = 5000;
	int rtn;

	snd_pcm_channel_info_t pi;
	snd_mixer_group_t group;
	snd_pcm_channel_params_t pp;
	snd_pcm_channel_setup_t setup;

	fd_set rfds;

	mSampleRate = 352800;

	char *name = "/dev/snd/pcmC0D0c";

	snd_pcm_info_t info;
	if ((rtn = snd_pcm_open_name(&pcm_handle, name, SND_PCM_OPEN_CAPTURE))
			< 0) {
		fprintf(stderr, "snd_pcm_open failed: %s\n", snd_strerror(rtn));
	} else {
		rtn = snd_pcm_info(pcm_handle, &info);
		card = info.card;
	}
	if ((rtn = snd_pcm_plugin_set_disable(pcm_handle, PLUGIN_DISABLE_MMAP))
			< 0) {
		fprintf(stderr, "snd_pcm_plugin_set_disable failed: %s\n",
				snd_strerror(rtn));
		return -1;
	}

	memset(&pi, 0, sizeof(pi));
	pi.channel = SND_PCM_CHANNEL_CAPTURE;
	if ((rtn = snd_pcm_plugin_info(pcm_handle, &pi)) < 0) {
		fprintf(stderr, "snd_pcm_plugin_info failed: %s\n", snd_strerror(rtn));
		return -1;
	}

	memset(&pp, 0, sizeof(pp));

	pp.mode = SND_PCM_MODE_BLOCK;
	pp.channel = SND_PCM_CHANNEL_CAPTURE;
	pp.start_mode = SND_PCM_START_DATA;
	pp.stop_mode = SND_PCM_STOP_STOP;

	pp.buf.block.frag_size = fragsize;
	pp.buf.block.frags_max = -1;
	pp.buf.block.frags_min = 1;

	pp.format.interleave = 1;
	pp.format.rate = mSampleRate;
	pp.format.voices = 1;
	pp.format.format = SND_PCM_SFMT_S16_LE;

	if ((rtn = snd_pcm_plugin_params(pcm_handle, &pp)) < 0) {
		fprintf(stderr, "snd_pcm_plugin_params failed: %s\n",
				snd_strerror(rtn));
		return -1;
	}

	if ((rtn = snd_pcm_plugin_prepare(pcm_handle, SND_PCM_CHANNEL_CAPTURE)) < 0)
		fprintf(stderr, "snd_pcm_plugin_prepare failed: %s\n",
				snd_strerror(rtn));

	memset(&setup, 0, sizeof(setup));
	memset(&group, 0, sizeof(group));
	setup.channel = SND_PCM_CHANNEL_CAPTURE;
	setup.mixer_gid = &group.gid;
	if ((rtn = snd_pcm_plugin_setup(pcm_handle, &setup)) < 0) {
		fprintf(stderr, "snd_pcm_plugin_setup failed: %s\n", snd_strerror(rtn));
		return -1;
	}

	bsize = setup.buf.block.frag_size;

	if (group.gid.name[0] == 0) {
		fprintf(stderr, "Mixer Pcm Group [%s] Not Set \n", group.gid.name);
		fprintf(stderr, "***>>>> Input Gain Controls Disabled <<<<*** \n");
	} else
		fprintf(stderr, "Mixer Pcm Group [%s]\n", group.gid.name);
	if ((rtn = snd_mixer_open(&mixer_handle, card, setup.mixer_device)) < 0) {
		fprintf(stderr, "snd_mixer_open failed: %s\n", snd_strerror(rtn));
		return -1;
	}

	mSampleBfr1 = malloc(bsize);
	FD_ZERO(&rfds);


	// ...

	while (!exit_application) {
		int read = 0;
		// the next line needs much more time in OS 2.0.0.7111 than in 2.0.0.6149
		// MEASURE TIME HERE
		read = snd_pcm_plugin_read(pcm_handle, mSampleBfr1, bsize);
		// AND HERE

		//do sth.
		//render sth.
	}

	// THE END :)

 when i comment out the audio read line, i get over 100fps, with the line in the code: something around 10 fps :/

maybe you can reproduce it.

________________
mappau Dev Team
blackberry@mappau.com
twitter: mappau
Retired
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10

Re: Loose of FPS after updating OS to 2.0.0.7111

Please post this to the Developer Issue Tracker:

Issue Tracker

 

With your submission be sure to include a full code sample that reproduces the issue. I can have it escalated for deeper review once done, just post back the URL to the issue.

 

Thanks,

Garett
@garettBeuk
--
Goodbye everybody!