Android Forums

Go Back   These FORUMS ARE DISABLED!! OUR NEW FORUMS ARE AT http://androidforum.com/ > Android Software > Android Games And Applications
Connect with Facebook

Click Here To Register!
 
 
LinkBack Thread Tools Display Modes
Old 01-13-2010, 12:05 PM   #1
New Member
 
Join Date: Jan 2010
Posts: 2
Friends: 0
View chandra_ele2003's Profile   View chandra_ele2003's Photo Album   View chandra_ele2003's Blog   View Social Groups
Hi ,
I'm porting mplayer movie player as a plugin to android webkit browser.
I have ported mplayer to android platform.I'm able to download audio stream via android NP APIs and decompress mp3 data using mplayer.I have verified the decompressed data by playing it on x86 machine.

I'm trying the play the raw 16 bit (number of bits per sample ) PCM data via ANPAudioTrackInterfaceV0 APIs.

I have created audio track using

ANPAudioTrackInterfaceV0 as in external/webkit/WebKit/android/plugins/sample/main.cpp.

Playing via callback as mentioned in same above file.

I am getting crack sound with actual audio . The callback which expects the data is faster when compared to decoding and filling the buffer.

Please help me if any one encountered the same problem while playing audio with webkit plugin.

please use the following sample code for audio callback and creating the new track,



bool mplayer::FillSoundBuffer( char * data, int size )
{
if(!data)
return false;
if(size == 0)
return true;
memcpy(buff+(fcount++*size), data,size);
soundBufferSize = size;

return true;
}


bool mplayer::OpenDevice( int channels, int sampleSize, int sampleRate, int sndBufferSizeBytes)
{
SoundPlay* play = new SoundPlay;

play->file = NULL;
play->instance = pluginInstance;
play->track = gSoundI.newTrack(22050, kPCM16Bit_ANPSampleFormat, 2, audioCallback, play);
playTrack = play->track;
if (NULL == play->track) {
delete play;
return false;
}
else
{
if(play->track)
{
if (gSoundI.isStopped(play->track))

gSoundI.start(play->track);
}
}

return true;

}

static void audioCallback(ANPAudioEvent evt, void* user, ANPAudioBuffer* buffer)
{
switch(evt)
{
case kMoreData_ANPAudioEvent:
SoundPlay* play = reinterpret_cast<SoundPlay*>(user);

// if(play->track && soundBuffer!= NULL)
if(play->track)
{
memcpy(buffer->bufferData,soundBuffer,2048);
buffer->size = 2048;
gLogI.log(NULL,kDebug_ANPLogType," In audioCallback %d",buffer->size);
}
break;
}

}

Last edited by chandra_ele2003; 01-13-2010 at 12:34 PM..
chandra_ele2003 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in Technorati
Old 06-09-2010, 11:57 AM   #2
New Member
 
Join Date: Jun 2010
Posts: 1
Friends: 0
View wminghao's Profile   View wminghao's Photo Album   View wminghao's Blog   View Social Groups
i saw the same issue on nexus one, sound callback is triggering faster than fillbuffer calls from a different thread. If I bump up the priority of the fillbuffer() thread, the problem still exist. Any ideas?
wminghao is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in Technorati
Old 06-10-2010, 03:43 AM   #3
New Member
 
Join Date: Jan 2010
Posts: 2
Friends: 0
View chandra_ele2003's Profile   View chandra_ele2003's Photo Album   View chandra_ele2003's Blog   View Social Groups
I think we have solved this issue. I'm travelling. I'll go through and get back to you in 1/2 days.
chandra_ele2003 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in Technorati
 

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Regarding webkit winfred Android Games And Applications 1 12-07-2009 04:46 AM
Android Webkit features and External application opening support saravananl Android Games And Applications 0 11-29-2009 11:46 PM
Android audio issue rag13 Android Development, Answers, Tutorials, and Code Snippets 0 11-03-2009 05:49 AM
How to add adt plugin to eclipse from zip file JavaTiger Android Development, Answers, Tutorials, and Code Snippets 0 10-22-2009 03:00 PM
ADT Eclipse Plugin URL not working? filbert Android Development, Answers, Tutorials, and Code Snippets 0 12-05-2008 07:35 PM


Unlocked G1 Phones | Buy T-Mobile G1 | Google Phone

All times are GMT -6. The time now is 12:12 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.
Copyright (c) 2012 TalkAndroid.com. All rights reserved.