126 Commits

Author SHA1 Message Date
Marco Nelissen
6be9c162d6 Merge "Revert "Do autodetection even if no locale was specified, and use the"" 2010-03-11 14:56:54 -08:00
Marco Nelissen
dea009ab8e Revert "Do autodetection even if no locale was specified, and use the"
This reverts commit b45b0845a6db32848ad08ac1037ef67a68ec2d39.
2010-03-11 13:37:46 -08:00
Nicolas Catania
7bd3d7d196 Allow invoke in all the player states except idle and error.
Previously invoke would work only after prepare but not
when the player is in play or pause state (for instance).
This new change just check that the player has been initialized
and is not in the error state.

Bug:2488931
Change-Id: I9b9f3679593a3b7697c1a84d993fdcd7e1693a90
2010-03-11 10:07:14 -08:00
Nicolas Catania
df2d3cdca7 Revert "Allow invoke in all the player states except idle and error."
This reverts commit 88f3b81d065d4bec6f69a25eda99158e254f55b1.
2010-03-11 08:16:26 -08:00
Nicolas Catania
88f3b81d06 Allow invoke in all the player states except idle and error.
Previously invoke would work only after prepare but not
when the player is in play or pause state (for instance).
This new change just check that the player has been initialized
and is not in the error state.

Bug:2488931

Change-Id: I7a69d1b6e3eec1e5dbdf7378ff2085329062595a
2010-03-10 16:17:30 -08:00
Marco Nelissen
e44b41bada MEDIA_PLAYER_STATE_ERROR is not a bitmask
(b/2502881)

Change-Id: I08e427eb2c36f5d70e40f9aeb8638fa8262de989
2010-03-10 10:55:09 -08:00
Eric Laurent
ba8811f552 Fix issue 2428563: Camera rendered inoperable by voice call interruption.
The problem is that AudioRecord never exits read() when a timeout occurs while trying
to get new PCM data from audio hardware input buffer: it just keeps waiting and retrying until stop() is called.
In the same time, opencore AndroidAudioInput::audin_thread_func() loop cannot be exited when stuck
in AudioRecord::read() because the iExitAudioThread flag can only be sampled when AudioRecord::read()
returns. We remain stuck with the audio input thread running.

The fix consists in modifying AudioRecord behavior in case of timeout when getting new PCM samples.
We now wait only one timeout period and try to restart audio record, in case the problem is due to a media_server
process crash. If this fails, we exit read() with a number of bytes read equals to 0 so that
AndroidAudioInput::audin_thread_func() loop can exit.

Also modified Audioflinger::RecordThread() loop so that we attempt to recover from HAL read errors.
In case of read error, the input stream is forced to standby so that next read attempt does a
reconfiguration and restart of the audio input device.
2010-03-05 11:54:23 -08:00
Eric Laurent
47d0a9264f Issue 2071329: audio track is shorter than video track for video capture on sholes
Add API to retrieve number of frames dropped by audio input kernel driver.

Submitted on behalf of Masaki Sato <masaki.sato@motorola.com>
2010-03-02 08:20:13 -08:00
James Dong
039db81d53 Merge "Don't allow MediaRecorder.setParameter() to be invoked in the following states: error, prepared or recording" 2010-02-26 18:56:22 -08:00
Marco Nelissen
465faa925d When we're in the 'playback complete' state, don't consider pausing
an error. This makes 'playback complete' essentially equivalent to
being paused at the end, and treats it the same as being paused at
any other position.
2010-02-26 13:16:23 -08:00
James Dong
61701ced74 Don't allow MediaRecorder.setParameter() to be invoked in the following states:
error, prepared or recording

bug - 2362412
2010-02-25 18:41:46 -08:00
James Dong
9b433f0b65 Image encoding settings java API through xml configuration file
- I decided to completely remove jpeg decoding related stuff from this change
  I think that setting is better off if it is specified by the system properties.
  We don't have to include MediaProfiles.h header in skia files
2010-02-24 18:10:12 -08:00
Eric Laurent
9a56aaf12b am 8978547f: am f5fe3949: Fix issue 2459650.
Merge commit '8978547f254b6b6ba2e322794aa044803f3edc2a'

* commit '8978547f254b6b6ba2e322794aa044803f3edc2a':
  Fix issue 2459650.
