843 Commits

Author SHA1 Message Date
Eric Laurent
9bc8358dda audio framework: manage stream volume per device
Improve volume management by keeping track of volume for each type
of device independently.
Volume for each stream (MUSIC, RINGTONE, VOICE_CALL...) is now maintained
per device.

The main changes are:
- AudioService now keeps tracks of stream volumes per device:
 volume indexes are kept in a HashMap < device , index>.
 active device is queried from policy manager when a volume change request
 is received
 initalization, mute and unmute happen on all device simultaneously
- Settings: suffixes is added to volume keys to store each device
volume independently.
- AudioSystem/AudioPolicyService/AudioPolicyInterface: added a device argument
to setStreamVolumeIndex() and getStreamVolumeIndex() to address each
device independently.
- AudioPolicyManagerBase: keep track of stream volumes for each device
and apply volume according to current device selection.

Change-Id: I61ef1c45caadca04d16363bca4140e0f81901b3f
2012-01-17 15:15:04 -08:00
Glenn Kasten
fb6b5bdcea Merge "Use audio_mode_t consistently" 2012-01-17 11:32:53 -08:00
Glenn Kasten
55fa4fb4a7 Rename Visualizer::mLock
This avoids confusion with parent class AudioEffect's mLock which is
protected.

Change-Id: I2ae0b0869fe3c606f682252973795b34477951d0
2012-01-17 10:06:38 -08:00
Glenn Kasten
8c17a2f088 Merge "Use size_t for frame size" 2012-01-17 07:27:46 -08:00
Glenn Kasten
faf354dc7f Use size_t for frame size
except in the control block, where we don't have room.

In AudioFlinger::ThreadBase::TrackBase::getBuffer,
read the frame size from control block only once.

Change-Id: Id6c4bccd4ed3e07d91df6bbea43bae45524f9f4e
2012-01-13 14:58:44 -08:00
Glenn Kasten
bc1d77b6cb Use audio_stream_type_t consistently
At native level it was a mixture of audio_stream_type_t, int, uint32_t,
and uint8_t.  Java is still int.  Also fixed a couple of hard-coded -1
instead of AUDIO_STREAM_DEFAULT, and in startToneCommand a hard-coded 0
instead of AUDIO_STREAM_VOICE_CALL.

Change-Id: Ia33bfd70edca8c2daec9052984b369cd8eee2a83
2012-01-13 10:20:14 -08:00
James Dong
b5c6ff5993 Merge "Separate sniffing from session initialization" 2012-01-12 16:56:58 -08:00
James Dong
d1ba6ed945 Separate sniffing from session initialization
This avoid lengthy/duplicate sniffing for drm plugins when a decrypt session is opened

o The change is backward compatibile in that no update is required
  for existing drm plug-ins if they do not plan to provide separate
  sniffer/extractor

related-to-bug: 5725548

Change-Id: I7fc4caf82d77472da4e2bc7b5d31060fb54fd84c
2012-01-12 16:25:12 -08:00
Glenn Kasten
1c66547ba2 Merge "Use audio_format_t consistently" 2012-01-12 10:30:28 -08:00
Glenn Kasten
accb114e59 Use audio_mode_t consistently
It was int or uint32_t.
Also make getMode() const.

Change-Id: Ibe45aadbf413b9158e4dd17f2b3bcc6355288d37
2012-01-12 09:52:37 -08:00
Glenn Kasten
c57b063192 Merge "Fix bug in JetPlayer::loadFromFile" 2012-01-11 11:39:06 -08:00
Glenn Kasten
f733831fc7 Merge "Declare IAudioTrack methods in binder opcode order" 2012-01-11 10:23:34 -08:00
Glenn Kasten
77b6aaf62d Fix bug in JetPlayer::loadFromFile
A long pathname would corrupt the heap due to incorrect use of strncpy.

Also was using hard-coded constant 256 instead of PATH_MAX.

Change-Id: Iba382bbb38624fbc41fec91449f9814f77d4ac0d
2012-01-10 15:43:24 -08:00
Glenn Kasten
798ef8e882 Declare IAudioTrack methods in binder opcode order
This makes it easier to match up the declarations.

Change-Id: I0996c20b2903b778b356dfe52b07b0ec634855dd
2012-01-06 13:35:57 -08:00
Glenn Kasten
1c5a89d4af Use audio_format_t consistently
Was int, uint32_t, uint16_t, and uint8_t with 2-bit bitfield.
Also replace 0 by AUDIO_FORMAT_DEFAULT and replace 1 by
AUDIO_FORMAT_PCM_16_BIT.

Change-Id: Ia8804f53f1725669e368857d5bb2044917e17975
2012-01-05 13:34:54 -08:00
Glenn Kasten
e6810ffaa1 Clean up AudioTrack::mActive and stopped()
mActive is protected by mLock; volatile is meaningless on SMP.

Fixed a couple of places where mActive was accessed without a lock:
 - stopped()
 - processAudioBuffer()

Added stopped_l() for cases where we already hold the lock.

