summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-05-26 10:11:44 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-05-26 10:11:44 -0700
commitc5d0343b677d5ddc2d69fd15b81b084a40ab12ac (patch)
treed2709457029d8b4cc581bba22aa13e4fa8fabd42 /media
parent620ad3dcf1e966bbcca3d6280fdd16f09441a733 (diff)
parentde8268d6d1cd168510c490b17e93154d2eab767c (diff)
downloadframeworks_base-c5d0343b677d5ddc2d69fd15b81b084a40ab12ac.zip
frameworks_base-c5d0343b677d5ddc2d69fd15b81b084a40ab12ac.tar.gz
frameworks_base-c5d0343b677d5ddc2d69fd15b81b084a40ab12ac.tar.bz2
am de8268d6: Merge change 2331 into donut
Merge commit 'de8268d6d1cd168510c490b17e93154d2eab767c' * commit 'de8268d6d1cd168510c490b17e93154d2eab767c': Fix issue 1846343 - part 1
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/AudioRecord.java14
-rw-r--r--media/java/android/media/MediaRecorder.java15
-rw-r--r--media/jni/android_media_MediaRecorder.cpp2
-rw-r--r--media/libmedia/AudioRecord.cpp18
-rw-r--r--media/libmedia/IAudioFlinger.cpp8
5 files changed, 36 insertions, 21 deletions
diff --git a/media/java/android/media/AudioRecord.java b/media/java/android/media/AudioRecord.java
index 3346bed..4d1535f 100644
--- a/media/java/android/media/AudioRecord.java
+++ b/media/java/android/media/AudioRecord.java
@@ -88,7 +88,7 @@ public class AudioRecord
private static final int AUDIORECORD_ERROR_SETUP_ZEROFRAMECOUNT = -16;
private static final int AUDIORECORD_ERROR_SETUP_INVALIDCHANNELCOUNT = -17;
private static final int AUDIORECORD_ERROR_SETUP_INVALIDFORMAT = -18;
- private static final int AUDIORECORD_ERROR_SETUP_INVALIDSTREAMTYPE = -19;
+ private static final int AUDIORECORD_ERROR_SETUP_INVALIDSOURCE = -19;
private static final int AUDIORECORD_ERROR_SETUP_NATIVEINITFAILED = -20;
// Events:
@@ -113,13 +113,7 @@ public class AudioRecord
*/
@SuppressWarnings("unused")
private int mNativeRecorderInJavaObj;
- /**
- * Accessed by native methods: provides access to record source constants
- */
- @SuppressWarnings("unused")
- private final static int SOURCE_DEFAULT = MediaRecorder.AudioSource.DEFAULT;
- @SuppressWarnings("unused")
- private final static int SOURCE_MIC = MediaRecorder.AudioSource.MIC;
+
/**
* Accessed by native methods: provides access to the callback data.
*/
@@ -252,8 +246,8 @@ public class AudioRecord
//--------------
// audio source
- if ( (audioSource != MediaRecorder.AudioSource.DEFAULT)
- && (audioSource != MediaRecorder.AudioSource.MIC) ) {
+ if ( (audioSource < MediaRecorder.AudioSource.DEFAULT) ||
+ (audioSource > MediaRecorder.getAudioSourceMax()) ) {
throw (new IllegalArgumentException("Invalid audio source."));
} else {
mRecordSource = audioSource;
diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java
index 5d90e62..44f21c8 100644
--- a/media/java/android/media/MediaRecorder.java
+++ b/media/java/android/media/MediaRecorder.java
@@ -125,6 +125,15 @@ public class MediaRecorder
public static final int DEFAULT = 0;
/** Microphone audio source */
public static final int MIC = 1;
+
+ /** Voice call uplink (Tx) audio source */
+ public static final int VOICE_UPLINK = 2;
+
+ /** Voice call downlink (Rx) audio source */
+ public static final int VOICE_DOWNLINK = 3;
+
+ /** Voice call uplink + downlink audio source */
+ public static final int VOICE_CALL = 4;
}
/**
@@ -203,6 +212,12 @@ public class MediaRecorder
throws IllegalStateException;
/**
+ * Gets the maximum value for audio sources.
+ * @see android.media.MediaRecorder.AudioSource
+ */
+ public static final int getAudioSourceMax() { return AudioSource.VOICE_CALL; }
+
+ /**
* Sets the video source to be used for recording. If this method is not
* called, the output file will not contain an video track. The source needs
* to be specified before setting recording-parameters or encoders. Call
diff --git a/media/jni/android_media_MediaRecorder.cpp b/media/jni/android_media_MediaRecorder.cpp
index cac65d6..7561af1 100644
--- a/media/jni/android_media_MediaRecorder.cpp
+++ b/media/jni/android_media_MediaRecorder.cpp
@@ -177,7 +177,7 @@ static void
android_media_MediaRecorder_setAudioSource(JNIEnv *env, jobject thiz, jint as)
{
LOGV("setAudioSource(%d)", as);
- if (as < AUDIO_SOURCE_DEFAULT || as > AUDIO_SOURCE_MIC) {
+ if (as < AUDIO_SOURCE_DEFAULT || as > AUDIO_SOURCE_MAX) {
jniThrowException(env, "java/lang/IllegalArgumentException", "Invalid audio source");
return;
}
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp
index 793bbf4..cf0965e 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -50,7 +50,7 @@ AudioRecord::AudioRecord()
}
AudioRecord::AudioRecord(
- int streamType,
+ int inputSource,
uint32_t sampleRate,
int format,
int channelCount,
@@ -61,7 +61,7 @@ AudioRecord::AudioRecord(
int notificationFrames)
: mStatus(NO_INIT)
{
- mStatus = set(streamType, sampleRate, format, channelCount,
+ mStatus = set(inputSource, sampleRate, format, channelCount,
frameCount, flags, cbf, user, notificationFrames);
}
@@ -82,7 +82,7 @@ AudioRecord::~AudioRecord()
}
status_t AudioRecord::set(
- int streamType,
+ int inputSource,
uint32_t sampleRate,
int format,
int channelCount,
@@ -104,8 +104,8 @@ status_t AudioRecord::set(
return NO_INIT;
}
- if (streamType == DEFAULT_INPUT) {
- streamType = MIC_INPUT;
+ if (inputSource == DEFAULT_INPUT) {
+ inputSource = MIC_INPUT;
}
if (sampleRate == 0) {
@@ -157,7 +157,7 @@ status_t AudioRecord::set(
// open record channel
status_t status;
- sp<IAudioRecord> record = audioFlinger->openRecord(getpid(), streamType,
+ sp<IAudioRecord> record = audioFlinger->openRecord(getpid(), inputSource,
sampleRate, format,
channelCount,
frameCount,
@@ -201,6 +201,7 @@ status_t AudioRecord::set(
mMarkerReached = false;
mNewPosition = 0;
mUpdatePeriod = 0;
+ mInputSource = (uint8_t)inputSource;
return NO_ERROR;
}
@@ -242,6 +243,11 @@ int AudioRecord::frameSize() const
return channelCount()*((format() == AudioSystem::PCM_8_BIT) ? sizeof(uint8_t) : sizeof(int16_t));
}
+int AudioRecord::inputSource() const
+{
+ return (int)mInputSource;
+}
+
// -------------------------------------------------------------------------
status_t AudioRecord::start()
diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp
index 7395885..09f1c36 100644
--- a/media/libmedia/IAudioFlinger.cpp
+++ b/media/libmedia/IAudioFlinger.cpp
@@ -99,7 +99,7 @@ public:
virtual sp<IAudioRecord> openRecord(
pid_t pid,
- int streamType,
+ int inputSource,
uint32_t sampleRate,
int format,
int channelCount,
@@ -110,7 +110,7 @@ public:
Parcel data, reply;
data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
data.writeInt32(pid);
- data.writeInt32(streamType);
+ data.writeInt32(inputSource);
data.writeInt32(sampleRate);
data.writeInt32(format);
data.writeInt32(channelCount);
@@ -384,14 +384,14 @@ status_t BnAudioFlinger::onTransact(
case OPEN_RECORD: {
CHECK_INTERFACE(IAudioFlinger, data, reply);
pid_t pid = data.readInt32();
- int streamType = data.readInt32();
+ int inputSource = data.readInt32();
uint32_t sampleRate = data.readInt32();
int format = data.readInt32();
int channelCount = data.readInt32();
size_t bufferCount = data.readInt32();
uint32_t flags = data.readInt32();
status_t status;
- sp<IAudioRecord> record = openRecord(pid, streamType,
+ sp<IAudioRecord> record = openRecord(pid, inputSource,
sampleRate, format, channelCount, bufferCount, flags, &status);
reply->writeInt32(status);
reply->writeStrongBinder(record->asBinder());