diff options
Diffstat (limited to 'include/media')
-rw-r--r-- | include/media/AudioRecord.h | 13 | ||||
-rw-r--r-- | include/media/AudioTrack.h | 26 |
2 files changed, 23 insertions, 16 deletions
diff --git a/include/media/AudioRecord.h b/include/media/AudioRecord.h index 7c240b4..8973c5c 100644 --- a/include/media/AudioRecord.h +++ b/include/media/AudioRecord.h @@ -35,8 +35,6 @@ class AudioRecord : public RefBase { public: - static const int DEFAULT_SAMPLE_RATE = 8000; - /* Events used by AudioRecord callback function (callback_t). * Keep in sync with frameworks/base/media/java/android/media/AudioRecord.java NATIVE_EVENT_*. */ @@ -62,6 +60,7 @@ public: size_t frameCount; // number of sample frames corresponding to size; // on input it is the number of frames available, // on output is the number of frames actually drained + // (currently ignored, but will make the primary field in future) size_t size; // input/output in bytes == frameCount * frameSize // FIXME this is redundant with respect to frameCount, @@ -366,7 +365,12 @@ public: * Input parameter 'size' is in byte units. * This is implemented on top of obtainBuffer/releaseBuffer. For best * performance use callbacks. Returns actual number of bytes read >= 0, - * or a negative status code. + * or one of the following negative status codes: + * INVALID_OPERATION AudioRecord is configured for streaming mode + * BAD_VALUE size is invalid + * WOULD_BLOCK when obtainBuffer() returns same, or + * AudioRecord was stopped during the read + * or any other error code returned by IAudioRecord::start() or restoreRecord_l(). */ ssize_t read(void* buffer, size_t size); @@ -441,7 +445,7 @@ private: // for client callback handler callback_t mCbf; // callback handler for events, or NULL - void* mUserData; // for client callback handler + void* mUserData; // for notification APIs uint32_t mNotificationFrames; // frames between each notification callback @@ -487,6 +491,7 @@ private: // multi-thread safe. // An exception is that a blocking ClientProxy::obtainBuffer() may be called without a lock, // provided that the caller also holds an extra reference to the proxy and shared memory to keep + // them around in case they are replaced during the obtainBuffer(). sp<AudioRecordClientProxy> mProxy; bool mInOverrun; // whether recorder is currently in overrun state diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h index 523bd32..ddb5842 100644 --- a/include/media/AudioTrack.h +++ b/include/media/AudioTrack.h @@ -116,6 +116,7 @@ public: * Returned status (from utils/Errors.h) can be: * - NO_ERROR: successful operation * - NO_INIT: audio server or audio hardware not initialized + * - BAD_VALUE: unsupported configuration */ static status_t getMinFrameCount(size_t* frameCount, @@ -170,9 +171,9 @@ public: */ AudioTrack( audio_stream_type_t streamType, - uint32_t sampleRate = 0, - audio_format_t format = AUDIO_FORMAT_DEFAULT, - audio_channel_mask_t channelMask = 0, + uint32_t sampleRate, + audio_format_t format, + audio_channel_mask_t, int frameCount = 0, audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE, callback_t cbf = NULL, @@ -194,10 +195,10 @@ public: */ AudioTrack( audio_stream_type_t streamType, - uint32_t sampleRate = 0, - audio_format_t format = AUDIO_FORMAT_DEFAULT, - audio_channel_mask_t channelMask = 0, - const sp<IMemory>& sharedBuffer = 0, + uint32_t sampleRate, + audio_format_t format, + audio_channel_mask_t channelMask, + const sp<IMemory>& sharedBuffer, audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE, callback_t cbf = NULL, void* user = NULL, @@ -227,10 +228,10 @@ public: * * threadCanCallJava: Whether callbacks are made from an attached thread and thus can call JNI. */ - status_t set(audio_stream_type_t streamType = AUDIO_STREAM_DEFAULT, - uint32_t sampleRate = 0, - audio_format_t format = AUDIO_FORMAT_DEFAULT, - audio_channel_mask_t channelMask = 0, + status_t set(audio_stream_type_t streamType, + uint32_t sampleRate, + audio_format_t format, + audio_channel_mask_t channelMask, int frameCount = 0, audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE, callback_t cbf = NULL, @@ -682,8 +683,9 @@ protected: STATE_STOPPING, } mState; + // for client callback handler callback_t mCbf; // callback handler for events, or NULL - void* mUserData; // for client callback handler + void* mUserData; // for notification APIs uint32_t mNotificationFramesReq; // requested number of frames between each |