Current AudioTrack implementation enforces that the requested audio
buffer size is at least corresponding the audio latency.
This requirement is too strong and leads to problems with current
stagefright and AudioSink implementations when playing over output
streams with long latency.
Ultimately, the AudioSink design should be changed to specify a minimum
buffer size in time or frames units but not in buffer count units.
Change-Id: I8ba603956f92ac49143a8249572665aa548f2f0f
Conflicts:
media/libmedia/AudioTrack.cpp
Move in the direction of a more publishable API for configuring a
media player for retransmission. It used to be that we used a custom
invoke and a modified URL (prefixed with aahTX://). There are many
issues with this technique and it was never meant to stand the test of
time.
This CL gets rid of all that. A new (but currently hidden) method was
introduced to the java level MediaPlayer API, called
setRetransmitTarget(InetSocketAddress), which allows an app writer to
set the retransmit target. For now, this method needs to be called
before a call to setDataSource (which is pretty unusual for the
MediaPlayer API) because this mid level code uses this as a cue to
instantiate an aahTX player instead of relying on the data source to
select a player. When retranmit functionality becomes part of the
existing android player implemenation, this
set-retrans-before-set-data-source behavior can go away, along with
the aahTX player itself.
Change-Id: I6ab07d89b2eeb0650e634b8c3b7a0b36aba4e7dd
This reverts commit 64006cb1642b2ec0ee74c66007d869b884391fd1.
Back out this change in order to get ready to implement a longer term,
more media-team approved way of selecting a retransmit player.
Change-Id: I97b68b9859a174eab858598cb00d4445a14fbc17
* Added a MediaPlayer.setMediaPlayerType API that be called to specify the
desired media player implementation before calling setDataSource
* Implemented setDataSource(fd) in the AAH_TxPlayer
Change-Id: I359075d9c7d6fd699dda14eb85ec50da19307639
Bring the Visualizer class into line with the SDK documentation by
returning ERROR_DEAD_OBJECT instead of ERROR_INVALID_OPERATION when
the Visualizer loses its binder connection to the mediaserver because
of a mediaserver restart.
Also add a new callback interface to allow clients to be
asynchronously notified in the case of server death. Right now, the
interface definition and the registration method are flagged as hidden
pending API council review/approval.
See http://b/issue?id=5717519 for details.
Change-Id: Id428fb946d6d7676bffd2a597366e8444ebe24f2
Signed-off-by: John Grossman <johngro@google.com>
* commit '481ffa505bb1d8f5089ea98e3b5960d409b6819c':
Fix for issue 5309336 -add videoeditor maximum prefetch YUV frames in media_profiles.xml to limit the total memory usage.
-add videoeditor maximum prefetch YUV frames in media_profiles.xml to limit the total memory usage.
Change-Id: I41ffbc192fcce4c7635e5b0a1f2835852e5ee509
Squashed merge from master-tungsten of the following changes:
commit 73d09e18c4557e583a1684d44d598a1a02fd0cf2
Author: John Grossman <johngro@google.com>
Date: Mon Jun 20 13:57:44 2011 -0700
Remove TungstenMisc and rename LinearTransform
Change-Id: Ie8aa3e24e09fdbf6ef8996c26deb9c5640e20d1b
commit 3114aabe76ad733b59929d87e49c68229f5ae2e8
Author: John Grossman <johngro@google.com>
Date: Fri Jun 3 10:47:16 2011 -0700
Name changes and spelling fixes.
+ Replace the term TungstenTime with the Eugene-approved term CommonTime.
+ Fix a spelling error in a comment I noticed.
Change-Id: I8c10d618206826d16055f78c7724e24443bb03fd
commit cbf2903ab6893b6e662514e2f6d670e268a419df
Author: John Grossman <johngro@google.com>
Date: Fri Apr 15 09:27:54 2011 -0700
Migrate Tungsten code from the HC-Tungsten to the Master-Tungsten branch.
Change-Id: I95372d913a0761d90168edb4016f5ece0ea74502
commit bc7c46aa629f9883e959ef23de8da297f9eb508b
Author: Jason Simmons <jsimmons@google.com>
Date: Mon Jun 20 13:59:17 2011 -0700
Create a separate class for timed AudioTracks
commit 43be3231034ff8537fdd84422a7954780038671f
Author: John Grossman <johngro@google.com>
Date: Mon Jun 27 18:59:12 2011 -0700
Move libaah_rtp over from the vendor directory.
Also move factor PipeEvent out into utils.
Change-Id: Id3877c66efe22d771cf3ef4877107e431b828e37
commit 17526eb3148c9c3d4365b6d5b47e8dc13bca71b6
Author: John Grossman <johngro@google.com>
Date: Mon Jun 27 17:06:49 2011 -0700
Name changes for the TRTP Players s/tungsten/aah/g
Change-Id: I55e9ad13003f6aa6a36955b54426a7efbe31ac51
commit 423fc1bfc0fda799c421a650c83c4b9293b1a08c
Author: Jason Simmons <jsimmons@google.com>
Date: Mon Jun 20 17:56:09 2011 -0700
More timed AudioFlinger changes requested by code review:
* change trimTimedBufferQueue to trimTimedBufferQueue_l
* create one timed audio buffer heap per client process instead of one per track
* grow the silence buffer on demand
* some error handling fixes in timed getNextBuffer
* calculate the next output PTS in all mixer and track hooks
Change-Id: Ifc51a08b55029b7c48902ab2f22933ad7bafe1ad
commit a148e2674b1d3cb73289b82b85c333f0a66824a9
Author: John Grossman <johngro@google.com>
Date: Mon Jun 20 17:02:24 2011 -0700
Move the A@H time service into frameworks/base
Change-Id: I5c570cde70e8931e205516cb33517585804ce841
commit dfa438fa49bdaeeb2ec5fd0d17b30d881608b6b1
Author: John Grossman <johngro@google.com>
Date: Mon Jun 20 11:55:36 2011 -0700
Fix the build after Mike's code moving.
Change-Id: Ia883643ded252168bcc5a70584ab6ce97bb05266
commit 04489474ec8e73efe1bf52918831f41659033162
Author: John Grossman <johngro@google.com>
Date: Fri Jun 17 14:19:50 2011 -0700
Refactor the local/common clock services.
This change is one of a set of 5 changes made to different repositories. Look
for this comment in all of them.
Refactor the local/common clock services in tungsten to match android best
practice. Notable changes include
+ The kernel no longer knows anything about common time. Common time has been
moved completely up into user land. This has an impact on the accuracy of the
timesync debugging code, and the netfilter assisted approach to network based
timesync is going to have to be modified.
+ The timesync driver used by A@H is now just local time driver.
+ The kernel no longer needs access to the linear transform math code, and it
has been removed.
+ A new HAL has been introduced to expose the concept of local time to the
system.
+ A non-slewable stub implementation of the local time HAL based on
CLOCK_MONOTONIC has been added.
+ The TungstenTime library has been eliminated. Its functionality has been
distributed among the common time binder service, the local time hal and the
linear transform utility code.
+ All clients of the old TungstenTime library have been changed to be clients of
the binder service, the hal and the utility code.
+ The reset_tt utilities have been removed, they no longer have a purpose in the
system.
+ more progress has been made in eliminating the word "tungsten" from the code.
Things left to do include
+ Finish getting rid of tungsten from the time service.
+ Move the time service into the framework; AudioFlinger's new timed mode
depends on it and the service cannot continue to live in vendor tungsten.
Change-Id: I999b6cfb4a9d267818a86d747c35eecfc6693101
commit d48194545eed1116a84d81e2fb53315d2b0701a7
Author: Jason Simmons <jsimmons@google.com>
Date: Thu Jun 16 14:22:46 2011 -0700
Change the interface of the AudioMixer and AudioBufferProvider to accept a presentation timestamp
Change-Id: Ice2df5628d45a7f77100e7008103b35b3d3160a4
commit 02561419db82b01ffb28df38000716c612988427
Author: John Grossman <johngro@google.com>
Date: Tue May 10 14:00:21 2011 -0700
Put in a hack for controling master volume in the policy manager.
Fix initial master volume reporting.
Change-Id: Ia6caf2bbc6083c5f99fab852baa40fff10fc5fc7
commit 549cdc3ba115dc654cdade261fb055c72c6cdb79
Author: John Grossman <johngro@google.com>
Date: Wed May 4 11:46:17 2011 -0700
Make certain the logic for computing the output stream mixing point is hardened
against underflow and overflow when input and output sample rates don't match.
Change-Id: I5ebea07c9938107b435bec7413418622767e4e16
commit 8043d8ed63f51e76d452d22be7d453d4a7794530
Author: Jason Simmons <jsimmons@google.com>
Date: Wed Apr 27 18:06:27 2011 -0700
Add the patch for timed audio support to the mono resampler
Change-Id: I526f34ae9d1e8e3b0ed2fb05af3d024d5c5fe711
commit 2be89486ef23f0b0b0cc2dc25a4c0ee691043f00
Author: John Grossman <johngro@google.com>
Date: Wed Apr 27 10:38:57 2011 -0700
Extend the AudioHWInterface to allow it to specify the initial master volume used by AudioFlinger.
Change-Id: I8823330801c927494cf7ca31a6b8f9264fbfbb26
commit ff89a4d5e37e6a05a2b03f79ab4e97833dd66393
Author: John Grossman <johngro@google.com>
Date: Wed Apr 27 09:07:14 2011 -0700
Fix an issue with inconsistent volume reporting.
Changed masterVolume() to return the same value as the last call
to setMasterVolume when the HW layer is implementing master
volume control. The masterVolume/setMasterVolume API seems to be
an idea which was abandonded a long time ago; as of today the
system only ever sets it to 1.0 at startup and then never changes
it. Until we can figure out how the concept of external
amplifier gain control fits into the Android audio framework,
Tungsten is exposing this API via a hack-tastic invoke back door
in the TungstenRXPlayer and needs the getter/setter results to be
consistent.
Change-Id: I2ac730fa8fc9ee28c88f1a8e6f2e493eb5b65544
commit 086511b2d19cceb976747ac23e12b73fc7c28bea
Author: Jason Simmons <jsimmons@google.com>
Date: Mon Apr 25 16:07:19 2011 -0700
Add handling of timed audio tracks in the generic resampling mixer
Change-Id: Ic3be1d21b1117f1b233808be543c28a0dcec4792
Change-Id: I6ec5d2bca9b8ebc0acd395a7dd92e1a48fcdfa9b
Signed-off-by: Mike J. Chen <mjchen@google.com>
Signed-off-by: John Grossman <johngro@google.com>
Signed-off-by: Jason Simmons <jsimmons@google.com>
This change moves the ANativeWindow connect and disconnect logic from
MediaPlayer to MediaPlayerService::Client.
Bug: 5502654
Change-Id: Ifc43b98b01ad8f35d62d7ece43110724ec7fda3d
This change fixes an issue in Stagefright where the state of an OMXCodec
object can get out of sync with the state of the OMX component. In
particular, if one of the ANativeWindow functions failed and put the
OMXCodec into the ERROR state, this would cause Stagefright to skip
doing the Executing -> Idle transition. Without this transition the
freeBuffersOnPort call would never be made, and the MediaBuffers would
end up being leaked (which would also leak the Gralloc buffers they
reference).
Bug: 5333695
Change-Id: I85ea0cf92d18e7ef6d35c7d1e2a7b4e2c9745d34
Fixed problem in AudioTrack::restoreTrack_l() causing a permanent
failure if the IAudioTrack interface to AudioFlinger could not be
restored at the first attempt.
Change-Id: I039d4fe2dca8d3baf71f1a6c51119f27a67b6611
The list of directories to skip are configurable via setprop.
The main motivation is that some test data folder takes long time
to scan, and media scanner may compete for CPU time against perf
tests therefore skewing the results.
Bug: 5263115
Change-Id: I568213e2a4babf6033021c1d336ef0347c0e3315
Do not force wake up the AudioTrack thread every 10ms if no timed
events (loop, markers..) have to be processed.
This will help reduce power consumption.
Change-Id: Icb425b13800690008dd07c27ffac84739e3dbba3
The problem occurs when activating or deactivating A2DP connection
while SoudPool has a channel active. This can happen quite frequently now
that the UI sound effects are enabled by default.
If PCM data is remaining in the AudioTrack buffer when it is restroyed and
re-created on the new AudioFlinger output thread, this data is flushed.
As a consequence, no underrun or request for new data callback is sent to
SoundPool and the sound channel remains active for ever as the end of the
sample is never detected.
Change-Id: I13e0c11e4ce3f83bff7f58d347ca814b6a86712b
When the A2DP headset is connected, there is a possible
race condition when the audio tracks are moved from
the mixer thread attached to the speaker output to the thread
attached to A2DP output.
As the request to clear the stream type to output mapping cache in
the client process is asynchronous, it is possible that the flag
indicating to the client audio track to re-create the IAudioTrack
on the new thread is processed before the cache is invalidated.
In this case, the track will be attached to the old thread and
music will continue playing over the device speaker instead of being
redirected to A2DP headset.
Change-Id: Ib2ce1eb5320eaff83287b93779061bf4e7a330df
AudioTrack::stop() is not synchronous, so a stop() followed
by flush(), which is synchronous, will not always report
a playhead position of 0 after being called.
This CL adds a flag to mark a track as flushed, and report the
correct playhead position in this state.
Bug 5217011 has been created to address the real issue in the
future, where flush could be made synchronous, to properly
address bug 4364249.
Change-Id: Icf989d41a6bcd5985bb87764c287f3edb7e26d12
Before this change, CPU and memory usage for an audio effect were
registered and checked against the limit by audio policy manager
upon effect instantiation. Even if an effect was not enabled
it would prevent another effect to be created if the CPU load budget
was exceeded, which was too restrictive.
This change adds a method to register/unregister CPU load only when
an effect is enabled or disabled.
It also adds a mechanism to place all effects on the global output mix
in suspend state (disabled) when an effect is enabled on a specific session.
This will allow applications using session effects to have the priority
over others using global effects.
Also fixes some issues with suspend/restore mechanism:
- avoid taking actions when an effect is disconnected and was not enabled.
- do not remove a session from the suspended sessions list when corresponding
effect chain is destroyed.
Change-Id: I5225278aba1ae13d0d0997bfe26a0c9fb46b17d3
Don't remove effects until the session they are in goes away or all
AudioEffects have been explicitly released. This allows the control
panel process to die without stopping the effects.
Change-Id: I4496e5df080230ca1af149dec95c1309ab8ea888
the original connect/disconnect hooks are deprecated
and replace by api_connect/api_disconnect. the original
hooks are no no-ops.
api_connect/api_disconnect is now only called from the
android framework.
Bug: 5057915
Change-Id: I8ca64cd1acd6cabf915bf54689ec2e5f6dfa495a
No specific order is specified in the C++ standard, but the order of
the calls to Parcel read commands matters. Move any calls with multiple
reads to local variables.
Fix for bug 5104979.
Change-Id: I709aa040e990d2659e7a3a089f7a42ae812de9ff
AudioRecord::getInput() was issuing a query to get a new input stream from
audio policy service instead of returning the cached input stream in AudioRecord.
Change-Id: Ice324b7c60bc0898149023797bcb56a72091b9d3
Added APIs to control pre processes applied on captured audio.
Those APIs are still hidden until reviewed by API council.
Three types of standard pre processes are supported:
- Automatic Gain Control (AGC) by AutomaticGainControl class
- Acoustic Echo Cancellation (AEC) by AcousticEchoCanceler class
- Noise Suppression (NS) by NoiseSuppressor class
A method is added to AudioEffect class to query audio pre processings
applied by default by the platform on a given AudioRecord session ID.
Change-Id: I0b9fceeb8c704dd06319c3b52b85c96fe871d51d
Making a connection from MediaRecorder Native layer to the
SurfaceMediaSource for the purpose of encoding GL Frames. This will be
called from the java side inside the Mobile Filter Framework.
The mediarecorder native layer (client), when set the videosource to
option VIDEO_SOURCE_FRAMES, asks the StageFrightRecorder on the mediaserver
side to create a SurfaceMediaSource object and pass it back as a
sp<ISurfaceTexture> object. Using that, the client side will dequeue and
queue buffers. Connecting the GL Frames to the obtained
sp<ISurfaceTexture> is not part of this CL.
Related to bug id: 4529323
Change-Id: I651bec718dd5b935779e7d7a050b841c2d0b0fcd