2010-02-22 11:19:51 -08:00
Eric Laurent
f5fe3949f5 Fix issue 2459650.
This change fixes a problem where an unwanted tone is generated by audio policy manager when a MT call is answered.
This is because of a policy that replaces high visibility system sounds (ringtones, alarms...) by a beep when in call.
There is a transitory phase while the call is being answered where the phone state is changed to IN_CALL but the
ringtone is still playing. The audio policy manager then mutes the end of the ringtone and starts playing a beep
in replacement because the ringtone is categorized as high visibility.

The fix consists in changing the ringtone stream type from high visibility to low visibility. This is not a problem as
the only actual use case where a ringtone would be generated while in call is if another call is received.
But in this case, the phone system does not generate a ringtone but a call waiting tone instead.
It is therefore not required to handle a ringtone as a high visibiltiy tone that must be somehow signaled to the user
while in call.
2010-02-22 01:37:19 -08:00
Kenny Root
7fe4fe68fa Range check in MediaScanner::processDirectory
Make sure we don't have an empty string before checking if it's a
directory since this string is tainted.

Change-Id: I5eb310ced58c3c64a7af2d11b80326efe5adbcab
2010-02-18 09:26:47 -08:00
Andreas Huber
fbb3885024 New API on java's MediaPlayer to suspend/resume a session.
related-to-bug: 2231576
2010-02-12 12:44:10 -08:00
Mathias Agopian
000479f9e3 split libsurfaceflinger_client and libcamera_client out of libui 2010-02-11 13:16:22 -08:00
Marco Nelissen
b45b0845a6 Do autodetection even if no locale was specified, and use the
detected encoding if it is unambiguous.
2010-02-10 10:36:02 -08:00
James Dong
c371194e4e Initial check-in for xml-based encoder capabilities retrieval
- Changed the Java API as suggested
- Treat /etc/media_profiles.xml as the default xml configurtion file
2010-02-01 22:38:37 -08:00
Mathias Agopian
6faf7893b6 Simplify the MemoryDealer implementation
At some point the implementation became complicated because of
SurfaceFlinger's special needs, since we are now relying on gralloc
we can go back to much simpler MemoryDealer.

Removed HeapInterface and AllocatorInterface, since those don't need
to be paramterized anymore. Merged SimpleMemory and Allocation.
Made SimplisticAllocator non virtual.

Removed MemoryDealer flags (READ_ONLY, PAGE_ALIGNED)

Removed a lot of unneeded code.
2010-01-29 14:51:06 -08:00
Andreas Huber
2564300936 API Extension: Support for optionally specifying a map of extra request headers when specifying the uri of media data to be played.
related-to-bug: 2393577

Original change by Andrei Popescu <andreip@google.com>
2010-01-28 11:52:43 -08:00
Eric Laurent
0986e7907f Fix issue 2285561: New AudioFlinger and audio driver API needed for A/V sync
Added getRenderPosition() API to IAudioFlinger to retreive number of audio frames
written by AudioFlinger to audio HAL and by DSP to DAC.

Added getRenderPosition() API to AudioHardwareInterface to retreive number of audio frames
written by DSP to DAC.

Exposed AudioTrack::getPosition() to AudioSink() to make it available to media player.

Removed excessive log in AudioHardwareGeneric.
2010-01-26 18:40:39 -08:00
Eric Laurent
23f25cda0c Fix issue 2378022: AudioService should direct volume control to STREAM_VOICE_CALL stream when STREAM_VOICE_CALL stream is active.
Modified AudioService.getActiveStreamType() so that STREAM_VOICE_CALL is selected when a track using this stream
type is playing.

Chanded isMusicActive() for a more generic isStreamActive(stream) method in AudioSystem, IAudioFlinger and AudioFlinger.
2010-01-25 14:00:10 -08:00
Eric Laurent
787aa597d4 Fix issue 2363154: Speech synthesis fails to start over A2DP after media server process crash.
The problem is that after a media_server crash, the value of the A2DP output handle can change.
As this value is cached in AudioSystem for all client processes there can be a mismatch between the cached
and actual value after a media_server restart.

