Cannot create AudioTrack with larger audio output latency.

by AndroidJimmy » Fri, 27 Feb 2009 15:03:46 GMT

Sponsored Links
 I meet a problem about creating AudioTrack failed with larger audio
output latency.
It fails in AudioTrack::set(), blocked by codes below:

    if (frameCount < minFrameCount) {
      LOGE("Invalid buffer size: minFrameCount %d, frameCount %d",
minFrameCount, frameCount);
      return BAD_VALUE;

I think this code is for guaranteeing there are enough buffer and
sample in AudioTrack to wait for audio output consuming the output

In MediaPlayerService::AudioOutput::open(),  AudioTrack is created by
codes below:

    new AudioTrack(mStreamType, sampleRate, format, channelCount,

framecount is determined by frameCount = (sampleRate*afFrameCount)/
afSampleRate; In most situation, sampleRate is usually 44100,
bufferCount is hard-code in PV(4) and SONIVOX_PLAYER/VORBIS_PLAYER

So if there is a larger output latency, PV/SONIVOX_PLAYER/
VORBIS_PLAYER may not create an AudioTrack with enough bufferCount.
These may happen when output is a larger latency network device, such
as BlueTooth, etc.

Is there a way to prevent from creating AudioTrack fail under this

Cannot create AudioTrack with larger audio output latency.

by Dave Sparks » Sat, 28 Feb 2009 03:15:30 GMT

 There are a bunch of patches coming related to this in Cupcake. The
app can either ask for the default latency or it can ask for the
latency and request something bigger.


Sponsored Links

Other Threads

1. Downloading ADC2 judging application

Hi Guys,

I currently have a HTC magic(Airtel-Android) which does not have the
Android Market application on it.

Is there anyway that I can download the judging application and use


2. Support for divx and wmv formats in PV opencore

Thanks. Hope to see flash support sometime.


3. application code for SDK 1.5 and 1.6

4. Solved: conversion to dalvik format failed with error 1

5. No classfiles specified on even hello after installing SDK 1.5

6. How do you enable media to be stored internally

7. Again on SH porting