Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -14780,6 +14780,7 @@ package android.media { method public int getChannelConfiguration(); method public int getChannelCount(); method public static int getMinBufferSize(int, int, int); method public int getNativeFrameCount() throws java.lang.IllegalStateException; method public int getNotificationMarkerPosition(); method public int getPositionNotificationPeriod(); method public int getRecordingState(); api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -15990,6 +15990,7 @@ package android.media { method public int getChannelConfiguration(); method public int getChannelCount(); method public static int getMinBufferSize(int, int, int); method public int getNativeFrameCount() throws java.lang.IllegalStateException; method public int getNotificationMarkerPosition(); method public int getPositionNotificationPeriod(); method public int getRecordingState(); core/jni/android_media_AudioRecord.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -523,6 +523,17 @@ static jint android_media_AudioRecord_readInDirectBuffer(JNIEnv *env, jobject t } // ---------------------------------------------------------------------------- static jint android_media_AudioRecord_get_native_frame_count(JNIEnv *env, jobject thiz) { sp<AudioRecord> lpRecorder = getAudioRecord(env, thiz); if (lpRecorder == NULL) { jniThrowException(env, "java/lang/IllegalStateException", "Unable to retrieve AudioRecord pointer for getNativeFrameCount()"); return (jint)AUDIO_JAVA_ERROR; } return lpRecorder->frameCount(); } // ---------------------------------------------------------------------------- static jint android_media_AudioRecord_set_marker_pos(JNIEnv *env, jobject thiz, jint markerPos) { Loading Loading @@ -629,6 +640,8 @@ static JNINativeMethod gMethods[] = { "([FIIZ)I", (void *)android_media_AudioRecord_readInFloatArray}, {"native_read_in_direct_buffer","(Ljava/lang/Object;I)I", (void *)android_media_AudioRecord_readInDirectBuffer}, {"native_get_native_frame_count", "()I", (void *)android_media_AudioRecord_get_native_frame_count}, {"native_set_marker_pos","(I)I", (void *)android_media_AudioRecord_set_marker_pos}, {"native_get_marker_pos","()I", (void *)android_media_AudioRecord_get_marker_pos}, {"native_set_pos_update_period", Loading media/java/android/media/AudioRecord.java +28 −3 Original line number Diff line number Diff line Loading @@ -398,8 +398,8 @@ public class AudioRecord * default output sample rate of the device (see * {@link AudioManager#PROPERTY_OUTPUT_SAMPLE_RATE}), its channel configuration will be * {@link AudioFormat#CHANNEL_IN_DEFAULT}. * <br>Failing to set an adequate buffer size with {@link #setBufferSizeInBytes(int)} will * prevent the successful creation of an <code>AudioRecord</code> instance. * <br>If the buffer size is not specified with {@link #setBufferSizeInBytes(int)}, * the minimum buffer size for the source is used. */ public static class Builder { private AudioAttributes mAttributes; Loading Loading @@ -473,7 +473,9 @@ public class AudioRecord * during the recording. New audio data can be read from this buffer in smaller chunks * than this size. See {@link #getMinBufferSize(int, int, int)} to determine the minimum * required buffer size for the successful creation of an AudioRecord instance. * Using values smaller than getMinBufferSize() will result in an initialization failure. * Since bufferSizeInBytes may be internally increased to accommodate the source * requirements, use {@link #getNativeFrameCount()} to determine the actual buffer size * in frames. * @param bufferSizeInBytes a value strictly greater than 0 * @return the same Builder instance. * @throws IllegalArgumentException Loading Loading @@ -520,6 +522,13 @@ public class AudioRecord .build(); } try { // If the buffer size is not specified, // use a single frame for the buffer size and let the // native code figure out the minimum buffer size. if (mBufferSizeInBytes == 0) { mBufferSizeInBytes = mFormat.getChannelCount() * mFormat.getBytesPerSample(mFormat.getEncoding()); } return new AudioRecord(mAttributes, mFormat, mBufferSizeInBytes, mSessionId); } catch (IllegalArgumentException e) { throw new UnsupportedOperationException(e.getMessage()); Loading Loading @@ -710,6 +719,20 @@ public class AudioRecord } } /** * Returns the "native frame count" of the <code>AudioRecord</code> buffer. * This is greater than or equal to the bufferSizeInBytes converted to frame units * specified in the <code>AudioRecord</code> constructor or Builder. * The native frame count may be enlarged to accommodate the requirements of the * source on creation or if the <code>AudioRecord</code> * is subsequently rerouted. * @return current size in frames of the <code>AudioRecord</code> buffer. * @throws IllegalStateException */ public int getNativeFrameCount() throws IllegalStateException { return native_get_native_frame_count(); } /** * Returns the notification marker position expressed in frames. */ Loading Loading @@ -1173,6 +1196,8 @@ public class AudioRecord private native final int native_read_in_direct_buffer(Object jBuffer, int sizeInBytes); private native final int native_get_native_frame_count(); private native final int native_set_marker_pos(int marker); private native final int native_get_marker_pos(); Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -14780,6 +14780,7 @@ package android.media { method public int getChannelConfiguration(); method public int getChannelCount(); method public static int getMinBufferSize(int, int, int); method public int getNativeFrameCount() throws java.lang.IllegalStateException; method public int getNotificationMarkerPosition(); method public int getPositionNotificationPeriod(); method public int getRecordingState();
api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -15990,6 +15990,7 @@ package android.media { method public int getChannelConfiguration(); method public int getChannelCount(); method public static int getMinBufferSize(int, int, int); method public int getNativeFrameCount() throws java.lang.IllegalStateException; method public int getNotificationMarkerPosition(); method public int getPositionNotificationPeriod(); method public int getRecordingState();
core/jni/android_media_AudioRecord.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -523,6 +523,17 @@ static jint android_media_AudioRecord_readInDirectBuffer(JNIEnv *env, jobject t } // ---------------------------------------------------------------------------- static jint android_media_AudioRecord_get_native_frame_count(JNIEnv *env, jobject thiz) { sp<AudioRecord> lpRecorder = getAudioRecord(env, thiz); if (lpRecorder == NULL) { jniThrowException(env, "java/lang/IllegalStateException", "Unable to retrieve AudioRecord pointer for getNativeFrameCount()"); return (jint)AUDIO_JAVA_ERROR; } return lpRecorder->frameCount(); } // ---------------------------------------------------------------------------- static jint android_media_AudioRecord_set_marker_pos(JNIEnv *env, jobject thiz, jint markerPos) { Loading Loading @@ -629,6 +640,8 @@ static JNINativeMethod gMethods[] = { "([FIIZ)I", (void *)android_media_AudioRecord_readInFloatArray}, {"native_read_in_direct_buffer","(Ljava/lang/Object;I)I", (void *)android_media_AudioRecord_readInDirectBuffer}, {"native_get_native_frame_count", "()I", (void *)android_media_AudioRecord_get_native_frame_count}, {"native_set_marker_pos","(I)I", (void *)android_media_AudioRecord_set_marker_pos}, {"native_get_marker_pos","()I", (void *)android_media_AudioRecord_get_marker_pos}, {"native_set_pos_update_period", Loading
media/java/android/media/AudioRecord.java +28 −3 Original line number Diff line number Diff line Loading @@ -398,8 +398,8 @@ public class AudioRecord * default output sample rate of the device (see * {@link AudioManager#PROPERTY_OUTPUT_SAMPLE_RATE}), its channel configuration will be * {@link AudioFormat#CHANNEL_IN_DEFAULT}. * <br>Failing to set an adequate buffer size with {@link #setBufferSizeInBytes(int)} will * prevent the successful creation of an <code>AudioRecord</code> instance. * <br>If the buffer size is not specified with {@link #setBufferSizeInBytes(int)}, * the minimum buffer size for the source is used. */ public static class Builder { private AudioAttributes mAttributes; Loading Loading @@ -473,7 +473,9 @@ public class AudioRecord * during the recording. New audio data can be read from this buffer in smaller chunks * than this size. See {@link #getMinBufferSize(int, int, int)} to determine the minimum * required buffer size for the successful creation of an AudioRecord instance. * Using values smaller than getMinBufferSize() will result in an initialization failure. * Since bufferSizeInBytes may be internally increased to accommodate the source * requirements, use {@link #getNativeFrameCount()} to determine the actual buffer size * in frames. * @param bufferSizeInBytes a value strictly greater than 0 * @return the same Builder instance. * @throws IllegalArgumentException Loading Loading @@ -520,6 +522,13 @@ public class AudioRecord .build(); } try { // If the buffer size is not specified, // use a single frame for the buffer size and let the // native code figure out the minimum buffer size. if (mBufferSizeInBytes == 0) { mBufferSizeInBytes = mFormat.getChannelCount() * mFormat.getBytesPerSample(mFormat.getEncoding()); } return new AudioRecord(mAttributes, mFormat, mBufferSizeInBytes, mSessionId); } catch (IllegalArgumentException e) { throw new UnsupportedOperationException(e.getMessage()); Loading Loading @@ -710,6 +719,20 @@ public class AudioRecord } } /** * Returns the "native frame count" of the <code>AudioRecord</code> buffer. * This is greater than or equal to the bufferSizeInBytes converted to frame units * specified in the <code>AudioRecord</code> constructor or Builder. * The native frame count may be enlarged to accommodate the requirements of the * source on creation or if the <code>AudioRecord</code> * is subsequently rerouted. * @return current size in frames of the <code>AudioRecord</code> buffer. * @throws IllegalStateException */ public int getNativeFrameCount() throws IllegalStateException { return native_get_native_frame_count(); } /** * Returns the notification marker position expressed in frames. */ Loading Loading @@ -1173,6 +1196,8 @@ public class AudioRecord private native final int native_read_in_direct_buffer(Object jBuffer, int sizeInBytes); private native final int native_get_native_frame_count(); private native final int native_set_marker_pos(int marker); private native final int native_get_marker_pos(); Loading