The fix consists in clearing the cached output handles and output to stream map values cached
in AudioSystem in AudioFlingerClient::binderDied() which is called when the media_server crashes.
2010-01-25 10:27:15 -08:00
Andreas Huber
c712b9fe28 Fix no-copy-overhead OMXCodec implementation to actually work. 2010-01-20 15:05:46 -08:00
Andreas Huber
cb6ffa2824 Merge "Avoid unnecessary buffer copying if at all possible, detect if running in the mediaserver process." 2010-01-19 11:43:12 -08:00
Andreas Huber
f1fe064d73 Avoid unnecessary buffer copying if at all possible, detect if running in the mediaserver process. 2010-01-19 10:57:57 -08:00
James Dong
34bbc22cbc Media server death nodification 2010-01-15 18:28:16 -08:00
Andreas Huber
e4a838051d Reorganize some of the stagefright implementation related to metadata. 2010-01-08 11:54:36 -08:00
Andreas Huber
2ea14e2319 Squashed commit of the following:
commit 144b1c40e9cf08a584c50e1bef7ba3f287e81a4f
Author: Andreas Huber <andih@google.com>
Date:   Wed Dec 16 09:28:23 2009 -0800

    This H264 file shows a certain problem even better.

commit 3245f1f3b7471975aeeb824a756c987abd610f55
Author: Andreas Huber <andih@google.com>
Date:   Wed Dec 16 09:20:08 2009 -0800

    Using only the QA testfiles now.

commit 074817eb3816c5dd70858a3594e3b92d799d873b
Author: Andreas Huber <andih@google.com>
Date:   Tue Dec 15 16:17:39 2009 -0800

    Yay, roles are back again now that the API is in place.

commit 6d847e4932cc38301ae27cb7283b7f1553a95457
Author: Andreas Huber <andih@google.com>
Date:   Tue Dec 15 13:01:20 2009 -0800

    Added commandline option for specifying the random seed for reproducable tests.

commit 62ab37b26336eaa67e49791c41c996acb6acee3f
Author: Andreas Huber <andih@google.com>
Date:   Mon Dec 14 10:53:27 2009 -0800

    When issuing a seek it is important that only the first MediaSource::read call has the seek option.

commit e77c46644b2fb6862bafa3569f7d304252074f1e
Author: Andreas Huber <andih@google.com>
Date:   Mon Dec 7 16:39:07 2009 -0800

    Make sure the tests are actually built, sp<OMXCodec> becomes sp<MediaSource>

commit 6df56915bd55a9445b3c6f953d3cc251d81579b8
Author: Andreas Huber <andih@google.com>
Date:   Thu Dec 3 14:25:36 2009 -0800

    Temporarily disable support for querying the roles of OMX components.

commit 31bb26930df9e3658dea684cedb4b0f1a06a4a88
Author: Andreas Huber <andih@google.com>
Date:   Tue Dec 1 13:36:52 2009 -0800

    Disregard EOS events, slightly change the way the EOS flag on output buffers is handled.

commit 4c382fbc9aebee8197d5988d04378062809e7c48
Author: Andreas Huber <andih@google.com>
Date:   Tue Dec 1 09:37:24 2009 -0800

    New random seek test for the codec tests. Fixed "sticky" end-of-output-buffers flag behaviour in OMXCodec.

commit c762eac3e44309592b61a168d66e091cf609fa03
Author: Andreas Huber <andih@google.com>
Date:   Tue Nov 3 14:13:43 2009 -0800

    Fix a typo.

commit 50540a59b65c7d476b0193c7494cd75895e6ca6d
Author: Andreas Huber <andih@google.com>
Date:   Tue Nov 3 09:48:35 2009 -0800

    Some more fine tuning of the unit tests, make MPEG4Extractor less verbose.

commit 1157a7e52a0636706caa235abe16d2ff8a0b8140
Author: Andreas Huber <andih@google.com>
Date:   Wed Oct 28 12:01:01 2009 -0700

    Changes to the IOMX::listNodes API, this now returns the component's roles as well, unit tests now test all components in all supported roles by default.

commit 30fbf2d8c6cb927689f7ba75eb550a81e9df488a
Author: Andreas Huber <andih@google.com>
Date:   Mon Oct 26 09:45:26 2009 -0700

    Initial check-in of unit tests for OMX components.
2009-12-17 09:28:15 -08:00
Eric Laurent
b8341cf7c8 am 6d42d806: Merge change I9cc489a2 into eclair
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.
2009-12-07 11:03:17 -08:00
Eric Laurent
9cc489a219 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.
2009-12-07 05:37:47 -08:00
Android (Google) Code Review
104d3f755e Merge change I6c84d731 into eclair-mr2
* changes:
  Media/ToneGenerator: Change tone format for TONE_CDMA_ANSWER
