summaryrefslogtreecommitdiffstats
path: root/media/libmediaplayerservice
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2010-06-24 19:55:31 -0700
committerJames Dong <jdong@google.com>2010-06-24 21:59:25 -0700
commitd3d4e5069e1af0437c4f5a7b4ba344bda5b937af (patch)
tree596bf02fa9495c743c1069ecb99b5f134afac850 /media/libmediaplayerservice
parent47c778f4a5fa639b2082fcc74080d33ac847b232 (diff)
downloadframeworks_av-d3d4e5069e1af0437c4f5a7b4ba344bda5b937af.zip
frameworks_av-d3d4e5069e1af0437c4f5a7b4ba344bda5b937af.tar.gz
frameworks_av-d3d4e5069e1af0437c4f5a7b4ba344bda5b937af.tar.bz2
Track maximum amplitude and fix getMaxAmplitude()
- only start to track the max amplitude after the first call to getMaxAmplitude() Change-Id: I64d3d9ca0542202a8535a211425e8bccceca50fc
Diffstat (limited to 'media/libmediaplayerservice')
-rw-r--r--media/libmediaplayerservice/StagefrightRecorder.cpp8
-rw-r--r--media/libmediaplayerservice/StagefrightRecorder.h2
2 files changed, 9 insertions, 1 deletions
diff --git a/media/libmediaplayerservice/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp
index d49c4e0..ba04d1b 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.cpp
+++ b/media/libmediaplayerservice/StagefrightRecorder.cpp
@@ -484,6 +484,7 @@ sp<MediaSource> StagefrightRecorder::createAudioSource() {
sp<MediaSource> audioEncoder =
OMXCodec::Create(client.interface(), encMeta,
true /* createEncoder */, audioSource);
+ mAudioSourceNode = audioSource;
return audioEncoder;
}
@@ -822,6 +823,7 @@ status_t StagefrightRecorder::reset() {
mAudioBitRate = 12200;
mInterleaveDurationUs = 0;
mIFramesInterval = 1;
+ mAudioSourceNode = 0;
mEncoderProfiles = MediaProfiles::getInstance();
mOutputFd = -1;
@@ -831,7 +833,11 @@ status_t StagefrightRecorder::reset() {
}
status_t StagefrightRecorder::getMaxAmplitude(int *max) {
- *max = 0;
+ if (mAudioSourceNode != 0) {
+ *max = mAudioSourceNode->getMaxAmplitude();
+ } else {
+ *max = 0;
+ }
return OK;
}
diff --git a/media/libmediaplayerservice/StagefrightRecorder.h b/media/libmediaplayerservice/StagefrightRecorder.h
index 7de96f6..6eedf0c 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.h
+++ b/media/libmediaplayerservice/StagefrightRecorder.h
@@ -26,6 +26,7 @@ namespace android {
class Camera;
struct MediaSource;
struct MediaWriter;
+struct AudioSource;
class MediaProfiles;
struct StagefrightRecorder : public MediaRecorderBase {
@@ -64,6 +65,7 @@ private:
sp<ISurface> mPreviewSurface;
sp<IMediaPlayerClient> mListener;
sp<MediaWriter> mWriter;
+ sp<AudioSource> mAudioSourceNode;
audio_source mAudioSource;
video_source mVideoSource;