From de2430fd7855b7941250e1c3744756ec9e699bd1 Mon Sep 17 00:00:00 2001 From: Marco Nelissen Date: Thu, 18 Feb 2016 08:25:47 -0800 Subject: Get service by value instead of reference to prevent a cleared service binder from being used. Bug: 26040840 Change-Id: Ifb5483c55b172d3553deb80dbe27f2204b86ecdb --- include/media/mediametadataretriever.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/media/mediametadataretriever.h b/include/media/mediametadataretriever.h index f655f35..8ed07ee 100644 --- a/include/media/mediametadataretriever.h +++ b/include/media/mediametadataretriever.h @@ -82,7 +82,7 @@ public: const char* extractMetadata(int keyCode); private: - static const sp& getService(); + static const sp getService(); class DeathNotifier: public IBinder::DeathRecipient { -- cgit v1.1 From 5db73079cbd9bbe5bf2c6fb7d029537a085170ca Mon Sep 17 00:00:00 2001 From: Marco Nelissen Date: Thu, 18 Feb 2016 08:25:47 -0800 Subject: Get service by value instead of reference to prevent a cleared service binder from being used. Bug: 26040840 Change-Id: Ifb5483c55b172d3553deb80dbe27f2204b86ecdb --- include/media/mediametadataretriever.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/media/mediametadataretriever.h b/include/media/mediametadataretriever.h index f655f35..8ed07ee 100644 --- a/include/media/mediametadataretriever.h +++ b/include/media/mediametadataretriever.h @@ -82,7 +82,7 @@ public: const char* extractMetadata(int keyCode); private: - static const sp& getService(); + static const sp getService(); class DeathNotifier: public IBinder::DeathRecipient { -- cgit v1.1 From a4123803d0a0e9e0c69faa4207d357cc74a65d58 Mon Sep 17 00:00:00 2001 From: Steve Kondik Date: Wed, 6 Apr 2016 18:35:02 -0700 Subject: audiopolicy: Be a little smarter with auto-attach * The edge cases, ZOMG! * Instead of relying on effects to be automatically attached, let's just always notify userspace and send a bit more information. This lets the application decide if effects should be attached rather than relying on a hard-coded configuration file. * Perform the setup in getOutputForAttr, but do it on the command thread so we don't block the client. OPO-593 Change-Id: I3900b349f2e895d51fa3a3dcc2de0c4bdf6dbc08 --- include/media/AudioSystem.h | 10 +++++++--- include/media/IAudioPolicyServiceClient.h | 6 ++++-- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h index 35b06ba..be1d114 100644 --- a/include/media/AudioSystem.h +++ b/include/media/AudioSystem.h @@ -32,7 +32,9 @@ namespace android { typedef void (*audio_error_callback)(status_t err); typedef void (*dynamic_policy_callback)(int event, String8 regId, int val); typedef void (*effect_session_callback)(int event, - audio_stream_type_t stream, audio_unique_id_t sessionId, bool added); + audio_stream_type_t stream, audio_unique_id_t sessionId, + audio_output_flags_t flags, audio_channel_mask_t channelMask, + uid_t uid, bool added); class IAudioFlinger; class IAudioPolicyService; @@ -423,8 +425,10 @@ private: virtual void onAudioPatchListUpdate(); virtual void onDynamicPolicyMixStateUpdate(String8 regId, int32_t state); virtual void onOutputSessionEffectsUpdate(audio_stream_type_t stream, - audio_unique_id_t sessionId, - bool added); + audio_session_t sessionId, + audio_output_flags_t flags, + audio_channel_mask_t channelMask, + uid_t uid, bool added); private: Mutex mLock; diff --git a/include/media/IAudioPolicyServiceClient.h b/include/media/IAudioPolicyServiceClient.h index 3bdeb5a..18aed8d 100644 --- a/include/media/IAudioPolicyServiceClient.h +++ b/include/media/IAudioPolicyServiceClient.h @@ -39,8 +39,10 @@ public: virtual void onDynamicPolicyMixStateUpdate(String8 regId, int32_t state) = 0; // Notifies when a default effect set is attached to a session/stream virtual void onOutputSessionEffectsUpdate(audio_stream_type_t stream, - audio_unique_id_t sessionId, - bool added) = 0; + audio_session_t sessionId, + audio_output_flags_t flags, + audio_channel_mask_t channelMask, + uid_t uid, bool added) = 0; }; -- cgit v1.1 From 322d0a4dd98eae78c0f0acbebc2b622be9fd5438 Mon Sep 17 00:00:00 2001 From: Deva Ramasubramanian Date: Mon, 9 Nov 2015 18:55:59 -0800 Subject: libstagefright: Allow for MPEG4Writer extension Defer MPEG4 muxer creation to AVFactory. Change-Id: If0918be77ab7f8d82c78203f371df789e3cc29b8 --- include/media/stagefright/MPEG4Writer.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/media/stagefright/MPEG4Writer.h b/include/media/stagefright/MPEG4Writer.h index aeaad8f..09a48f9 100644 --- a/include/media/stagefright/MPEG4Writer.h +++ b/include/media/stagefright/MPEG4Writer.h @@ -77,13 +77,17 @@ private: int mFd; status_t mInitCheck; bool mIsRealTimeRecording; +protected: bool mUse4ByteNalLength; +private: bool mUse32BitOffset; bool mIsFileSizeLimitExplicitlyRequested; bool mPaused; bool mStarted; // Writer thread + track threads started successfully bool mWriterThreadStarted; // Only writer thread started successfully +protected: off64_t mOffset; +private: off_t mMdatOffset; uint8_t *mMoovBoxBuffer; off64_t mMoovBoxBufferOffset; @@ -194,8 +198,11 @@ private: // Acquire lock before calling these methods off64_t addSample_l(MediaBuffer *buffer); - off64_t addLengthPrefixedSample_l(MediaBuffer *buffer); +protected: + static void StripStartcode(MediaBuffer *buffer); + virtual off64_t addLengthPrefixedSample_l(MediaBuffer *buffer); +private: bool exceedsFileSizeLimit(); bool use32BitFileOffset() const; bool exceedsFileDurationLimit(); -- cgit v1.1 From f888cedf170f6d3cc060cc14ad9c56918f3a03c3 Mon Sep 17 00:00:00 2001 From: xiaoqiny Date: Tue, 13 Jan 2015 17:59:04 +0800 Subject: libstagefright: handle error when B-frame is sent to MPEG4Writer Without this patch, writing B-frame to MediaMuxer will be blocked and cannot return a result. This may cause an endless progress bar shown in gallery when triming or muting some videos. Change-Id: Ib9f902a57da470c0357ec68aab00a35fbb26fb77 CRs-Fixed: 521005 --- include/media/stagefright/MediaAdapter.h | 4 ++++ include/media/stagefright/MediaBuffer.h | 1 + include/media/stagefright/MediaSource.h | 1 + 3 files changed, 6 insertions(+) (limited to 'include') diff --git a/include/media/stagefright/MediaAdapter.h b/include/media/stagefright/MediaAdapter.h index 369fce6..8622546 100644 --- a/include/media/stagefright/MediaAdapter.h +++ b/include/media/stagefright/MediaAdapter.h @@ -56,6 +56,8 @@ public: // deep copy, such that after pushBuffer return, the buffer can be re-used. status_t pushBuffer(MediaBuffer *buffer); + virtual void notifyError(status_t err); + private: Mutex mAdapterLock; // Make sure the read() wait for the incoming buffer. @@ -68,6 +70,8 @@ private: bool mStarted; sp mOutputFormat; + status_t mStatus; + DISALLOW_EVIL_CONSTRUCTORS(MediaAdapter); }; diff --git a/include/media/stagefright/MediaBuffer.h b/include/media/stagefright/MediaBuffer.h index c8a50e8..5ab266f 100644 --- a/include/media/stagefright/MediaBuffer.h +++ b/include/media/stagefright/MediaBuffer.h @@ -93,6 +93,7 @@ protected: private: friend class MediaBufferGroup; friend class OMXDecoder; + friend class MediaAdapter; // For use by OMXDecoder, reference count must be 1, drop reference // count to 0 without signalling the observer. diff --git a/include/media/stagefright/MediaSource.h b/include/media/stagefright/MediaSource.h index a653db9..7ab5f62 100644 --- a/include/media/stagefright/MediaSource.h +++ b/include/media/stagefright/MediaSource.h @@ -59,6 +59,7 @@ struct MediaSource : public virtual RefBase { virtual status_t read( MediaBuffer **buffer, const ReadOptions *options = NULL) = 0; + virtual void notifyError(status_t) {} // Options that modify read() behaviour. The default is to // a) not request a seek // b) not be late, i.e. lateness_us = 0 -- cgit v1.1 From 51b3174ac272f146f7a4fb502103d8130b6f4703 Mon Sep 17 00:00:00 2001 From: Surajit Podder Date: Thu, 25 Feb 2016 20:23:24 +0530 Subject: video: Use boot clock for recording start time Camera HAL3 uses boot time for buffer timestamp, rather than system monotonic time. This leads to issues as framework uses system monotonic time as reference start time for timestamp adjustment. Add change to use boot time for reference start time. CRs-Fixed: 946735 Change-Id: Id0af9c8aed1a983095275ac03f7f59abc31594cc --- include/media/stagefright/MetaData.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/media/stagefright/MetaData.h b/include/media/stagefright/MetaData.h index 2a3df22..66e7d63 100644 --- a/include/media/stagefright/MetaData.h +++ b/include/media/stagefright/MetaData.h @@ -68,6 +68,7 @@ enum { kKeyIsSyncFrame = 'sync', // int32_t (bool) kKeyIsCodecConfig = 'conf', // int32_t (bool) kKeyTime = 'time', // int64_t (usecs) + kKeyTimeBoot = 'timb', // int64_t (usecs) kKeyDecodingTime = 'decT', // int64_t (decoding timestamp in usecs) kKeyNTPTime = 'ntpT', // uint64_t (ntp-timestamp) kKeyTargetTime = 'tarT', // int64_t (usecs) -- cgit v1.1 From 0bb5ced60304da7f61478ffd359e7ba65d72f181 Mon Sep 17 00:00:00 2001 From: Marco Nelissen Date: Thu, 10 Mar 2016 15:02:13 -0800 Subject: Fix size check for OMX_IndexParamConsumerUsageBits since it doesn't follow the OMX convention. And remove support for the kClientNeedsFrameBuffer flag. Bug: 27207275 Change-Id: Ia2c119e2456ebf9e2f4e1de5104ef9032a212255 --- include/media/stagefright/OMXCodec.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'include') diff --git a/include/media/stagefright/OMXCodec.h b/include/media/stagefright/OMXCodec.h index 7fabcb3..b0404aa 100644 --- a/include/media/stagefright/OMXCodec.h +++ b/include/media/stagefright/OMXCodec.h @@ -40,10 +40,6 @@ struct OMXCodec : public MediaSource, kPreferSoftwareCodecs = 1, kIgnoreCodecSpecificData = 2, - // The client wants to access the output buffer's video - // data for example for thumbnail extraction. - kClientNeedsFramebuffer = 4, - // Request for software or hardware codecs. If request // can not be fullfilled, Create() returns NULL. kSoftwareCodecsOnly = 8, -- cgit v1.1 From 45737cb776625f17384540523674761e6313e6d4 Mon Sep 17 00:00:00 2001 From: Zach Jang Date: Thu, 21 Apr 2016 16:10:50 -0700 Subject: Resolve merge conflict when cp'ing ag/931301 to mnc-mr1-release Change-Id: I079d1db2d30d126f8aed348bd62451acf741037d --- include/media/stagefright/DataSource.h | 61 +++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/media/stagefright/DataSource.h b/include/media/stagefright/DataSource.h index dcde36f..47c5c34 100644 --- a/include/media/stagefright/DataSource.h +++ b/include/media/stagefright/DataSource.h @@ -19,7 +19,7 @@ #define DATA_SOURCE_H_ #include - +#include #include #include #include @@ -71,6 +71,20 @@ public: bool getUInt32(off64_t offset, uint32_t *x); bool getUInt64(off64_t offset, uint64_t *x); + // Reads in "count" entries of type T into vector *x. + // Returns true if "count" entries can be read. + // If fewer than "count" entries can be read, return false. In this case, + // the output vector *x will still have those entries that were read. Call + // x->size() to obtain the number of entries read. + // The optional parameter chunkSize specifies how many entries should be + // read from the data source at one time into a temporary buffer. Increasing + // chunkSize can improve the performance at the cost of extra memory usage. + // The default value for chunkSize is set to read at least 4k bytes at a + // time, depending on sizeof(T). + template + bool getVector(off64_t offset, Vector* x, size_t count, + size_t chunkSize = (4095 / sizeof(T)) + 1); + // May return ERROR_UNSUPPORTED. virtual status_t getSize(off64_t *size); @@ -121,6 +135,51 @@ private: DataSource &operator=(const DataSource &); }; +template +bool DataSource::getVector(off64_t offset, Vector* x, size_t count, + size_t chunkSize) +{ + x->clear(); + if (chunkSize == 0) { + return false; + } + if (count == 0) { + return true; + } + + T tmp[chunkSize]; + ssize_t numBytesRead; + size_t numBytesPerChunk = chunkSize * sizeof(T); + size_t i; + + for (i = 0; i + chunkSize < count; i += chunkSize) { + // This loops is executed when more than chunkSize records need to be + // read. + numBytesRead = this->readAt(offset, (void*)&tmp, numBytesPerChunk); + if (numBytesRead == -1) { // If readAt() returns -1, there is an error. + return false; + } + if (numBytesRead < numBytesPerChunk) { + // This case is triggered when the stream ends before the whole + // chunk is read. + x->appendArray(tmp, (size_t)numBytesRead / sizeof(T)); + return false; + } + x->appendArray(tmp, chunkSize); + offset += numBytesPerChunk; + } + + // There are (count - i) more records to read. + // Right now, (count - i) <= chunkSize. + // We do the same thing as above, but with chunkSize replaced by count - i. + numBytesRead = this->readAt(offset, (void*)&tmp, (count - i) * sizeof(T)); + if (numBytesRead == -1) { + return false; + } + x->appendArray(tmp, (size_t)numBytesRead / sizeof(T)); + return x->size() == count; +} + } // namespace android #endif // DATA_SOURCE_H_ -- cgit v1.1 From 244deea89aaf3c5dfa8bd369a845276ae501cb5a Mon Sep 17 00:00:00 2001 From: Steve Kondik Date: Fri, 22 Apr 2016 18:26:43 -0700 Subject: audiopolicy: Revert all session callback patches. * This has been rearchitected in a better way, as this feature turns out to be more difficult than it seems. * Reverting all of this stuff and rolling it into a single commit. This reverts commit c27a16c33c78a36482336a16199b1b8be794cea4. This reverts commit 32ef0556ae58ff6b7c6fe6fb0a17d3ff7f01de31. This reverts commit 489c9fb62f02e1d23d6d6c89b22f7d19c596e65e. This reverts commit a4123803d0a0e9e0c69faa4207d357cc74a65d58. This reverts commit e13b58b988ab642d4ae5ca6d0a89013510714956. This reverts commit 47f8c7303c9e2054f1492b02b6c7472385c52dc9. This reverts commit 0479d7c79a7fd6f112e8dc7e45c009cf6602dbaa. Change-Id: Iaed9f198d806aa414c95960713e8187c98db248b --- include/media/AudioPolicy.h | 1 - include/media/AudioSystem.h | 11 ----------- include/media/IAudioPolicyService.h | 2 -- include/media/IAudioPolicyServiceClient.h | 6 ------ 4 files changed, 20 deletions(-) (limited to 'include') diff --git a/include/media/AudioPolicy.h b/include/media/AudioPolicy.h index 5a82bae..feed402 100644 --- a/include/media/AudioPolicy.h +++ b/include/media/AudioPolicy.h @@ -42,7 +42,6 @@ namespace android { // AudioSystem's implementation of the AudioPolicyClient interface // keep in sync with AudioSystem.java #define DYNAMIC_POLICY_EVENT_MIX_STATE_UPDATE 0 -#define AUDIO_OUTPUT_SESSION_EFFECTS_UPDATE 10 #define MIX_STATE_DISABLED -1 #define MIX_STATE_IDLE 0 diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h index be1d114..26a0bb2 100644 --- a/include/media/AudioSystem.h +++ b/include/media/AudioSystem.h @@ -31,10 +31,6 @@ namespace android { typedef void (*audio_error_callback)(status_t err); typedef void (*dynamic_policy_callback)(int event, String8 regId, int val); -typedef void (*effect_session_callback)(int event, - audio_stream_type_t stream, audio_unique_id_t sessionId, - audio_output_flags_t flags, audio_channel_mask_t channelMask, - uid_t uid, bool added); class IAudioFlinger; class IAudioPolicyService; @@ -96,7 +92,6 @@ public: static void setErrorCallback(audio_error_callback cb); static void setDynPolicyCallback(dynamic_policy_callback cb); - static status_t setEffectSessionCallback(effect_session_callback cb); // helper function to obtain AudioFlinger service handle static const sp get_audio_flinger(); @@ -424,11 +419,6 @@ private: virtual void onAudioPortListUpdate(); virtual void onAudioPatchListUpdate(); virtual void onDynamicPolicyMixStateUpdate(String8 regId, int32_t state); - virtual void onOutputSessionEffectsUpdate(audio_stream_type_t stream, - audio_session_t sessionId, - audio_output_flags_t flags, - audio_channel_mask_t channelMask, - uid_t uid, bool added); private: Mutex mLock; @@ -448,7 +438,6 @@ private: static sp gAudioFlinger; static audio_error_callback gAudioErrorCallback; static dynamic_policy_callback gDynPolicyCallback; - static effect_session_callback gEffectSessionCallback; static size_t gInBuffSize; // previous parameters for recording buffer size queries diff --git a/include/media/IAudioPolicyService.h b/include/media/IAudioPolicyService.h index 3a7bd68..6b93f6f 100644 --- a/include/media/IAudioPolicyService.h +++ b/include/media/IAudioPolicyService.h @@ -165,8 +165,6 @@ public: const audio_attributes_t *attributes, audio_io_handle_t *handle) = 0; virtual status_t stopAudioSource(audio_io_handle_t handle) = 0; - - virtual status_t setEffectSessionCallbacksEnabled(bool enabled) = 0; }; diff --git a/include/media/IAudioPolicyServiceClient.h b/include/media/IAudioPolicyServiceClient.h index 18aed8d..a7f2cc3 100644 --- a/include/media/IAudioPolicyServiceClient.h +++ b/include/media/IAudioPolicyServiceClient.h @@ -37,12 +37,6 @@ public: virtual void onAudioPatchListUpdate() = 0; // Notifies a change in the mixing state of a specific mix in a dynamic audio policy virtual void onDynamicPolicyMixStateUpdate(String8 regId, int32_t state) = 0; - // Notifies when a default effect set is attached to a session/stream - virtual void onOutputSessionEffectsUpdate(audio_stream_type_t stream, - audio_session_t sessionId, - audio_output_flags_t flags, - audio_channel_mask_t channelMask, - uid_t uid, bool added) = 0; }; -- cgit v1.1 From 3f9eb321481de3e118632a594bf1b0c9001c281c Mon Sep 17 00:00:00 2001 From: Steve Kondik Date: Fri, 22 Apr 2016 18:32:39 -0700 Subject: audiopolicy: Add AudioSessionInfo API * This patch introduces a new API which allows applications to query the state of the audio effects system, and receive callbacks with the necessary information to attach effects to any stream. * In the future, this may come as part of the AudioPort system, but since that's an active area of development by Google, we will dodge it for now. * The policy now simply keeps a refcounted list of objects which hold various bits of stream metadata. Callbacks are sent on stream open/close to applications which might be listening for them. Change-Id: I2d554d36e1378f4eb7b276010a3bfe8345c22ecd --- include/media/AudioPolicy.h | 2 + include/media/AudioSession.h | 71 +++++++++++++++++++++++++++++++ include/media/AudioSystem.h | 7 +++ include/media/IAudioPolicyService.h | 3 ++ include/media/IAudioPolicyServiceClient.h | 3 ++ 5 files changed, 86 insertions(+) create mode 100644 include/media/AudioSession.h (limited to 'include') diff --git a/include/media/AudioPolicy.h b/include/media/AudioPolicy.h index feed402..7e33df7 100644 --- a/include/media/AudioPolicy.h +++ b/include/media/AudioPolicy.h @@ -23,6 +23,7 @@ #include #include #include +#include namespace android { @@ -42,6 +43,7 @@ namespace android { // AudioSystem's implementation of the AudioPolicyClient interface // keep in sync with AudioSystem.java #define DYNAMIC_POLICY_EVENT_MIX_STATE_UPDATE 0 +#define AUDIO_OUTPUT_SESSION_EFFECTS_UPDATE 10 #define MIX_STATE_DISABLED -1 #define MIX_STATE_IDLE 0 diff --git a/include/media/AudioSession.h b/include/media/AudioSession.h new file mode 100644 index 0000000..d9658cc --- /dev/null +++ b/include/media/AudioSession.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2016 The CyanogenMod Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ANDROID_AUDIOSESSION_H +#define ANDROID_AUDIOSESSION_H + +#include +#include + +#include + +#include +#include +#include + +namespace android { + +// class to store streaminfo +class AudioSessionInfo : public RefBase { +public: + AudioSessionInfo(int session, audio_stream_type_t stream, audio_output_flags_t flags, + audio_channel_mask_t channelMask, uid_t uid) : + mSessionId(session), mStream(stream), mFlags(flags), mChannelMask(channelMask), + mUid(uid), mRefCount(0) {} + + AudioSessionInfo() : mSessionId(0), mStream(AUDIO_STREAM_DEFAULT), mFlags(AUDIO_OUTPUT_FLAG_NONE), mChannelMask(AUDIO_CHANNEL_NONE), mUid(0) {} + + /*virtual*/ ~AudioSessionInfo() {} + + int mSessionId; + audio_stream_type_t mStream; + audio_output_flags_t mFlags; + audio_channel_mask_t mChannelMask; + uid_t mUid; + + // AudioPolicyManager keeps mLock, no need for lock on reference count here + int mRefCount; + + void readFromParcel(const Parcel &parcel) { + mSessionId = parcel.readInt32(); + mStream = static_cast(parcel.readInt32()); + mFlags = static_cast(parcel.readInt32()); + mChannelMask = static_cast(parcel.readInt32()); + mUid = static_cast(parcel.readInt32()); + } + + void writeToParcel(Parcel *parcel) const { + parcel->writeInt32(mSessionId); + parcel->writeInt32(mStream); + parcel->writeInt32(mFlags); + parcel->writeInt32(mChannelMask); + parcel->writeInt32(mUid); + } +}; + +}; // namespace android + +#endif // ANDROID_AUDIOSESSION_H diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h index 26a0bb2..3f4a610 100644 --- a/include/media/AudioSystem.h +++ b/include/media/AudioSystem.h @@ -31,6 +31,8 @@ namespace android { typedef void (*audio_error_callback)(status_t err); typedef void (*dynamic_policy_callback)(int event, String8 regId, int val); +typedef void (*audio_session_callback)(int event, + sp& session, bool added); class IAudioFlinger; class IAudioPolicyService; @@ -92,6 +94,7 @@ public: static void setErrorCallback(audio_error_callback cb); static void setDynPolicyCallback(dynamic_policy_callback cb); + static status_t setAudioSessionCallback(audio_session_callback cb); // helper function to obtain AudioFlinger service handle static const sp get_audio_flinger(); @@ -319,6 +322,8 @@ public: audio_io_handle_t *handle); static status_t stopAudioSource(audio_io_handle_t handle); + static status_t listAudioSessions(audio_stream_type_t streams, + Vector< sp> &sessions); // ---------------------------------------------------------------------------- @@ -419,6 +424,7 @@ private: virtual void onAudioPortListUpdate(); virtual void onAudioPatchListUpdate(); virtual void onDynamicPolicyMixStateUpdate(String8 regId, int32_t state); + virtual void onOutputSessionEffectsUpdate(sp& info, bool added); private: Mutex mLock; @@ -438,6 +444,7 @@ private: static sp gAudioFlinger; static audio_error_callback gAudioErrorCallback; static dynamic_policy_callback gDynPolicyCallback; + static audio_session_callback gAudioSessionCallback; static size_t gInBuffSize; // previous parameters for recording buffer size queries diff --git a/include/media/IAudioPolicyService.h b/include/media/IAudioPolicyService.h index 6b93f6f..1df91ee 100644 --- a/include/media/IAudioPolicyService.h +++ b/include/media/IAudioPolicyService.h @@ -165,6 +165,9 @@ public: const audio_attributes_t *attributes, audio_io_handle_t *handle) = 0; virtual status_t stopAudioSource(audio_io_handle_t handle) = 0; + + virtual status_t listAudioSessions(audio_stream_type_t streams, + Vector< sp> &sessions) = 0; }; diff --git a/include/media/IAudioPolicyServiceClient.h b/include/media/IAudioPolicyServiceClient.h index a7f2cc3..ec38157 100644 --- a/include/media/IAudioPolicyServiceClient.h +++ b/include/media/IAudioPolicyServiceClient.h @@ -21,6 +21,7 @@ #include #include #include +#include namespace android { @@ -37,6 +38,8 @@ public: virtual void onAudioPatchListUpdate() = 0; // Notifies a change in the mixing state of a specific mix in a dynamic audio policy virtual void onDynamicPolicyMixStateUpdate(String8 regId, int32_t state) = 0; + // Notifies when a default effect set is attached to a session/stream + virtual void onOutputSessionEffectsUpdate(sp& info, bool added) = 0; }; -- cgit v1.1 From 42a25c46b844518ff0d0b920c20c519e1417be69 Mon Sep 17 00:00:00 2001 From: Marco Nelissen Date: Tue, 7 Jun 2016 12:26:43 -0700 Subject: Don't use sp<>& because they may end up pointing to NULL after a NULL check was performed. Bug: 28166152 Change-Id: Iab2ea30395b620628cc6f3d067dd4f6fcda824fe --- include/media/IMediaDeathNotifier.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/media/IMediaDeathNotifier.h b/include/media/IMediaDeathNotifier.h index bb3d0d8..aca6678 100644 --- a/include/media/IMediaDeathNotifier.h +++ b/include/media/IMediaDeathNotifier.h @@ -30,7 +30,7 @@ public: virtual ~IMediaDeathNotifier() { removeObitRecipient(this); } virtual void died() = 0; - static const sp& getMediaPlayerService(); + static const sp getMediaPlayerService(); private: IMediaDeathNotifier &operator=(const IMediaDeathNotifier &); -- cgit v1.1 From 1f24c730ab6ca5aff1e3137b340b8aeaeda4bdbc Mon Sep 17 00:00:00 2001 From: Eino-Ville Talvala Date: Mon, 20 Jun 2016 17:00:14 -0700 Subject: DO NOT MERGE: Camera: Adjust pointers to ANW buffers to avoid infoleak Subtract address of a random static object from pointers being routed through app process. Bug: 28466701 Change-Id: Idcbfe81e9507433769672f3dc6d67db5eeed4e04 --- include/camera/ICameraRecordingProxy.h | 6 ++++++ include/media/stagefright/CameraSource.h | 3 +++ 2 files changed, 9 insertions(+) (limited to 'include') diff --git a/include/camera/ICameraRecordingProxy.h b/include/camera/ICameraRecordingProxy.h index 2aac284..4edf9cd 100644 --- a/include/camera/ICameraRecordingProxy.h +++ b/include/camera/ICameraRecordingProxy.h @@ -83,6 +83,12 @@ public: virtual status_t startRecording(const sp& listener) = 0; virtual void stopRecording() = 0; virtual void releaseRecordingFrame(const sp& mem) = 0; + + // b/28466701 + static size_t getCommonBaseAddress(); + private: + + static uint8_t baseObject; }; // ---------------------------------------------------------------------------- diff --git a/include/media/stagefright/CameraSource.h b/include/media/stagefright/CameraSource.h index 069e897..6c938a5 100644 --- a/include/media/stagefright/CameraSource.h +++ b/include/media/stagefright/CameraSource.h @@ -236,6 +236,9 @@ private: status_t checkFrameRate(const CameraParameters& params, int32_t frameRate); + static void adjustIncomingANWBuffer(IMemory* data); + static void adjustOutgoingANWBuffer(IMemory* data); + void stopCameraRecording(); status_t reset(); -- cgit v1.1 From bc8a45f506a8be33250c523d71fab637a5fdaf81 Mon Sep 17 00:00:00 2001 From: Lajos Molnar Date: Tue, 2 Aug 2016 07:07:05 -0700 Subject: IOMX: work against metadata buffer spoofing - Prohibit direct set/getParam/Settings for extensions meant for OMXNodeInstance alone. This disallows enabling metadata mode without the knowledge of OMXNodeInstance. - Do not share metadata mode buffers cross process. - Disallow setting up metadata mode/tunneling/input surface after first sendCommand. - Disallow store-meta for input cross process. - Disallow emptyBuffer for surface input (via IOMX). - Fix checking for input surface. Bug: 29422020 Change-Id: I801c77b80e703903f62e42d76fd2e76a34e4bc8e (cherry picked from commit f8a4cb410115045278f534e54b41ac78d6bf6c07) --- include/media/IOMX.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/media/IOMX.h b/include/media/IOMX.h index 27ad694..83a177a 100644 --- a/include/media/IOMX.h +++ b/include/media/IOMX.h @@ -107,7 +107,7 @@ public: // Use |params| as an OMX buffer, but limit the size of the OMX buffer to |allottedSize|. virtual status_t useBuffer( node_id node, OMX_U32 port_index, const sp ¶ms, - buffer_id *buffer, OMX_U32 allottedSize) = 0; + buffer_id *buffer, OMX_U32 allottedSize, OMX_BOOL crossProcess = OMX_FALSE) = 0; virtual status_t useGraphicBuffer( node_id node, OMX_U32 port_index, @@ -149,7 +149,7 @@ public: // may be larger. virtual status_t allocateBufferWithBackup( node_id node, OMX_U32 port_index, const sp ¶ms, - buffer_id *buffer, OMX_U32 allottedSize) = 0; + buffer_id *buffer, OMX_U32 allottedSize, OMX_BOOL crossProcess = OMX_FALSE) = 0; virtual status_t freeBuffer( node_id node, OMX_U32 port_index, buffer_id buffer) = 0; -- cgit v1.1 From d8cf9aa813be5363fb5425b4f818a267edd5e750 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Wed, 7 Sep 2016 16:58:39 -0700 Subject: SoundTrigger: get service by value. Get strong pointer to service interface by value and not reference to prevent race conditions where the service pointer can be cleared by another thread while in use. Bug: 30907212 Change-Id: I6f02ec3fd1e6392b842b334e1cc4f9aa23916009 (cherry picked from commit 3b01b3019b1c62132792a1a94e2dc1f7cfc84f2e) --- include/soundtrigger/SoundTrigger.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/soundtrigger/SoundTrigger.h b/include/soundtrigger/SoundTrigger.h index bf5e1de..9a05cac 100644 --- a/include/soundtrigger/SoundTrigger.h +++ b/include/soundtrigger/SoundTrigger.h @@ -68,7 +68,7 @@ public: private: SoundTrigger(sound_trigger_module_handle_t module, const sp&); - static const sp& getSoundTriggerHwService(); + static const sp getSoundTriggerHwService(); Mutex mLock; sp mISoundTrigger; -- cgit v1.1 From 128035617a8cafd4ea717ceb8d6fe56564b07262 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Wed, 7 Sep 2016 16:58:39 -0700 Subject: Radio: get service by value. Get strong pointer to service interface by value and not reference to prevent race conditions where the service pointer can be cleared by another thread while in use. Bug: 30907212 Change-Id: Iae838b3b672562c1d0cd63968399a6bfdda7f5ab (cherry picked from commit 28a0e9ec74e5192aacffb279c80619ef284062b0) --- include/radio/Radio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/radio/Radio.h b/include/radio/Radio.h index 302bf16..a4dfdd1 100644 --- a/include/radio/Radio.h +++ b/include/radio/Radio.h @@ -75,7 +75,7 @@ public: private: Radio(radio_handle_t handle, const sp&); - static const sp& getRadioService(); + static const sp getRadioService(); Mutex mLock; sp mIRadio; -- cgit v1.1