2009-12-03 20:03:59 -08:00
Andreas Huber
1f1c7bad42 I accidentally broke this code while refactoring MediaScanner. This is the fix. 2009-12-03 15:45:53 -08:00
Andreas Huber
bfb9fb143b Refactor MediaScanner. Some steps on the way towards being able to build the tree without OpenCore. 2009-12-03 13:21:54 -08:00
Naveen Kalla
6c84d7313e Media/ToneGenerator: Change tone format for TONE_CDMA_ANSWER
Tone format for TONE_CDMA_ANSWER should be 660Hz + 1000Hz, with a 500ms ON
duration.
2009-12-03 12:17:18 -08:00
Dave Sparks
1e914ac7fc am 16cc72bd: Fix simulator build.
Merge commit '16cc72bdef471ffeee3f61eba8262783de248b04' into eclair-mr2

* commit '16cc72bdef471ffeee3f61eba8262783de248b04':
  Fix simulator build.
2009-11-23 19:58:33 -08:00
Dave Sparks
ebcb7c3167 am 8424ec32: Merge change I0f9a53d4 into eclair
Merge commit '8424ec323b2bc38887370c75e2c1fcd84bcdb013' into eclair-mr2

* commit '8424ec323b2bc38887370c75e2c1fcd84bcdb013':
  Set metadata retriever thread group to the caller's group.
2009-11-23 19:58:00 -08:00
Dave Sparks
16cc72bdef Fix simulator build. 2009-11-23 19:51:33 -08:00
Dave Sparks
0f9a53d499 Set metadata retriever thread group to the caller's group.
This patch modifies the native binder interface to the metadata
retriever to pass the caller's thread group across the binder
interface. On the server side, the thread scheduler group is
set to the caller's scheduler group temporarily and restored
after the request has completed. This patch also reverts a
previous patch where the priority of the thread was forced to
a low priority foreground thread.

This should give apps more control over the priority of their
metadata retrieval, particularly allow background process to
run without hogging the CPU.
2009-11-23 16:51:15 -08:00
Eric Laurent
949c572a16 am e7800946: Merge change I49f02be9 into eclair
Merge commit 'e7800946a42c0ebe8e0b3f6eba04a96a9641aaff' into eclair-mr2

* commit 'e7800946a42c0ebe8e0b3f6eba04a96a9641aaff':
  Issue 2265163: Audio still reported routed through earpiece on sholes
2009-11-21 00:21:15 -08:00
Eric Laurent
49f02be9d7 Issue 2265163: Audio still reported routed through earpiece on sholes
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.
2009-11-19 23:57:45 -08:00
Eric Laurent
6efdbcc3c1 am fddfb9ae: Merge change Iad79689a into eclair
Merge commit 'fddfb9ae03a2730ac5ce27fa4c47b7d3a0285d0f' into eclair-mr2

* commit 'fddfb9ae03a2730ac5ce27fa4c47b7d3a0285d0f':
  Improvements for issue 2197683:	English IME key-press latency is noticeably higher on passion than sholes
2009-11-12 23:10:34 -08:00
Eric Laurent
059b4be2a5 Improvements for issue 2197683: English IME key-press latency is noticeably higher on passion than sholes
This change goes with a kernel driver change that reduces the audio buffer size from 4800 bytes (~27ms) to 3072 bytes (~17ms).
- The AudioFlinger modifcations in change 0bca68cfff161abbc992fec82dc7c88079dd1a36 have been removed: the short sleep period was counter productive when the AudioTrack is using the call back thread as it causes to many preemptions.
- AudioFlinger mixer thread now detects long standby exit time and in this case anticipates start by writing 0s as soon as a track is enabled even if not ready for mixing.
- AudioTrack::start() is modified to start call back thread before starting the IAudioTrack so that thread startup time is masked by IAudioTrack start and mixer thread wakeup time.
2009-11-11 12:13:27 -08:00
Andreas Huber
dcaa220ff5 DO NOT MERGE: Squashed commit of the following:
commit 08259dd3dc9026887f9bbfedaf45866eb56ea9bc
Author: Andreas Huber <andih@google.com>
Date:   Thu Nov 5 12:02:31 2009 -0800

    DO NOT MERGE: Use PV for metadata extraction even if stagefright is used for playback.