Made mActive a bool not int.

Moved down a lock in setPosition that was being acquired too early.

Change-Id: I73ff368e991c0db9f9472df0b3f96fd33fcc7311
2012-01-05 11:55:24 -08:00
Glenn Kasten
e5fb263a36 Audio C++ comments
Change-Id: I84906ebb9dfcfa5b96b287d18364b407f02a30c1
2011-12-14 14:38:26 -08:00
Andreas Huber
e7b3e09a5e am 52607c53: am d12dc284: Merge "If an error occurs that prevents us from reallocating buffers during a format change" into ics-mr1
* commit '52607c5364446df6ac5b2f55cb50e146e6023a4f':
  If an error occurs that prevents us from reallocating buffers during a format change
2011-11-29 16:33:04 -08:00
Andreas Huber
848bffd8fa am 074133b2: am 351143fb: Merge "Updated (internal) API for IStreamSource to signal discontinuities" into ics-mr1
* commit '074133b260f8d12e484e93b9aa5a33a4983b7349':
  Updated (internal) API for IStreamSource to signal discontinuities
2011-11-29 16:33:02 -08:00
Andreas Huber
d12dc28460 Merge "If an error occurs that prevents us from reallocating buffers during a format change" into ics-mr1 2011-11-29 14:09:03 -08:00
Andreas Huber
a10613fea8 Updated (internal) API for IStreamSource to signal discontinuities
Change-Id: Idd4b9d8e7cec16b3e3c91c70e75144d42be30f96
related-to-bug: 5553055
2011-11-29 11:59:10 -08:00
Glenn Kasten
589364c717 Merge "Make AudioTrack a RefBase so wrappers not needed" 2011-11-28 14:54:28 -08:00
Andreas Huber
d03e7d62d5 If an error occurs that prevents us from reallocating buffers during a format change
we need to transition to executing state anyway to be able to properly flush/shutdown
in the future.

Change-Id: Ie48bc09ea31942009ae3a5a45aabc9ffad9fb91f
related-to-bug: 5655016
2011-11-28 10:54:12 -08:00
Andreas Huber
72a845d539 am 31626b30: am cb6fbc89: Merge "Report a runtime error instead of asserting on malformed avc configuration data." into ics-mr1
* commit '31626b3075335f4cf579342e99436bb45870cf55':
  Report a runtime error instead of asserting on malformed avc configuration data.
2011-11-22 08:43:28 -08:00
Andreas Huber
cb6fbc89c2 Merge "Report a runtime error instead of asserting on malformed avc configuration data." into ics-mr1 2011-11-22 08:39:11 -08:00
James Dong
4e2ecdd8a7 am d0a25456: am 02740dc4: Merge "Fix log spamming during time lapse video recording" into ics-mr1
* commit 'd0a254566f5f0be5607b4d64839a575c888c94f6':
  Fix log spamming during time lapse video recording
2011-11-21 21:08:55 -08:00
James Dong
96af14d9b0 Fix log spamming during time lapse video recording
Change-Id: I4fc0809203684ebb02eaf217d7abad00aefc898f

related-to-bug: 5626569
2011-11-21 12:09:51 -08:00
Andreas Huber
0ba8660ea6 Report a runtime error instead of asserting on malformed avc configuration data.
Change-Id: Ibcd9c3fb5b6532eba843ed80ecdcdacaf50d8845
related-to-bug: 5641069
2011-11-18 12:22:59 -08:00
Glenn Kasten
b447e9ce1d Merge "JetPlayer uses C++ Thread not createThreadEtc" 2011-11-17 07:14:29 -08:00
Glenn Kasten
9c0227a63c JetPlayer uses C++ Thread not createThreadEtc
This permits leveraging future improvements to Thread.

Change-Id: I60deed8565ed54f13d9f770c76504e411b154276
2011-11-16 15:25:30 -08:00
Glenn Kasten
99d544332a Bug 4903178 Restore priority and cgroup on stop
On AudioTrack and AudioRecord stop or failed start, restore the priority
and cgroup of the caller to their previous values, rather than forcing
to NORMAL.  Dependent on new thread APIs.

Also fixes bug where priority was set to AUDIO but cgroup not set.

Change-Id: Ib83893918fb4fdf57c6b87884b51038997a631d8
2011-11-16 14:52:55 -08:00
Glenn Kasten
9c151c58cb Make AudioTrack a RefBase so wrappers not needed
Change-Id: I2305abe586ac41251af04a194bc818c110a1b293
2011-11-15 14:26:09 -08:00
Hong Teng
481ffa505b Merge "Fix for issue 5309336 -add videoeditor maximum prefetch YUV frames in media_profiles.xml to limit the total memory usage." into ics-mr1 2011-11-15 09:42:37 -08:00
Hong Teng
7eb5319703 Fix for issue 5309336
-add videoeditor maximum prefetch YUV frames in media_profiles.xml to limit the total memory usage.

