summaryrefslogtreecommitdiffstats
path: root/media/libmedia/JetPlayer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'media/libmedia/JetPlayer.cpp')
-rw-r--r--media/libmedia/JetPlayer.cpp19
1 files changed, 5 insertions, 14 deletions
diff --git a/media/libmedia/JetPlayer.cpp b/media/libmedia/JetPlayer.cpp
index fa5b67a..8456db5 100644
--- a/media/libmedia/JetPlayer.cpp
+++ b/media/libmedia/JetPlayer.cpp
@@ -91,7 +91,7 @@ int JetPlayer::init()
mAudioTrack = new AudioTrack();
mAudioTrack->set(AUDIO_STREAM_MUSIC, //TODO parametrize this
pLibConfig->sampleRate,
- 1, // format = PCM 16bits per sample,
+ AUDIO_FORMAT_PCM_16_BIT,
(pLibConfig->numChannels == 2) ? AUDIO_CHANNEL_OUT_STEREO : AUDIO_CHANNEL_OUT_MONO,
mTrackBufferSize,
0);
@@ -100,7 +100,8 @@ int JetPlayer::init()
{
Mutex::Autolock l(mMutex);
ALOGV("JetPlayer::init(): trying to start render thread");
- createThreadEtc(renderThread, this, "jetRenderThread", ANDROID_PRIORITY_AUDIO);
+ mThread = new JetPlayerThread(this);
+ mThread->run("jetRenderThread", ANDROID_PRIORITY_AUDIO);
mCondition.wait(mMutex);
}
if (mTid > 0) {
@@ -156,12 +157,6 @@ int JetPlayer::release()
//-------------------------------------------------------------------------------------------------
-int JetPlayer::renderThread(void* p) {
-
- return ((JetPlayer*)p)->render();
-}
-
-//-------------------------------------------------------------------------------------------------
int JetPlayer::render() {
EAS_RESULT result = EAS_FAILURE;
EAS_I32 count;
@@ -173,10 +168,6 @@ int JetPlayer::render() {
// allocate render buffer
mAudioBuffer =
new EAS_PCM[pLibConfig->mixBufferSize * pLibConfig->numChannels * MIX_NUM_BUFFERS];
- if (!mAudioBuffer) {
- ALOGE("JetPlayer::render(): mAudioBuffer allocate failed");
- goto threadExit;
- }
// signal main thread that we started
{
@@ -343,8 +334,8 @@ int JetPlayer::loadFromFile(const char* path)
Mutex::Autolock lock(mMutex);
mEasJetFileLoc = (EAS_FILE_LOCATOR) malloc(sizeof(EAS_FILE));
- memset(mJetFilePath, 0, 256);
- strncpy(mJetFilePath, path, strlen(path));
+ strncpy(mJetFilePath, path, sizeof(mJetFilePath));
+ mJetFilePath[sizeof(mJetFilePath) - 1] = '\0';
mEasJetFileLoc->path = mJetFilePath;
mEasJetFileLoc->fd = 0;