commit 991832fe4dc012e51d3d9ed8d647c7f09991858f
Author: Andreas Huber <andih@google.com>
Date:   Thu Nov 5 11:24:11 2009 -0800

    DO NOT MERGE: Do not assert if we encounter OMX_StateInvalid. All bets are off though.

commit cec45cf302d9218fe79956cbe8a462d7ca3a10bb
Author: Andreas Huber <andih@google.com>
Date:   Mon Oct 26 16:11:54 2009 -0700

    DO NOT MERGE: When freeing an OMX node, attempt to transition it from its current state all the way to "Loaded" in order to properly free any allocated buffers.

commit 34a1e885ef9113d68acbc26d36fcc47fdebbed84
Author: Andreas Huber <andih@google.com>
Date:   Thu Nov 5 11:10:49 2009 -0800

    DO NOT MERGE: Fix heap corruptin in OMXNodeInstance.

commit 5a47f7439a1298b330541a7e4e647a8b44487388
Author: Andreas Huber <andih@google.com>
Date:   Thu Nov 5 11:08:19 2009 -0800

    DO NOT MERGE: Fix seek-on-initial-read behaviour of OMXCodec.

commit 45bed64722501b9f411a2940aff5aff4cc4d2e98
Author: Andreas Huber <andih@google.com>
Date:   Thu Nov 5 11:02:23 2009 -0800

    DO NOT MERGE: Renaming string.h to stagefright_string.h to avoid conflicts.

commit 6738e306a50196f31a73d4fc7b7c45faff639903
Author: Andreas Huber <andih@google.com>
Date:   Thu Oct 15 13:46:54 2009 -0700

    DO NOT MERGE: Reimplement the OMX backend for stagefright.

    Besides a major cleanup and refactoring, OMX is now a singleton living in the media server, it listens for death notifications of node observers/clients that allocated OMX nodes and performs/attempts cleanup.

    Changed APIs to conform to the rest of the system.
2009-11-05 13:06:17 -08:00
Eric Laurent
fcae6c7179 am 67b69292: Merge change I93f500a5 into eclair
Merge commit '67b692920c18f99b096dce285adc6f7439fa866c' into eclair-mr2

* commit '67b692920c18f99b096dce285adc6f7439fa866c':
  Fix issue 2203561: Sholes: audio playing out of earpiece.
2009-11-05 00:01:33 -08:00
Eric Laurent
bda7469d9b Fix issue 2203561: Sholes: audio playing out of earpiece.
Create a new IAudioTrack interface to AudioFlinger when start() fails due to a broken pipe error.
Do the same if start fails due to the same error after time out in obtainBuffer().
Do not indicate that the AudioTrack is started to AudioPolicyManager if IAudioTrack start fails.
This avoids that an AudioTrack keeps a dead IAudioTrack after a media server crash.

Same modifications for AudioRecord.

Add a flag to ToneGenerator indicating that the callback thread can call Java. Without it, when the media server crashes and restarts, the AudioSystem error callback will crash in JNI if the IAudiotrack is created from AudioTrack callback thread.
2009-11-04 23:47:21 -08:00
Eric Laurent
7ed70c9515 am bf96aaad: Merge change Icf10db28 into eclair
Merge commit 'bf96aaadd46fb5b0884070177faa16ec4f22e2ba' into eclair-mr2

* commit 'bf96aaadd46fb5b0884070177faa16ec4f22e2ba':
  Fix issue 2192181: AudioFlinger must provide separated methods to set VOICE_CALL stream volume and down link audio volume.
2009-10-24 01:38:58 -07:00
Android (Google) Code Review
bf96aaadd4 Merge change Icf10db28 into eclair
* changes:
  Fix issue 2192181: AudioFlinger must provide separated methods to set VOICE_CALL stream volume and down link audio volume.
2009-10-24 04:32:28 -04:00
Eric Laurent
470687e251 am dd28d563: Fix 2209967 Tonegenerator: mutex not release in startTone() upon timeout waiting for the stop sequence to complete.
Merge commit 'dd28d56368441537ec5eb42150516416fdbf10ad' into eclair-mr2

* commit 'dd28d56368441537ec5eb42150516416fdbf10ad':
  Fix 2209967 Tonegenerator: mutex not release in startTone() upon timeout waiting for the stop sequence to complete.
2009-10-23 08:27:11 -07:00