make sure to fallback properly to software when copybit operation fails.
with this change, the preview image will at least be displayed in b&w
(since GL doesn't support the yuv format). This would also fix
2363506, but that one is now handled more cleanly.
First implementations of audio policy manager in Eclair branch have shown that most code is common to all platforms.
Creating AudioPolicyManagerBase base class will improve code maintainability and readability.
Audio policy manager code for platforms using generic audio previously in AudioPolicyManagerGeneric is replaced by AudioPolicyManagerBase.
Audio policy manager test code previously in AudioPolicyManagerGeneric is moved to AudioPolicyManagerBase.
Also added a wake lock for delayed commands in AudioPolicyService.
Modified AudioFlinger duplicating output thread so that audio tracks are not mixed until both outputs (A2DP and hardware) have exited standby mode. This avoids to have one output far ahead of the other and audio frames dropped because the compensation mechanism cannot keep up.
Also calculate the maximum wait time in OutputTrack::write() based the on smallest frame count of all output threads instead of the frame count of the thread the OutputTrack is connected to. This avoids starving the thread with the smallest frame count by waiting too long on the other thread.
Since the frame count was reduced on hardware output to reduce latency the difference between A2DP and hardware outputs frame counts had become problematic.
Also increased the number of overflow buffers to cope with bigger timing differences among outputs.
Merge commit 'f9b0e826689cca5ecbd40aa49f3ea7f7c73ad2a2' into eclair-mr2
* commit 'f9b0e826689cca5ecbd40aa49f3ea7f7c73ad2a2':
fix [2269582] [TOP-10][Passion_1506][APT:Camera]Sometimes camera preview screen is truncated after launching and back to home screen by home key repeatedly
When a surface is removed from the screen while it holds a "freeze lock", the
release of that lock happens in the destructor as a "safety net". However, it
doesn't trigger an update at that point.
Make sure that "freeze locks" are released from the transaction at the point
a surface is removed from the screen (if it's not on screen, it shouldn't
prevent the screen to redraw, and therefore cannot hold a freeze lock).
The refresh corresponding to that transaction will pick it up as soon as possible.
Merge commit '083a557c25e0032bc4900f335b6643d0badd09ce' into eclair-mr2
* commit '083a557c25e0032bc4900f335b6643d0badd09ce':
fix [2319255] crash in openGL : from the media recorder stress test.
Merge commit '76169da0e84b0fcf621aeac6141af3ee85bc7c1e' into eclair-mr2
* commit '76169da0e84b0fcf621aeac6141af3ee85bc7c1e':
fix [2315900] Monochrome camera preview screen after launching camera
Merge commit 'd8c752ef74bc6d8b412defe35caf1a19be15eb8b' into eclair-mr2
* commit 'd8c752ef74bc6d8b412defe35caf1a19be15eb8b':
improve video performance to minimize the tearing effect seen in 720p movies
Allows "aapt dump --values resource" to print out whether a string in a
ResStringPool is in UTF-8 or UTF-16 encoding.
Change-Id: I6478884a70a3b46fee862dece6cb33454fc34843
this was introduced by a recent change. when we try to figure out the size of
the yuv->rgb temporary buffer, the output resolution has not been computed yet
and an invalid buffer size is used. most of the time the allocation fails
and the system reverts to "standard" GL will uses onle the Y plane.
the allocation of the temporary buffer is moved to onDraw(), the first
time it is called, by that time, the window is positioned properly.
always rescale videos to their target size using copybit during yuv->rgb
conversion. this improves performance of the GPU pass and doesn't require
linear filtering to be enabled. Also always use 16-bits buffers.
the average processing time for 720p dropped from ~50ms to ~30ms
This is a very simply implementation: upon receiving an IPC, if the handling
thread is at a background priority (the driver will have taken care of
propagating this from the calling thread), then stick it in to the background
scheduling group. Plus an API to turn this off for the process, which is
used by the system process.
This also pulls some of the code for managing scheduling classes out of
the Process JNI wrappers and in to some convenience methods in thread.h.
Allows the use of UTF-8 for packing resources instead of the
default of UTF-16 for Java. When strings are extracted from the
ResStringPool, they are converted to UTF-16 and the result is
cached for subsequent calls.
When using aapt to package, add in the "-8" switch to pack the
resources using UTF-8. This will result in the value, key, and
type strings as well as the compiled XML string values taking
significantly less space in the final application package in
most scenarios.
Change-Id: I129483f8b3d3b1c5869dced05cb525e494a6c83a
The ToneGenerator failed to initialize because no more tracks were available in AudioFlinger mixer.
All tracks were used because the duplicating output was failing to free the tracks on audio hardware output mixer when exiting due to a misplaced test on output activity: output tracks where only freed if the duplicating output was active when exiting.
The fix consists in freeing the output tracks when the duplicating thread is destroyed without condition.
Merge commit '6d42d80653f2c41f3e72a878a1d9a6f9693b89f7' into eclair-mr2
* commit '6d42d80653f2c41f3e72a878a1d9a6f9693b89f7':
Fix issue 2304669: VoiceIME: starting and canceling voice IME yields persistent "error 8" state on future attempts and breaks voice search.
Fixed AudioFlinger::openInput() broken in change ddb78e7753be03937ad57ce7c3c842c52bdad65e
so that an invalid IO handle (0) is returned in case of failure.
Applied the same correction to openOutput().
Modified RecordThread start procedure so that a failure occuring during the first read from audio input stream is detected and causes
the record start to fail.
Modified RecordThread stop procedure to make sure that audio input stream fd is closed before we exit the stop function.
Fixed AudioRecord JAVA and JNI implementation to take status of native AudioRecord::start() into account
and not change mRecordingState to RECORDSTATE_RECORDING if start fails.
Merge commit '0019215fc395ef12c191049b1903eeabf70859cf' into eclair-mr2
* commit '0019215fc395ef12c191049b1903eeabf70859cf':
Revert "When using MDP, we needed to use a texture for diming."
Merge commit '121a31ac3901fcb81c808da2b4a9a7cf66c12b7c' into eclair-mr2
* commit '121a31ac3901fcb81c808da2b4a9a7cf66c12b7c':
fix [2291418] Camera preview cannot work in Emulator
The image buffer used by glTexImage2d() would be uninitialized when no copybit engine
can be found.
We now always initialize images, since the abscence of copybit is not necessarily fatal.
Merge commit '1ac56b602aa6a1ac54c608e5a8b76f44638db23b' into eclair-mr2
* commit '1ac56b602aa6a1ac54c608e5a8b76f44638db23b':
Fix issue 2292062: Audio freezes for three seconds when choosing ringtones with a headset connected and music playing.
There was bug in the logic that calculated the relative timeout, the start time was
reset each time an event was received, which caused the timeout to never occur if
an application was constantly redrawing.
Now we always check for a timeout when we come back from the waitEvent() and
process the "anti-freeze" if needed, regardless of whether an event was received.
The problem comes from a deadlock with AudioPolicyService mutex: When the second ringtone starts,
this mutex is locked by AudioPolicyService::startOutput() which in turn calls setParameters() to change the output device.
Audioflinger::ThreadBase::setParameters() signals the parameter change to the AudioFlinger mixer thread and waits for a condition
indicating that the parameter change has been processed.
At the same time, the mixer thread detects that the audio track corresponding to the first ring tone has been killed and calls its destructor.
This calls AudioPolicyService::releaseOutput() which tries to lock the AudioPolicyService mutex.
If this happens before the mixer thread can process the setParameters() command we are deadlocked.
The deadlock ends because setParameters() uses a timeout when waiting for the condition.
This regression was introduced by change 33736 fixing issue 2265163.
The fix consists in calling AudioPolicyService::releaseOutput() from Track::destroy() instead of from Track destructor: as detroy() is never called from the mixer thread loop (as opposed to the destructor) the deadlock described above cannot occur.
Binary XML file line #37: Error inflating class <unknown> after adding a secondary account
Now that I have these debug logs, I want to keep them since they will make
debugging these kinds of issues a lot easier in the future. (Note in this
case there was no problem in the framework.)
Change-Id: If2b0bbeda4706b7c5dc1ba4a5db04b74f40e1543
This is a second attempt to fix the audio routed to earpiece syndrom.
The root cause identified this time is the crash of an application having an active AudioTrack playing on the VOICE_CALL stream type.
When this happens, the AudioTrack destructor is not called and the audio policy manager is not notified of the track stop.
Results a situation where the VOICE_CALL stream is considered as always in use by audio policy manager which makes that audio is routed to earpiece.
The fix consists in moving the track start/stop/close notification to audio policiy manager from AudioTrack to AudioFlinger Track objet.
The net result is that in the case of a client application crash, the AudioFlinger TrackHandle object (which implements the remote side of the IAudioTrack binder interface) destructor is called which in turn destroys the Track object and we can notify the audio policy manager of the track stop and removal.
The same modification is made for AudioRecord although no bug related to record has been reported yet.
Also fixed a potential problem if record stop is called while the record thread is exiting.