• Home
  • History
  • Annotate
  • only in /frameworks/ex/variablespeed/tests/src/com/android/ex/variablespeed/
History log of /frameworks/ex/variablespeed/tests/src/com/android/ex/variablespeed/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
64f5ba670d215847192b4ff46dc4538565f2f551 10-Aug-2011 Hugo Hudson <hugohudson@google.com> Fix a rare crash.

- Crash could be reproduced by seeking to the very end of a voicemail,
playing the voicemail to see the ui reset to beginning, then
increasing rate.
- Reason was that during playback, insufficient data has been read to
read the sample rate and channels, and in that situation the increase
rate requires constructing the time scaler, which in turn requires
a valid sample rate and channels.
- Added a test to prove that the bug exists, and to prove the fix which
is to ignore the rate change call when sample rate and channels not
known.
- Also added another unit test in the process to verify that it's safe
to call set rate at any point during the life cycle of the player.

Bug: 5140693
Change-Id: I474e5769f2b72762348534e4d06104af247e8726
ediaPlayerProxyTestCase.java
5f65e43cf103514ddb69abca7cc78dfe99cd329c 09-Aug-2011 Hugo Hudson <hugohudson@google.com> Prove that there's an issue with media player audio.

- File format of files downloaded from GoogleVoice:
MPEG ADTS, layer III, v2.5, 32 kbps, 8 kHz, Monaural
- If we seek in that file before beginning playback, there is a very
obvious triple/quadruple stutter.
- This adds a unit test that plays such a file after seeking, which
clearly demonstratest the stutter on my variable speed library.
- This same test can be used to demonstrate the stutter with the regular
MediaPlayer.

Other:
- Also adds the correct ADD_VOICEMAIL permission, which was renamed
earlier.

Bug: 5114126
Change-Id: I3dfaf7686c879076d9949047d91875010b6d8b52
ediaPlayerProxyTestCase.java
0bd6ec5bc06b869131ee0facf38ff02f81f65c10 26-Jul-2011 Hugo Hudson <hugohudson@google.com> Playback now handles any sample rate and channel combo.

Main stuff
- Delayed construction of audio player until after sample rate and
channels have been read from the first callback.
- Removed all sample rate and channels from outward facing api.
- Remove pause playing and prefetch duration and sample rate hacky code.
- Fixes handling of any sample rate by removing switch statement.
- Fixes a HORRIBLE bug introduced in last cl where I was creating the
callback context on the stack inside a method call, and using it a
pointer to it long after the object had been erased from the stack.
[worse yet: it still mostly worked fine!]

Other
- Fixes an obvious failure case of all tests - duh - I was calling setUp()
before setting the executor properly, so they were giving NPEs.
- Correct calculation of totalDuration now done on first decode callback.
- This will let us remove MediaPlayer from prepare() in follow up.
- Initializing the engine outside of the PlaybackRunnable, is cleaner.
- Adds static methods for reading duration and position, again so that
follow up can have accurate get current position rather than best guess.
- Buffers in use for decoding also not created until first decode callback.
- Introduces some wicked-cool OpenSL macro to log api calls, make the
api calls and check the result value.

Bug: 5048252
Bug: 5048257
Change-Id: I60705fa6c6ab29a35740f22bef76450e8c1d25a2
ariableSpeedTest.java
9730f15ebbf4b64cd48e0777850e56cb516a9ed4 25-Jul-2011 Hugo Hudson <hugohudson@google.com> Adds tests for Variable Speed code.

The test changes:
- Adds many, many test cases against a MediaPlayerProxy, checking that
it behaves to the contract of a MediaPlayer.
- Adds the RealMediaPlayer class to check a real MediaPlayer.
- Adds the VariableSpeed class, to check a VariableSpeed instance
against the same contract as the MediaPlayer.
- Adds an Android.mk for the unit tests.
- Adds also an AndroidManifest.xml for the unit tests.
- Adds some test asset media files (3gpp file and mp3 file).

Required for the test changes:
- Adds a DynamicProxy class to adapt a MediaPlayer as a
MediaPlayerProxy class, i.e. to test the implementation of
MediaPlayerProxy, required to avoid writing an adapter.
- Adds a couple of listeners, OnErrorListener and
OnCompletionListener, that can be waited for synchronously in unit
tests.

Improvements as a result of the tests:
- During the testing, fixes the case where we weren't throwing
IllegalStateException if asked for the duration on released player.
- Refactored the create engine, create and realize output mix, create
and realize audio player, get play interfaces and callbacks, all
separated into their own static methods.
- This allows me to create the audio player during the main while loop
actually after the decoding has begun rather than before starting.
This work is a precursor to using the decoder's report on sample rate
and channels as the input to these methods.
- slSampleRate and slOutputChannels no longer computed in the
constructor, but computed when needed in the construction and
realization of the audio player.

Other changes:
- Remove some overly verbose logs on getDuration() and
getCurrentPosition().
- Adding the decoder interface to the callback.
- Extract metadata from decoder method now takes the metadata
interface, so this will be usable from the decoder callack in a follow
up.
- Temporarily stop getting the metadata out of the decoder, I'm going
to be doing it on the decoding callback instead.
- Renames the comment in AndroidManifest.xml to describe the
correct invocation to run the common tests.

Bug: 5048252
Bug: 5048257
Change-Id: Icdc18b19ef89c9924f73128b70aa4696b4e727c5
waitableCompletionListener.java
waitableErrorListener.java
ynamicProxy.java
ediaPlayerProxyTestCase.java
ealMediaPlayerTest.java
ariableSpeedTest.java