Change-Id: I41ffbc192fcce4c7635e5b0a1f2835852e5ee509
2011-11-14 13:02:59 -08:00
James Dong
77c500c9a1 Add support for retrieving location information in mp4/3gpp files
Change-Id: Ib8427704ef9ee5a4fa8fe1818c8a62d77b4ea687
related-to-bug: 5560253
2011-11-10 11:40:11 -08:00
Andreas Huber
95be24585f Remove surface legacy APIs and code.
All surfaces are now supported through surface textures.

Change-Id: I95dd823e7099c0c32a48a1121624149dcc29d9c6
2011-10-28 09:39:23 -07:00
Jamie Gennis
fc9592f8a5 am 08479cee: Merge "Stagefright: ANW::connect in MediaPlayerService" into ics-mr0
* commit '08479ceeba56c460fb52f60a24df27776f1936c3':
  Stagefright: ANW::connect in MediaPlayerService
2011-10-28 02:14:01 +00:00
Jamie Gennis
2fa0ac2e44 Stagefright: ANW::connect in MediaPlayerService
This change moves the ANativeWindow connect and disconnect logic from
MediaPlayer to MediaPlayerService::Client.

Bug: 5502654
Change-Id: Ifc43b98b01ad8f35d62d7ece43110724ec7fda3d
2011-10-26 18:40:00 -07:00
Jamie Gennis
5ded5fc55f am b7b4eaaa: Merge "Stagefright: push blank buffers when tearing down" into ics-mr0
* commit 'b7b4eaaa05284634d50d581d924a250f1194f66d':
  Stagefright: push blank buffers when tearing down
2011-10-26 20:34:38 +00:00
Jamie Gennis
c0e4293794 Stagefright: push blank buffers when tearing down
This change makes OMXCodec push RGB 565 buffers filled with black to an
ANativeWindow when tearing down after decoding to protected gralloc
buffers.  This allows the OMX tear down to zero out any protected
buffers that were used without the possibility that the buffer is still
being used by SurfaceFlinger or HWComposer.

Bug: 5483222
Change-Id: I8acedd81a7bb67dfdc2fd15733e3375b6ce8d560
2011-10-25 18:35:02 -07:00
Dave Burke
149a14931e am 23d64420: Merge "Stagefright: idle OMX after ANW errors" into ics-mr0
* commit '23d644202a44383bf008ff86f6faa3ea7e447290':
  Stagefright: idle OMX after ANW errors
2011-10-19 22:38:45 -07:00
Jamie Gennis
6607b39baa Stagefright: idle OMX after ANW errors
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
2011-10-19 21:22:19 -07:00
Andreas Huber
0eb6ef1798 Merge "Support for an MPEG2 Program Stream extractor." 2011-10-13 10:03:26 -07:00
Lakshman Gowda
db62a245f9 Set crop params to ANative Window during Initialization.
The native_window_set_crop() is called when port reconfig event callback comes from decoder's and
crop parameters are changed from default getconfig() OMX_IndexConfigCommonOutputCrop values.
Since the default crop params are same as port reconfig crop params, the native_window_set_crop()
is not called, hence resulting in displaying the whole frame(paddedWidth x paddedHeight).
By calling native_window_set_crop() during initilaization of output port of decoder ensures
in setting up ANative window to crop region.

Change-Id: I68926464a1f5c7e6053804615c8b9bd32ea85688
Signed-off-by: Lakshman Gowda <lakshman79@ti.com>
2011-10-05 10:29:27 -07:00
Andreas Huber
bc55495612 Support for an MPEG2 Program Stream extractor.
Change-Id: I606d87c278f72b22a5b6d7ee57bce6b02e280d41
2011-09-30 15:26:31 -07:00
Gilles-Arnaud Bleu-Laine
9a6ed36ba5 Gracefuly return on detecting wrong AAC format from corrupted files
Return BAD_VALUE error upon detection of wrongly formatted files.
The client should abort the initialization upon error detection.

The current CHECK() interrupts the configurecodec() preventing a graceful
exit.

Change-Id: Ic79313fa76a63284897df5d91635de87d06f3100
Signed-off-by: Gilles-Arnaud Bleu-Laine <gilles@ti.com>
2011-09-30 10:46:12 -07:00
Andreas Huber
3e408f39ef Support AMR, G.711 and vorbis audio in ACodec and friends.
Change-Id: I08c03219bf2d60fc5c6e89957bd4b4c615570983
2011-09-28 12:37:36 -07:00
Andreas Huber
928baf1f54 Propagate error signalled by the source all the way to the output EOS notification.
Change-Id: I30e959a6d669f09745c59fbdebee08f869511cf7
related-to-bug: 5372901
2011-09-26 10:53:29 -07:00
James Dong
07b9ae3312 Add QVGA resolution to CamcorderProfile
Change-Id: Icebbafb68d8164370f98a2c36699845d10ef081b
related-to-bug: 5145483
2011-09-19 19:32:26 -07:00
James Dong
1318864fa7 Merge "Change an assert failure due to unsupported level by HW AVC decoder and report the error to applications" 2011-09-14 17:42:22 -07:00