Merge "stagefright: IOMX: pass native handle in sp<NativeHandle>" into nyc-dev
am: 038ccfd6ff
* commit '038ccfd6ff5a32d6f559e5b479d6f8e55d0b5133':
stagefright: IOMX: pass native handle in sp<NativeHandle>
Change-Id: I31d255bea906aca9ae23f5f4678d6557bc84052b
diff --git a/camera/ICamera.cpp b/camera/ICamera.cpp
index 0680d7c..2bf956d 100644
--- a/camera/ICamera.cpp
+++ b/camera/ICamera.cpp
@@ -60,7 +60,7 @@
class BpCamera: public BpInterface<ICamera>
{
public:
- BpCamera(const sp<IBinder>& impl)
+ explicit BpCamera(const sp<IBinder>& impl)
: BpInterface<ICamera>(impl)
{
}
diff --git a/camera/ICameraClient.cpp b/camera/ICameraClient.cpp
index 68cbfb8..1b6fac4 100644
--- a/camera/ICameraClient.cpp
+++ b/camera/ICameraClient.cpp
@@ -37,7 +37,7 @@
class BpCameraClient: public BpInterface<ICameraClient>
{
public:
- BpCameraClient(const sp<IBinder>& impl)
+ explicit BpCameraClient(const sp<IBinder>& impl)
: BpInterface<ICameraClient>(impl)
{
}
diff --git a/camera/ICameraRecordingProxy.cpp b/camera/ICameraRecordingProxy.cpp
index 63c4b1d..c9f8b5c 100644
--- a/camera/ICameraRecordingProxy.cpp
+++ b/camera/ICameraRecordingProxy.cpp
@@ -38,7 +38,7 @@
class BpCameraRecordingProxy: public BpInterface<ICameraRecordingProxy>
{
public:
- BpCameraRecordingProxy(const sp<IBinder>& impl)
+ explicit BpCameraRecordingProxy(const sp<IBinder>& impl)
: BpInterface<ICameraRecordingProxy>(impl)
{
}
diff --git a/camera/ICameraRecordingProxyListener.cpp b/camera/ICameraRecordingProxyListener.cpp
index fa4dfd8..8529d3e 100644
--- a/camera/ICameraRecordingProxyListener.cpp
+++ b/camera/ICameraRecordingProxyListener.cpp
@@ -33,7 +33,7 @@
class BpCameraRecordingProxyListener: public BpInterface<ICameraRecordingProxyListener>
{
public:
- BpCameraRecordingProxyListener(const sp<IBinder>& impl)
+ explicit BpCameraRecordingProxyListener(const sp<IBinder>& impl)
: BpInterface<ICameraRecordingProxyListener>(impl)
{
}
diff --git a/camera/ICameraServiceProxy.cpp b/camera/ICameraServiceProxy.cpp
index 694e9c3..a9d0836 100644
--- a/camera/ICameraServiceProxy.cpp
+++ b/camera/ICameraServiceProxy.cpp
@@ -26,7 +26,8 @@
class BpCameraServiceProxy: public BpInterface<ICameraServiceProxy> {
public:
- BpCameraServiceProxy(const sp<IBinder>& impl) : BpInterface<ICameraServiceProxy>(impl) {}
+ explicit BpCameraServiceProxy(const sp<IBinder>& impl)
+ : BpInterface<ICameraServiceProxy>(impl) {}
virtual void pingForUserUpdate() {
Parcel data;
diff --git a/camera/tests/Android.mk b/camera/tests/Android.mk
index 8019999..0978a81 100644
--- a/camera/tests/Android.mk
+++ b/camera/tests/Android.mk
@@ -21,6 +21,7 @@
CameraBinderTests.cpp
LOCAL_SHARED_LIBRARIES := \
+ liblog \
libutils \
libcutils \
libcamera_metadata \
diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp
index ca68722..2bb35cb 100644
--- a/cmds/stagefright/stagefright.cpp
+++ b/cmds/stagefright/stagefright.cpp
@@ -401,7 +401,7 @@
////////////////////////////////////////////////////////////////////////////////
struct DetectSyncSource : public MediaSource {
- DetectSyncSource(const sp<IMediaSource> &source);
+ explicit DetectSyncSource(const sp<IMediaSource> &source);
virtual status_t start(MetaData *params = NULL);
virtual status_t stop();
diff --git a/cmds/stagefright/stream.cpp b/cmds/stagefright/stream.cpp
index bca3832..16ff39d 100644
--- a/cmds/stagefright/stream.cpp
+++ b/cmds/stagefright/stream.cpp
@@ -45,7 +45,7 @@
struct MyStreamSource : public BnStreamSource {
// Object assumes ownership of fd.
- MyStreamSource(int fd);
+ explicit MyStreamSource(int fd);
virtual void setListener(const sp<IStreamListener> &listener);
virtual void setBuffers(const Vector<sp<IMemory> > &buffers);
@@ -125,7 +125,7 @@
////////////////////////////////////////////////////////////////////////////////
struct MyConvertingStreamSource : public BnStreamSource {
- MyConvertingStreamSource(const char *filename);
+ explicit MyConvertingStreamSource(const char *filename);
virtual void setListener(const sp<IStreamListener> &listener);
virtual void setBuffers(const Vector<sp<IMemory> > &buffers);
diff --git a/drm/common/Android.mk b/drm/common/Android.mk
index db67534..ca3d2cd 100644
--- a/drm/common/Android.mk
+++ b/drm/common/Android.mk
@@ -31,6 +31,8 @@
DrmInfoEvent.cpp \
ReadWriteUtils.cpp
+LOCAL_STATIC_LIBRARIES := libbinder
+
LOCAL_C_INCLUDES := \
$(TOP)/frameworks/av/include \
$(TOP)/frameworks/av/drm/libdrmframework/include \
diff --git a/drm/libdrmframework/plugins/common/util/src/MimeTypeUtil.cpp b/drm/libdrmframework/plugins/common/util/src/MimeTypeUtil.cpp
index 4bd1adb..3b1566f 100644
--- a/drm/libdrmframework/plugins/common/util/src/MimeTypeUtil.cpp
+++ b/drm/libdrmframework/plugins/common/util/src/MimeTypeUtil.cpp
@@ -115,7 +115,7 @@
* replacement mimetype otherwise the original mimetype
* is returned.
*
- * If the mimetype is of unsupported group i.e. application / *
+ * If the mimetype is of unsupported group i.e. application/...
* then "unsupported/drm.mimetype" will be returned.
*
* @param mimeType - mimetype in lower case to convert.
diff --git a/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp b/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp
index 084e323..7f5b0ec 100644
--- a/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp
+++ b/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp
@@ -52,12 +52,12 @@
}
-DrmMetadata* DrmPassthruPlugIn::onGetMetadata(int uniqueId, const String8* path) {
+DrmMetadata* DrmPassthruPlugIn::onGetMetadata(int /*uniqueId*/, const String8* /*path*/) {
return NULL;
}
DrmConstraints* DrmPassthruPlugIn::onGetConstraints(
- int uniqueId, const String8* path, int action) {
+ int uniqueId, const String8* /*path*/, int /*action*/) {
ALOGV("DrmPassthruPlugIn::onGetConstraints From Path: %d", uniqueId);
DrmConstraints* drmConstraints = new DrmConstraints();
@@ -108,7 +108,7 @@
}
status_t DrmPassthruPlugIn::onSetOnInfoListener(
- int uniqueId, const IDrmEngine::OnInfoListener* infoListener) {
+ int uniqueId, const IDrmEngine::OnInfoListener* /*infoListener*/) {
ALOGV("DrmPassthruPlugIn::onSetOnInfoListener : %d", uniqueId);
return DRM_NO_ERROR;
}
@@ -135,8 +135,8 @@
return drmSupportInfo;
}
-status_t DrmPassthruPlugIn::onSaveRights(int uniqueId, const DrmRights& drmRights,
- const String8& rightsPath, const String8& contentPath) {
+status_t DrmPassthruPlugIn::onSaveRights(int uniqueId, const DrmRights& /*drmRights*/,
+ const String8& /*rightsPath*/, const String8& /*contentPath*/) {
ALOGV("DrmPassthruPlugIn::onSaveRights : %d", uniqueId);
return DRM_NO_ERROR;
}
@@ -157,49 +157,50 @@
return drmInfo;
}
-bool DrmPassthruPlugIn::onCanHandle(int uniqueId, const String8& path) {
+bool DrmPassthruPlugIn::onCanHandle(int /*uniqueId*/, const String8& path) {
ALOGV("DrmPassthruPlugIn::canHandle: %s ", path.string());
String8 extension = path.getPathExtension();
extension.toLower();
return (String8(".passthru") == extension);
}
-String8 DrmPassthruPlugIn::onGetOriginalMimeType(int uniqueId, const String8& path, int fd) {
+String8 DrmPassthruPlugIn::onGetOriginalMimeType(int uniqueId,
+ const String8& /*path*/, int /*fd*/) {
ALOGV("DrmPassthruPlugIn::onGetOriginalMimeType() : %d", uniqueId);
return String8("video/passthru");
}
int DrmPassthruPlugIn::onGetDrmObjectType(
- int uniqueId, const String8& path, const String8& mimeType) {
+ int uniqueId, const String8& /*path*/, const String8& /*mimeType*/) {
ALOGV("DrmPassthruPlugIn::onGetDrmObjectType() : %d", uniqueId);
return DrmObjectType::UNKNOWN;
}
-int DrmPassthruPlugIn::onCheckRightsStatus(int uniqueId, const String8& path, int action) {
+int DrmPassthruPlugIn::onCheckRightsStatus(int uniqueId, const String8& /*path*/, int /*action*/) {
ALOGV("DrmPassthruPlugIn::onCheckRightsStatus() : %d", uniqueId);
int rightsStatus = RightsStatus::RIGHTS_VALID;
return rightsStatus;
}
-status_t DrmPassthruPlugIn::onConsumeRights(int uniqueId, DecryptHandle* decryptHandle,
- int action, bool reserve) {
+status_t DrmPassthruPlugIn::onConsumeRights(int uniqueId,
+ DecryptHandle* /*decryptHandle*/, int /*action*/, bool /*reserve*/) {
ALOGV("DrmPassthruPlugIn::onConsumeRights() : %d", uniqueId);
return DRM_NO_ERROR;
}
-status_t DrmPassthruPlugIn::onSetPlaybackStatus(int uniqueId, DecryptHandle* decryptHandle,
- int playbackStatus, int64_t position) {
+status_t DrmPassthruPlugIn::onSetPlaybackStatus(int uniqueId,
+ DecryptHandle* /*decryptHandle*/, int /*playbackStatus*/, int64_t /*position*/) {
ALOGV("DrmPassthruPlugIn::onSetPlaybackStatus() : %d", uniqueId);
return DRM_NO_ERROR;
}
-bool DrmPassthruPlugIn::onValidateAction(int uniqueId, const String8& path,
- int action, const ActionDescription& description) {
+bool DrmPassthruPlugIn::onValidateAction(int uniqueId,
+ const String8& /*path*/, int /*action*/, const ActionDescription& /*description*/) {
ALOGV("DrmPassthruPlugIn::onValidateAction() : %d", uniqueId);
return true;
}
-status_t DrmPassthruPlugIn::onRemoveRights(int uniqueId, const String8& path) {
+status_t DrmPassthruPlugIn::onRemoveRights(int uniqueId, const String8& /*path*/) {
ALOGV("DrmPassthruPlugIn::onRemoveRights() : %d", uniqueId);
return DRM_NO_ERROR;
}
@@ -209,13 +210,13 @@
return DRM_NO_ERROR;
}
-status_t DrmPassthruPlugIn::onOpenConvertSession(int uniqueId, int convertId) {
+status_t DrmPassthruPlugIn::onOpenConvertSession(int uniqueId, int /*convertId*/) {
ALOGV("DrmPassthruPlugIn::onOpenConvertSession() : %d", uniqueId);
return DRM_NO_ERROR;
}
DrmConvertedStatus* DrmPassthruPlugIn::onConvertData(
- int uniqueId, int convertId, const DrmBuffer* inputData) {
+ int uniqueId, int /*convertId*/, const DrmBuffer* inputData) {
ALOGV("DrmPassthruPlugIn::onConvertData() : %d", uniqueId);
DrmBuffer* convertedData = NULL;
@@ -229,13 +230,13 @@
return new DrmConvertedStatus(DrmConvertedStatus::STATUS_OK, convertedData, 0 /*offset*/);
}
-DrmConvertedStatus* DrmPassthruPlugIn::onCloseConvertSession(int uniqueId, int convertId) {
+DrmConvertedStatus* DrmPassthruPlugIn::onCloseConvertSession(int uniqueId, int /*convertId*/) {
ALOGV("DrmPassthruPlugIn::onCloseConvertSession() : %d", uniqueId);
return new DrmConvertedStatus(DrmConvertedStatus::STATUS_OK, NULL, 0 /*offset*/);
}
status_t DrmPassthruPlugIn::onOpenDecryptSession(
- int uniqueId, DecryptHandle* decryptHandle, int fd, off64_t offset, off64_t length) {
+ int uniqueId, DecryptHandle* decryptHandle, int /*fd*/, off64_t /*offset*/, off64_t /*length*/) {
ALOGV("DrmPassthruPlugIn::onOpenDecryptSession() : %d", uniqueId);
#ifdef ENABLE_PASSTHRU_DECRYPTION
@@ -250,7 +251,7 @@
}
status_t DrmPassthruPlugIn::onOpenDecryptSession(
- int uniqueId, DecryptHandle* decryptHandle, const char* uri) {
+ int /*uniqueId*/, DecryptHandle* /*decryptHandle*/, const char* /*uri*/) {
return DRM_ERROR_CANNOT_HANDLE;
}
@@ -265,14 +266,14 @@
return DRM_NO_ERROR;
}
-status_t DrmPassthruPlugIn::onInitializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle,
- int decryptUnitId, const DrmBuffer* headerInfo) {
+status_t DrmPassthruPlugIn::onInitializeDecryptUnit(int uniqueId, DecryptHandle* /*decryptHandle*/,
+ int /*decryptUnitId*/, const DrmBuffer* /*headerInfo*/) {
ALOGV("DrmPassthruPlugIn::onInitializeDecryptUnit() : %d", uniqueId);
return DRM_NO_ERROR;
}
-status_t DrmPassthruPlugIn::onDecrypt(int uniqueId, DecryptHandle* decryptHandle,
- int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) {
+status_t DrmPassthruPlugIn::onDecrypt(int uniqueId, DecryptHandle* /*decryptHandle*/,
+ int /*decryptUnitId*/, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* /*IV*/) {
ALOGV("DrmPassthruPlugIn::onDecrypt() : %d", uniqueId);
/**
* As a workaround implementation passthru would copy the given
@@ -293,13 +294,13 @@
}
status_t DrmPassthruPlugIn::onFinalizeDecryptUnit(
- int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) {
+ int uniqueId, DecryptHandle* /*decryptHandle*/, int /*decryptUnitId*/) {
ALOGV("DrmPassthruPlugIn::onFinalizeDecryptUnit() : %d", uniqueId);
return DRM_NO_ERROR;
}
-ssize_t DrmPassthruPlugIn::onPread(int uniqueId, DecryptHandle* decryptHandle,
- void* buffer, ssize_t numBytes, off64_t offset) {
+ssize_t DrmPassthruPlugIn::onPread(int uniqueId, DecryptHandle* /*decryptHandle*/,
+ void* /*buffer*/, ssize_t /*numBytes*/, off64_t /*offset*/) {
ALOGV("DrmPassthruPlugIn::onPread() : %d", uniqueId);
return 0;
}
diff --git a/include/media/stagefright/ACodec.h b/include/media/stagefright/ACodec.h
index d14bb7b..e369897 100644
--- a/include/media/stagefright/ACodec.h
+++ b/include/media/stagefright/ACodec.h
@@ -238,6 +238,7 @@
sp<IdleToLoadedState> mIdleToLoadedState;
sp<FlushingState> mFlushingState;
sp<SkipCutBuffer> mSkipCutBuffer;
+ int32_t mSampleRate;
AString mComponentName;
uint32_t mFlags;
diff --git a/media/common_time/ICommonClock.cpp b/media/common_time/ICommonClock.cpp
index 19b7d6e..f1f1fca 100644
--- a/media/common_time/ICommonClock.cpp
+++ b/media/common_time/ICommonClock.cpp
@@ -48,7 +48,7 @@
class BpCommonClock : public BpInterface<ICommonClock>
{
public:
- BpCommonClock(const sp<IBinder>& impl)
+ explicit BpCommonClock(const sp<IBinder>& impl)
: BpInterface<ICommonClock>(impl) {}
virtual status_t isCommonTimeValid(bool* valid, uint32_t* timelineID) {
@@ -401,7 +401,7 @@
class BpCommonClockListener : public BpInterface<ICommonClockListener>
{
public:
- BpCommonClockListener(const sp<IBinder>& impl)
+ explicit BpCommonClockListener(const sp<IBinder>& impl)
: BpInterface<ICommonClockListener>(impl) {}
virtual void onTimelineChanged(uint64_t timelineID) {
diff --git a/media/common_time/ICommonTimeConfig.cpp b/media/common_time/ICommonTimeConfig.cpp
index 67167b0..e587b39 100644
--- a/media/common_time/ICommonTimeConfig.cpp
+++ b/media/common_time/ICommonTimeConfig.cpp
@@ -50,7 +50,7 @@
class BpCommonTimeConfig : public BpInterface<ICommonTimeConfig>
{
public:
- BpCommonTimeConfig(const sp<IBinder>& impl)
+ explicit BpCommonTimeConfig(const sp<IBinder>& impl)
: BpInterface<ICommonTimeConfig>(impl) {}
virtual status_t getMasterElectionPriority(uint8_t *priority) {
diff --git a/media/common_time/cc_helper.cpp b/media/common_time/cc_helper.cpp
index 8d8556c..6a7de74 100644
--- a/media/common_time/cc_helper.cpp
+++ b/media/common_time/cc_helper.cpp
@@ -80,7 +80,7 @@
}
}
-void CCHelper::CommonClockListener::onTimelineChanged(uint64_t timelineID) {
+void CCHelper::CommonClockListener::onTimelineChanged(uint64_t /*timelineID*/) {
// do nothing; listener is only really used as a token so the server can
// find out when clients die.
}
diff --git a/media/img_utils/src/Android.mk b/media/img_utils/src/Android.mk
index 4074849..c1f64ca 100644
--- a/media/img_utils/src/Android.mk
+++ b/media/img_utils/src/Android.mk
@@ -34,6 +34,7 @@
StripSource.cpp \
LOCAL_SHARED_LIBRARIES := \
+ liblog \
libexpat \
libutils \
libcutils \
diff --git a/media/libmedia/Android.mk b/media/libmedia/Android.mk
index 63f9ed7..b6e02be 100644
--- a/media/libmedia/Android.mk
+++ b/media/libmedia/Android.mk
@@ -79,6 +79,8 @@
libcamera_client libstagefright_foundation \
libgui libdl libaudioutils libnbaio
+LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := libbinder
+
LOCAL_WHOLE_STATIC_LIBRARIES := libmedia_helper
LOCAL_MODULE:= libmedia
diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp
index aa75188..c0d2fec 100644
--- a/media/libmedia/IAudioFlinger.cpp
+++ b/media/libmedia/IAudioFlinger.cpp
@@ -90,7 +90,7 @@
class BpAudioFlinger : public BpInterface<IAudioFlinger>
{
public:
- BpAudioFlinger(const sp<IBinder>& impl)
+ explicit BpAudioFlinger(const sp<IBinder>& impl)
: BpInterface<IAudioFlinger>(impl)
{
}
diff --git a/media/libmedia/IAudioFlingerClient.cpp b/media/libmedia/IAudioFlingerClient.cpp
index 8dca9e9..b2dbc4c 100644
--- a/media/libmedia/IAudioFlingerClient.cpp
+++ b/media/libmedia/IAudioFlingerClient.cpp
@@ -34,7 +34,7 @@
class BpAudioFlingerClient : public BpInterface<IAudioFlingerClient>
{
public:
- BpAudioFlingerClient(const sp<IBinder>& impl)
+ explicit BpAudioFlingerClient(const sp<IBinder>& impl)
: BpInterface<IAudioFlingerClient>(impl)
{
}
diff --git a/media/libmedia/IAudioPolicyService.cpp b/media/libmedia/IAudioPolicyService.cpp
index 4ea67da..a64cdc5 100644
--- a/media/libmedia/IAudioPolicyService.cpp
+++ b/media/libmedia/IAudioPolicyService.cpp
@@ -83,7 +83,7 @@
class BpAudioPolicyService : public BpInterface<IAudioPolicyService>
{
public:
- BpAudioPolicyService(const sp<IBinder>& impl)
+ explicit BpAudioPolicyService(const sp<IBinder>& impl)
: BpInterface<IAudioPolicyService>(impl)
{
}
diff --git a/media/libmedia/IAudioPolicyServiceClient.cpp b/media/libmedia/IAudioPolicyServiceClient.cpp
index 5f931e5..98a0521 100644
--- a/media/libmedia/IAudioPolicyServiceClient.cpp
+++ b/media/libmedia/IAudioPolicyServiceClient.cpp
@@ -52,7 +52,7 @@
class BpAudioPolicyServiceClient : public BpInterface<IAudioPolicyServiceClient>
{
public:
- BpAudioPolicyServiceClient(const sp<IBinder>& impl)
+ explicit BpAudioPolicyServiceClient(const sp<IBinder>& impl)
: BpInterface<IAudioPolicyServiceClient>(impl)
{
}
diff --git a/media/libmedia/IAudioRecord.cpp b/media/libmedia/IAudioRecord.cpp
index ae66436..1331c0d 100644
--- a/media/libmedia/IAudioRecord.cpp
+++ b/media/libmedia/IAudioRecord.cpp
@@ -37,7 +37,7 @@
class BpAudioRecord : public BpInterface<IAudioRecord>
{
public:
- BpAudioRecord(const sp<IBinder>& impl)
+ explicit BpAudioRecord(const sp<IBinder>& impl)
: BpInterface<IAudioRecord>(impl)
{
}
diff --git a/media/libmedia/IAudioTrack.cpp b/media/libmedia/IAudioTrack.cpp
index 636e3bb..89e0fcc 100644
--- a/media/libmedia/IAudioTrack.cpp
+++ b/media/libmedia/IAudioTrack.cpp
@@ -44,7 +44,7 @@
class BpAudioTrack : public BpInterface<IAudioTrack>
{
public:
- BpAudioTrack(const sp<IBinder>& impl)
+ explicit BpAudioTrack(const sp<IBinder>& impl)
: BpInterface<IAudioTrack>(impl)
{
}
diff --git a/media/libmedia/ICrypto.cpp b/media/libmedia/ICrypto.cpp
index 26dd2c9..ee7f757 100644
--- a/media/libmedia/ICrypto.cpp
+++ b/media/libmedia/ICrypto.cpp
@@ -39,7 +39,7 @@
};
struct BpCrypto : public BpInterface<ICrypto> {
- BpCrypto(const sp<IBinder> &impl)
+ explicit BpCrypto(const sp<IBinder> &impl)
: BpInterface<ICrypto>(impl) {
}
diff --git a/media/libmedia/IDataSource.cpp b/media/libmedia/IDataSource.cpp
index 7aeba5a..9da1a70 100644
--- a/media/libmedia/IDataSource.cpp
+++ b/media/libmedia/IDataSource.cpp
@@ -37,7 +37,8 @@
};
struct BpDataSource : public BpInterface<IDataSource> {
- BpDataSource(const sp<IBinder>& impl) : BpInterface<IDataSource>(impl) {}
+ explicit BpDataSource(const sp<IBinder>& impl)
+ : BpInterface<IDataSource>(impl) {}
virtual sp<IMemory> getIMemory() {
Parcel data, reply;
diff --git a/media/libmedia/IDrm.cpp b/media/libmedia/IDrm.cpp
index 7f131f4..d2b3aae 100644
--- a/media/libmedia/IDrm.cpp
+++ b/media/libmedia/IDrm.cpp
@@ -59,7 +59,7 @@
};
struct BpDrm : public BpInterface<IDrm> {
- BpDrm(const sp<IBinder> &impl)
+ explicit BpDrm(const sp<IBinder> &impl)
: BpInterface<IDrm>(impl) {
}
diff --git a/media/libmedia/IDrmClient.cpp b/media/libmedia/IDrmClient.cpp
index 490c6ed..444201f 100644
--- a/media/libmedia/IDrmClient.cpp
+++ b/media/libmedia/IDrmClient.cpp
@@ -35,7 +35,7 @@
class BpDrmClient: public BpInterface<IDrmClient>
{
public:
- BpDrmClient(const sp<IBinder>& impl)
+ explicit BpDrmClient(const sp<IBinder>& impl)
: BpInterface<IDrmClient>(impl)
{
}
diff --git a/media/libmedia/IEffect.cpp b/media/libmedia/IEffect.cpp
index faf5795..115ca75 100644
--- a/media/libmedia/IEffect.cpp
+++ b/media/libmedia/IEffect.cpp
@@ -36,7 +36,7 @@
class BpEffect: public BpInterface<IEffect>
{
public:
- BpEffect(const sp<IBinder>& impl)
+ explicit BpEffect(const sp<IBinder>& impl)
: BpInterface<IEffect>(impl)
{
}
diff --git a/media/libmedia/IEffectClient.cpp b/media/libmedia/IEffectClient.cpp
index 1322e72..3f2c67d 100644
--- a/media/libmedia/IEffectClient.cpp
+++ b/media/libmedia/IEffectClient.cpp
@@ -33,7 +33,7 @@
class BpEffectClient: public BpInterface<IEffectClient>
{
public:
- BpEffectClient(const sp<IBinder>& impl)
+ explicit BpEffectClient(const sp<IBinder>& impl)
: BpInterface<IEffectClient>(impl)
{
}
diff --git a/media/libmedia/IHDCP.cpp b/media/libmedia/IHDCP.cpp
index f3a8902..21e35f6 100644
--- a/media/libmedia/IHDCP.cpp
+++ b/media/libmedia/IHDCP.cpp
@@ -37,7 +37,7 @@
};
struct BpHDCPObserver : public BpInterface<IHDCPObserver> {
- BpHDCPObserver(const sp<IBinder> &impl)
+ explicit BpHDCPObserver(const sp<IBinder> &impl)
: BpInterface<IHDCPObserver>(impl) {
}
@@ -58,7 +58,7 @@
IMPLEMENT_META_INTERFACE(HDCPObserver, "android.hardware.IHDCPObserver");
struct BpHDCP : public BpInterface<IHDCP> {
- BpHDCP(const sp<IBinder> &impl)
+ explicit BpHDCP(const sp<IBinder> &impl)
: BpInterface<IHDCP>(impl) {
}
diff --git a/media/libmedia/IMediaCodecList.cpp b/media/libmedia/IMediaCodecList.cpp
index 737f50c..806f46d 100644
--- a/media/libmedia/IMediaCodecList.cpp
+++ b/media/libmedia/IMediaCodecList.cpp
@@ -38,7 +38,7 @@
class BpMediaCodecList: public BpInterface<IMediaCodecList>
{
public:
- BpMediaCodecList(const sp<IBinder>& impl)
+ explicit BpMediaCodecList(const sp<IBinder>& impl)
: BpInterface<IMediaCodecList>(impl)
{
}
diff --git a/media/libmedia/IMediaHTTPConnection.cpp b/media/libmedia/IMediaHTTPConnection.cpp
index 0dda0be9..e4b717b 100644
--- a/media/libmedia/IMediaHTTPConnection.cpp
+++ b/media/libmedia/IMediaHTTPConnection.cpp
@@ -38,7 +38,7 @@
};
struct BpMediaHTTPConnection : public BpInterface<IMediaHTTPConnection> {
- BpMediaHTTPConnection(const sp<IBinder> &impl)
+ explicit BpMediaHTTPConnection(const sp<IBinder> &impl)
: BpInterface<IMediaHTTPConnection>(impl) {
}
diff --git a/media/libmedia/IMediaHTTPService.cpp b/media/libmedia/IMediaHTTPService.cpp
index 0c16a2b..062a07a 100644
--- a/media/libmedia/IMediaHTTPService.cpp
+++ b/media/libmedia/IMediaHTTPService.cpp
@@ -30,7 +30,7 @@
};
struct BpMediaHTTPService : public BpInterface<IMediaHTTPService> {
- BpMediaHTTPService(const sp<IBinder> &impl)
+ explicit BpMediaHTTPService(const sp<IBinder> &impl)
: BpInterface<IMediaHTTPService>(impl) {
}
diff --git a/media/libmedia/IMediaLogService.cpp b/media/libmedia/IMediaLogService.cpp
index 1536337..bc445ff 100644
--- a/media/libmedia/IMediaLogService.cpp
+++ b/media/libmedia/IMediaLogService.cpp
@@ -34,7 +34,7 @@
class BpMediaLogService : public BpInterface<IMediaLogService>
{
public:
- BpMediaLogService(const sp<IBinder>& impl)
+ explicit BpMediaLogService(const sp<IBinder>& impl)
: BpInterface<IMediaLogService>(impl)
{
}
diff --git a/media/libmedia/IMediaMetadataRetriever.cpp b/media/libmedia/IMediaMetadataRetriever.cpp
index 0bee8d3..7058ee8 100644
--- a/media/libmedia/IMediaMetadataRetriever.cpp
+++ b/media/libmedia/IMediaMetadataRetriever.cpp
@@ -75,7 +75,7 @@
class BpMediaMetadataRetriever: public BpInterface<IMediaMetadataRetriever>
{
public:
- BpMediaMetadataRetriever(const sp<IBinder>& impl)
+ explicit BpMediaMetadataRetriever(const sp<IBinder>& impl)
: BpInterface<IMediaMetadataRetriever>(impl)
{
}
diff --git a/media/libmedia/IMediaPlayer.cpp b/media/libmedia/IMediaPlayer.cpp
index 519a1fd..f8345e4 100644
--- a/media/libmedia/IMediaPlayer.cpp
+++ b/media/libmedia/IMediaPlayer.cpp
@@ -72,7 +72,7 @@
class BpMediaPlayer: public BpInterface<IMediaPlayer>
{
public:
- BpMediaPlayer(const sp<IBinder>& impl)
+ explicit BpMediaPlayer(const sp<IBinder>& impl)
: BpInterface<IMediaPlayer>(impl)
{
}
diff --git a/media/libmedia/IMediaPlayerClient.cpp b/media/libmedia/IMediaPlayerClient.cpp
index d608386..bbf8475 100644
--- a/media/libmedia/IMediaPlayerClient.cpp
+++ b/media/libmedia/IMediaPlayerClient.cpp
@@ -30,7 +30,7 @@
class BpMediaPlayerClient: public BpInterface<IMediaPlayerClient>
{
public:
- BpMediaPlayerClient(const sp<IBinder>& impl)
+ explicit BpMediaPlayerClient(const sp<IBinder>& impl)
: BpInterface<IMediaPlayerClient>(impl)
{
}
diff --git a/media/libmedia/IMediaPlayerService.cpp b/media/libmedia/IMediaPlayerService.cpp
index 7590c1b..a01852c 100644
--- a/media/libmedia/IMediaPlayerService.cpp
+++ b/media/libmedia/IMediaPlayerService.cpp
@@ -50,7 +50,7 @@
class BpMediaPlayerService: public BpInterface<IMediaPlayerService>
{
public:
- BpMediaPlayerService(const sp<IBinder>& impl)
+ explicit BpMediaPlayerService(const sp<IBinder>& impl)
: BpInterface<IMediaPlayerService>(impl)
{
}
diff --git a/media/libmedia/IMediaRecorder.cpp b/media/libmedia/IMediaRecorder.cpp
index cded55c..a6860e2 100644
--- a/media/libmedia/IMediaRecorder.cpp
+++ b/media/libmedia/IMediaRecorder.cpp
@@ -63,7 +63,7 @@
class BpMediaRecorder: public BpInterface<IMediaRecorder>
{
public:
- BpMediaRecorder(const sp<IBinder>& impl)
+ explicit BpMediaRecorder(const sp<IBinder>& impl)
: BpInterface<IMediaRecorder>(impl)
{
}
diff --git a/media/libmedia/IMediaRecorderClient.cpp b/media/libmedia/IMediaRecorderClient.cpp
index 6795d23..a76f934 100644
--- a/media/libmedia/IMediaRecorderClient.cpp
+++ b/media/libmedia/IMediaRecorderClient.cpp
@@ -30,7 +30,7 @@
class BpMediaRecorderClient: public BpInterface<IMediaRecorderClient>
{
public:
- BpMediaRecorderClient(const sp<IBinder>& impl)
+ explicit BpMediaRecorderClient(const sp<IBinder>& impl)
: BpInterface<IMediaRecorderClient>(impl)
{
}
diff --git a/media/libmedia/IOMX.cpp b/media/libmedia/IOMX.cpp
index 8ebb355..b5c4006 100644
--- a/media/libmedia/IOMX.cpp
+++ b/media/libmedia/IOMX.cpp
@@ -66,7 +66,7 @@
class BpOMX : public BpInterface<IOMX> {
public:
- BpOMX(const sp<IBinder> &impl)
+ explicit BpOMX(const sp<IBinder> &impl)
: BpInterface<IOMX>(impl) {
}
@@ -1227,7 +1227,7 @@
class BpOMXObserver : public BpInterface<IOMXObserver> {
public:
- BpOMXObserver(const sp<IBinder> &impl)
+ explicit BpOMXObserver(const sp<IBinder> &impl)
: BpInterface<IOMXObserver>(impl) {
}
diff --git a/media/libmedia/IRemoteDisplay.cpp b/media/libmedia/IRemoteDisplay.cpp
index 869d11a..85c7bd6 100644
--- a/media/libmedia/IRemoteDisplay.cpp
+++ b/media/libmedia/IRemoteDisplay.cpp
@@ -30,7 +30,7 @@
class BpRemoteDisplay: public BpInterface<IRemoteDisplay>
{
public:
- BpRemoteDisplay(const sp<IBinder>& impl)
+ explicit BpRemoteDisplay(const sp<IBinder>& impl)
: BpInterface<IRemoteDisplay>(impl)
{
}
diff --git a/media/libmedia/IRemoteDisplayClient.cpp b/media/libmedia/IRemoteDisplayClient.cpp
index bedeb6c..ca67665 100644
--- a/media/libmedia/IRemoteDisplayClient.cpp
+++ b/media/libmedia/IRemoteDisplayClient.cpp
@@ -32,7 +32,7 @@
class BpRemoteDisplayClient: public BpInterface<IRemoteDisplayClient>
{
public:
- BpRemoteDisplayClient(const sp<IBinder>& impl)
+ explicit BpRemoteDisplayClient(const sp<IBinder>& impl)
: BpInterface<IRemoteDisplayClient>(impl)
{
}
diff --git a/media/libmedia/IResourceManagerClient.cpp b/media/libmedia/IResourceManagerClient.cpp
index b3f56e8..1fea479 100644
--- a/media/libmedia/IResourceManagerClient.cpp
+++ b/media/libmedia/IResourceManagerClient.cpp
@@ -31,7 +31,7 @@
class BpResourceManagerClient: public BpInterface<IResourceManagerClient>
{
public:
- BpResourceManagerClient(const sp<IBinder> &impl)
+ explicit BpResourceManagerClient(const sp<IBinder> &impl)
: BpInterface<IResourceManagerClient>(impl)
{
}
diff --git a/media/libmedia/IResourceManagerService.cpp b/media/libmedia/IResourceManagerService.cpp
index 6cb4440..95f7d2e 100644
--- a/media/libmedia/IResourceManagerService.cpp
+++ b/media/libmedia/IResourceManagerService.cpp
@@ -58,7 +58,7 @@
class BpResourceManagerService : public BpInterface<IResourceManagerService>
{
public:
- BpResourceManagerService(const sp<IBinder> &impl)
+ explicit BpResourceManagerService(const sp<IBinder> &impl)
: BpInterface<IResourceManagerService>(impl)
{
}
diff --git a/media/libmedia/IStreamSource.cpp b/media/libmedia/IStreamSource.cpp
index 8c0905c..ba0a272 100644
--- a/media/libmedia/IStreamSource.cpp
+++ b/media/libmedia/IStreamSource.cpp
@@ -51,7 +51,7 @@
};
struct BpStreamSource : public BpInterface<IStreamSource> {
- BpStreamSource(const sp<IBinder> &impl)
+ explicit BpStreamSource(const sp<IBinder> &impl)
: BpInterface<IStreamSource>(impl) {
}
@@ -145,7 +145,7 @@
////////////////////////////////////////////////////////////////////////////////
struct BpStreamListener : public BpInterface<IStreamListener> {
- BpStreamListener(const sp<IBinder> &impl)
+ explicit BpStreamListener(const sp<IBinder> &impl)
: BpInterface<IStreamListener>(impl) {
}
diff --git a/media/libmedia/ToneGenerator.cpp b/media/libmedia/ToneGenerator.cpp
index 411519d..0928bdc 100644
--- a/media/libmedia/ToneGenerator.cpp
+++ b/media/libmedia/ToneGenerator.cpp
@@ -833,9 +833,12 @@
char value[PROPERTY_VALUE_MAX];
property_get("gsm.operator.iso-country", value, "");
if (strcmp(value,"us") == 0 ||
- strcmp(value,"ca") == 0) {
+ strcmp(value,"us,us") == 0 ||
+ strcmp(value,"ca") == 0 ||
+ strcmp(value,"ca,ca") == 0) {
mRegion = ANSI;
- } else if (strcmp(value,"jp") == 0) {
+ } else if (strcmp(value,"jp") == 0 ||
+ strcmp(value,"jp,jp") == 0) {
mRegion = JAPAN;
} else if (strcmp(value,"uk") == 0 ||
strcmp(value,"uk,uk") == 0) {
diff --git a/media/libmediaplayerservice/Android.mk b/media/libmediaplayerservice/Android.mk
index 8d86366..31a6992 100644
--- a/media/libmediaplayerservice/Android.mk
+++ b/media/libmediaplayerservice/Android.mk
@@ -43,6 +43,8 @@
libstagefright_rtsp \
libstagefright_timedtext \
+LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := libmedia
+
LOCAL_C_INCLUDES := \
$(TOP)/frameworks/av/media/libstagefright/include \
$(TOP)/frameworks/av/media/libstagefright/rtsp \
diff --git a/media/libmediaplayerservice/nuplayer/Android.mk b/media/libmediaplayerservice/nuplayer/Android.mk
index cd20837..3ea2159 100644
--- a/media/libmediaplayerservice/nuplayer/Android.mk
+++ b/media/libmediaplayerservice/nuplayer/Android.mk
@@ -34,6 +34,8 @@
LOCAL_CLANG := true
+LOCAL_SHARED_LIBRARIES := libmedia
+
LOCAL_MODULE:= libstagefright_nuplayer
LOCAL_MODULE_TAGS := eng
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
index 46a51ce..de57f9f 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
@@ -69,7 +69,7 @@
};
struct NuPlayer::SeekAction : public Action {
- SeekAction(int64_t seekTimeUs)
+ explicit SeekAction(int64_t seekTimeUs)
: mSeekTimeUs(seekTimeUs) {
}
@@ -84,7 +84,7 @@
};
struct NuPlayer::ResumeDecoderAction : public Action {
- ResumeDecoderAction(bool needNotify)
+ explicit ResumeDecoderAction(bool needNotify)
: mNeedNotify(needNotify) {
}
@@ -99,7 +99,7 @@
};
struct NuPlayer::SetSurfaceAction : public Action {
- SetSurfaceAction(const sp<Surface> &surface)
+ explicit SetSurfaceAction(const sp<Surface> &surface)
: mSurface(surface) {
}
@@ -131,7 +131,7 @@
};
struct NuPlayer::PostMessageAction : public Action {
- PostMessageAction(const sp<AMessage> &msg)
+ explicit PostMessageAction(const sp<AMessage> &msg)
: mMessage(msg) {
}
@@ -150,7 +150,7 @@
struct NuPlayer::SimpleAction : public Action {
typedef void (NuPlayer::*ActionFunc)();
- SimpleAction(ActionFunc func)
+ explicit SimpleAction(ActionFunc func)
: mFunc(func) {
}
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerCCDecoder.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerCCDecoder.cpp
index 13716cf..978d360 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerCCDecoder.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerCCDecoder.cpp
@@ -256,6 +256,12 @@
payload_size += last_byte;
} while (last_byte == 0xFF);
+ if (payload_size > SIZE_MAX / 8
+ || !br.atLeastNumBitsLeft(payload_size * 8)) {
+ ALOGV("Malformed SEI payload");
+ break;
+ }
+
// sei_payload()
if (payload_type == 4) {
bool isCC = false;
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 238cd35..6ff9fdb 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -216,7 +216,7 @@
////////////////////////////////////////////////////////////////////////////////
struct ACodec::BaseState : public AState {
- BaseState(ACodec *codec, const sp<AState> &parentState = NULL);
+ explicit BaseState(ACodec *codec, const sp<AState> &parentState = NULL);
protected:
enum PortMode {
@@ -267,7 +267,7 @@
////////////////////////////////////////////////////////////////////////////////
struct ACodec::DeathNotifier : public IBinder::DeathRecipient {
- DeathNotifier(const sp<AMessage> ¬ify)
+ explicit DeathNotifier(const sp<AMessage> ¬ify)
: mNotify(notify) {
}
@@ -285,7 +285,7 @@
};
struct ACodec::UninitializedState : public ACodec::BaseState {
- UninitializedState(ACodec *codec);
+ explicit UninitializedState(ACodec *codec);
protected:
virtual bool onMessageReceived(const sp<AMessage> &msg);
@@ -303,7 +303,7 @@
////////////////////////////////////////////////////////////////////////////////
struct ACodec::LoadedState : public ACodec::BaseState {
- LoadedState(ACodec *codec);
+ explicit LoadedState(ACodec *codec);
protected:
virtual bool onMessageReceived(const sp<AMessage> &msg);
@@ -326,7 +326,7 @@
////////////////////////////////////////////////////////////////////////////////
struct ACodec::LoadedToIdleState : public ACodec::BaseState {
- LoadedToIdleState(ACodec *codec);
+ explicit LoadedToIdleState(ACodec *codec);
protected:
virtual bool onMessageReceived(const sp<AMessage> &msg);
@@ -342,7 +342,7 @@
////////////////////////////////////////////////////////////////////////////////
struct ACodec::IdleToExecutingState : public ACodec::BaseState {
- IdleToExecutingState(ACodec *codec);
+ explicit IdleToExecutingState(ACodec *codec);
protected:
virtual bool onMessageReceived(const sp<AMessage> &msg);
@@ -356,7 +356,7 @@
////////////////////////////////////////////////////////////////////////////////
struct ACodec::ExecutingState : public ACodec::BaseState {
- ExecutingState(ACodec *codec);
+ explicit ExecutingState(ACodec *codec);
void submitRegularOutputBuffers();
void submitOutputMetaBuffers();
@@ -386,7 +386,7 @@
////////////////////////////////////////////////////////////////////////////////
struct ACodec::OutputPortSettingsChangedState : public ACodec::BaseState {
- OutputPortSettingsChangedState(ACodec *codec);
+ explicit OutputPortSettingsChangedState(ACodec *codec);
protected:
virtual PortMode getPortMode(OMX_U32 portIndex);
@@ -403,7 +403,7 @@
////////////////////////////////////////////////////////////////////////////////
struct ACodec::ExecutingToIdleState : public ACodec::BaseState {
- ExecutingToIdleState(ACodec *codec);
+ explicit ExecutingToIdleState(ACodec *codec);
protected:
virtual bool onMessageReceived(const sp<AMessage> &msg);
@@ -425,7 +425,7 @@
////////////////////////////////////////////////////////////////////////////////
struct ACodec::IdleToLoadedState : public ACodec::BaseState {
- IdleToLoadedState(ACodec *codec);
+ explicit IdleToLoadedState(ACodec *codec);
protected:
virtual bool onMessageReceived(const sp<AMessage> &msg);
@@ -440,7 +440,7 @@
////////////////////////////////////////////////////////////////////////////////
struct ACodec::FlushingState : public ACodec::BaseState {
- FlushingState(ACodec *codec);
+ explicit FlushingState(ACodec *codec);
protected:
virtual bool onMessageReceived(const sp<AMessage> &msg);
@@ -494,7 +494,8 @@
////////////////////////////////////////////////////////////////////////////////
ACodec::ACodec()
- : mQuirks(0),
+ : mSampleRate(0),
+ mQuirks(0),
mNode(0),
mUsingNativeWindow(false),
mNativeWindowUsageBits(0),
@@ -2657,6 +2658,7 @@
} else {
ALOGW("did not set AudioAndroidAacPresentation due to error %d when setting AudioAac", res);
}
+ mSampleRate = sampleRate;
return res;
}
@@ -5215,8 +5217,14 @@
CHECK(mOutputFormat->findString("mime", &mime));
if (mime == MEDIA_MIMETYPE_AUDIO_RAW && (mEncoderDelay || mEncoderPadding)) {
- int32_t channelCount;
+ int32_t channelCount, sampleRate;
CHECK(mOutputFormat->findInt32("channel-count", &channelCount));
+ CHECK(mOutputFormat->findInt32("sample-rate", &sampleRate));
+ if (mSampleRate != 0 && sampleRate != 0) {
+ mEncoderDelay = mEncoderDelay * sampleRate / mSampleRate;
+ mEncoderPadding = mEncoderPadding * sampleRate / mSampleRate;
+ mSampleRate = sampleRate;
+ }
if (mSkipCutBuffer != NULL) {
size_t prevbufsize = mSkipCutBuffer->size();
if (prevbufsize != 0) {
diff --git a/media/libstagefright/Android.mk b/media/libstagefright/Android.mk
index 2445842..c8aa2e3 100644
--- a/media/libstagefright/Android.mk
+++ b/media/libstagefright/Android.mk
@@ -123,6 +123,8 @@
libdl \
libRScpp \
+LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := libmedia
+
LOCAL_CFLAGS += -Wno-multichar -Werror -Wno-error=deprecated-declarations -Wall
# enable experiments only in userdebug and eng builds
diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp
index e087249..5fc9237 100644
--- a/media/libstagefright/CameraSource.cpp
+++ b/media/libstagefright/CameraSource.cpp
@@ -47,7 +47,7 @@
static const int64_t CAMERA_SOURCE_TIMEOUT_NS = 3000000000LL;
struct CameraSourceListener : public CameraListener {
- CameraSourceListener(const sp<CameraSource> &source);
+ explicit CameraSourceListener(const sp<CameraSource> &source);
virtual void notify(int32_t msgType, int32_t ext1, int32_t ext2);
virtual void postData(int32_t msgType, const sp<IMemory> &dataPtr,
diff --git a/media/libstagefright/DataURISource.cpp b/media/libstagefright/DataURISource.cpp
index 2a61c3a..3dc345f 100644
--- a/media/libstagefright/DataURISource.cpp
+++ b/media/libstagefright/DataURISource.cpp
@@ -28,7 +28,7 @@
return NULL;
}
- char *commaPos = strrchr(uri, ',');
+ const char *commaPos = strrchr(uri, ',');
if (commaPos == NULL) {
return NULL;
diff --git a/media/libstagefright/FLACExtractor.cpp b/media/libstagefright/FLACExtractor.cpp
index 13b66f3..1af7dc1 100644
--- a/media/libstagefright/FLACExtractor.cpp
+++ b/media/libstagefright/FLACExtractor.cpp
@@ -73,7 +73,7 @@
class FLACParser : public RefBase {
public:
- FLACParser(
+ explicit FLACParser(
const sp<DataSource> &dataSource,
// If metadata pointers aren't provided, we don't fill them
const sp<MetaData> &fileMetadata = 0,
diff --git a/media/libstagefright/MPEG2TSWriter.cpp b/media/libstagefright/MPEG2TSWriter.cpp
index a9e8846..931b280 100644
--- a/media/libstagefright/MPEG2TSWriter.cpp
+++ b/media/libstagefright/MPEG2TSWriter.cpp
@@ -35,7 +35,7 @@
namespace android {
struct MPEG2TSWriter::SourceInfo : public AHandler {
- SourceInfo(const sp<IMediaSource> &source);
+ explicit SourceInfo(const sp<IMediaSource> &source);
void start(const sp<AMessage> ¬ify);
void stop();
diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp
index f296d9a..179be1d 100644
--- a/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/MPEG4Extractor.cpp
@@ -173,7 +173,7 @@
// Each MPEG4DataSource caches the sampletable metadata for a single track.
struct MPEG4DataSource : public DataSource {
- MPEG4DataSource(const sp<DataSource> &source);
+ explicit MPEG4DataSource(const sp<DataSource> &source);
virtual status_t initCheck() const;
virtual ssize_t readAt(off64_t offset, void *data, size_t size);
diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp
index db20590..da3bfce 100644
--- a/media/libstagefright/MPEG4Writer.cpp
+++ b/media/libstagefright/MPEG4Writer.cpp
@@ -620,7 +620,7 @@
if (mMaxFileDurationLimitUs != 0) {
if (bitRate > 0) {
int64_t size2 =
- ((mMaxFileDurationLimitUs * bitRate * 6) / 1000 / 8000000);
+ ((mMaxFileDurationLimitUs / 1000) * bitRate * 6) / 8000000;
if (mMaxFileSizeLimitBytes != 0 && mIsFileSizeLimitExplicitlyRequested) {
// When both file size and duration limits are set,
// we use the smaller limit of the two.
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp
index e8cd58a..a0162ea 100644
--- a/media/libstagefright/MediaCodec.cpp
+++ b/media/libstagefright/MediaCodec.cpp
@@ -65,7 +65,7 @@
static const int kMaxReclaimWaitTimeInUs = 500000; // 0.5s
struct ResourceManagerClient : public BnResourceManagerClient {
- ResourceManagerClient(MediaCodec* codec) : mMediaCodec(codec) {}
+ explicit ResourceManagerClient(MediaCodec* codec) : mMediaCodec(codec) {}
virtual bool reclaimResource() {
sp<MediaCodec> codec = mMediaCodec.promote();
diff --git a/media/libstagefright/MediaCodecList.cpp b/media/libstagefright/MediaCodecList.cpp
index 0fb5072..08bb45d 100644
--- a/media/libstagefright/MediaCodecList.cpp
+++ b/media/libstagefright/MediaCodecList.cpp
@@ -182,7 +182,7 @@
void MediaCodecList::parseTopLevelXMLFile(const char *codecs_xml, bool ignore_errors) {
// get href_base
- char *href_base_end = strrchr(codecs_xml, '/');
+ const char *href_base_end = strrchr(codecs_xml, '/');
if (href_base_end != NULL) {
mHrefBase = AString(codecs_xml, href_base_end - codecs_xml + 1);
}
diff --git a/media/libstagefright/MediaCodecSource.cpp b/media/libstagefright/MediaCodecSource.cpp
index 0aafa6b..d7cf1e9 100644
--- a/media/libstagefright/MediaCodecSource.cpp
+++ b/media/libstagefright/MediaCodecSource.cpp
@@ -47,7 +47,7 @@
const int kStopTimeoutUs = 300000; // allow 1 sec for shutting down encoder
struct MediaCodecSource::Puller : public AHandler {
- Puller(const sp<MediaSource> &source);
+ explicit Puller(const sp<MediaSource> &source);
void interruptSource();
status_t start(const sp<MetaData> &meta, const sp<AMessage> ¬ify);
diff --git a/media/libstagefright/NuCachedSource2.cpp b/media/libstagefright/NuCachedSource2.cpp
index 453db03..afd6ffb 100644
--- a/media/libstagefright/NuCachedSource2.cpp
+++ b/media/libstagefright/NuCachedSource2.cpp
@@ -31,7 +31,7 @@
namespace android {
struct PageCache {
- PageCache(size_t pageSize);
+ explicit PageCache(size_t pageSize);
~PageCache();
struct Page {
diff --git a/media/libstagefright/OggExtractor.cpp b/media/libstagefright/OggExtractor.cpp
index 37e8e9c..0343786 100644
--- a/media/libstagefright/OggExtractor.cpp
+++ b/media/libstagefright/OggExtractor.cpp
@@ -46,7 +46,7 @@
namespace android {
struct OggSource : public MediaSource {
- OggSource(const sp<OggExtractor> &extractor);
+ explicit OggSource(const sp<OggExtractor> &extractor);
virtual sp<MetaData> getFormat();
@@ -164,7 +164,7 @@
};
struct MyVorbisExtractor : public MyOggExtractor {
- MyVorbisExtractor(const sp<DataSource> &source)
+ explicit MyVorbisExtractor(const sp<DataSource> &source)
: MyOggExtractor(source,
MEDIA_MIMETYPE_AUDIO_VORBIS,
/* numHeaders */ 3,
@@ -192,7 +192,7 @@
static const int32_t kOpusSampleRate = 48000;
static const int64_t kOpusSeekPreRollUs = 80000; // 80 ms
- MyOpusExtractor(const sp<DataSource> &source)
+ explicit MyOpusExtractor(const sp<DataSource> &source)
: MyOggExtractor(source, MEDIA_MIMETYPE_AUDIO_OPUS, /*numHeaders*/ 2, kOpusSeekPreRollUs),
mChannelCount(0),
mCodecDelay(0),
diff --git a/media/libstagefright/SampleTable.cpp b/media/libstagefright/SampleTable.cpp
index 542a06d..5df2e2e 100644
--- a/media/libstagefright/SampleTable.cpp
+++ b/media/libstagefright/SampleTable.cpp
@@ -207,6 +207,11 @@
status_t SampleTable::setSampleToChunkParams(
off64_t data_offset, size_t data_size) {
if (mSampleToChunkOffset >= 0) {
+ // already set
+ return ERROR_MALFORMED;
+ }
+
+ if (data_offset < 0) {
return ERROR_MALFORMED;
}
@@ -244,7 +249,7 @@
for (uint32_t i = 0; i < mNumSampleToChunkOffsets; ++i) {
uint8_t buffer[12];
- if ((off64_t)(SIZE_MAX - 8 - (i * 12)) < mSampleToChunkOffset) {
+ if ((SIZE_MAX - 8 - (i * 12)) < (size_t)mSampleToChunkOffset) {
return ERROR_MALFORMED;
}
diff --git a/media/libstagefright/codecs/aacenc/Android.mk b/media/libstagefright/codecs/aacenc/Android.mk
index 266f01b..71c374b 100644
--- a/media/libstagefright/codecs/aacenc/Android.mk
+++ b/media/libstagefright/codecs/aacenc/Android.mk
@@ -64,7 +64,10 @@
LOCAL_STATIC_LIBRARIES :=
-LOCAL_SHARED_LIBRARIES :=
+# libstagefright links this static library, so it probably isn't appropriate to
+# link libstagefright. However, this library includes libstagefright headers,
+# and needs libbinder to be able to do so correctly.
+LOCAL_SHARED_LIBRARIES := libbinder
LOCAL_C_INCLUDES := \
frameworks/av/include \
diff --git a/media/libstagefright/filters/Android.mk b/media/libstagefright/filters/Android.mk
index 179f054..bd75a88 100644
--- a/media/libstagefright/filters/Android.mk
+++ b/media/libstagefright/filters/Android.mk
@@ -23,6 +23,8 @@
LOCAL_CFLAGS += -Wno-multichar -Werror -Wall
LOCAL_CLANG := true
+LOCAL_SHARED_LIBRARIES := libmedia
+
LOCAL_MODULE:= libstagefright_mediafilter
include $(BUILD_STATIC_LIBRARY)
diff --git a/media/libstagefright/foundation/ADebug.cpp b/media/libstagefright/foundation/ADebug.cpp
index 2c5f544..1a5b2a3 100644
--- a/media/libstagefright/foundation/ADebug.cpp
+++ b/media/libstagefright/foundation/ADebug.cpp
@@ -49,7 +49,7 @@
++current;
}
// check for :
- char *colon = strchr(current, ':');
+ const char *colon = strchr(current, ':');
// get level
char *end;
diff --git a/media/libstagefright/foundation/ANetworkSession.cpp b/media/libstagefright/foundation/ANetworkSession.cpp
index 46314eb..f8b7b41 100644
--- a/media/libstagefright/foundation/ANetworkSession.cpp
+++ b/media/libstagefright/foundation/ANetworkSession.cpp
@@ -53,7 +53,7 @@
static const int32_t kMaxUDPRetries = 200;
struct ANetworkSession::NetworkThread : public Thread {
- NetworkThread(ANetworkSession *session);
+ explicit NetworkThread(ANetworkSession *session);
protected:
virtual ~NetworkThread();
diff --git a/media/libstagefright/foundation/Android.mk b/media/libstagefright/foundation/Android.mk
index 3c3ed59..b977c65 100644
--- a/media/libstagefright/foundation/Android.mk
+++ b/media/libstagefright/foundation/Android.mk
@@ -33,6 +33,8 @@
liblog \
libpowermanager
+LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := libbinder
+
LOCAL_CFLAGS += -Wno-multichar -Werror -Wall
LOCAL_CLANG := true
LOCAL_SANITIZE := unsigned-integer-overflow signed-integer-overflow
diff --git a/media/libstagefright/httplive/Android.mk b/media/libstagefright/httplive/Android.mk
index f904212..2c985fc 100644
--- a/media/libstagefright/httplive/Android.mk
+++ b/media/libstagefright/httplive/Android.mk
@@ -18,6 +18,7 @@
LOCAL_SANITIZE := unsigned-integer-overflow signed-integer-overflow
LOCAL_SHARED_LIBRARIES := \
+ liblog \
libbinder \
libcrypto \
libcutils \
diff --git a/media/libstagefright/httplive/LiveSession.cpp b/media/libstagefright/httplive/LiveSession.cpp
index cebf95c..e24d08d 100644
--- a/media/libstagefright/httplive/LiveSession.cpp
+++ b/media/libstagefright/httplive/LiveSession.cpp
@@ -1175,7 +1175,7 @@
#endif
bool LiveSession::UriIsSameAsIndex(const AString &uri, int32_t i, bool newUri) {
- ALOGI("[timed_id3] i %d UriIsSameAsIndex newUri %s, %s", i,
+ ALOGV("[timed_id3] i %d UriIsSameAsIndex newUri %s, %s", i,
newUri ? "true" : "false",
newUri ? mStreams[i].mNewUri.c_str() : mStreams[i].mUri.c_str());
return i >= 0
diff --git a/media/libstagefright/httplive/M3UParser.cpp b/media/libstagefright/httplive/M3UParser.cpp
index 935f1dc..c971250 100644
--- a/media/libstagefright/httplive/M3UParser.cpp
+++ b/media/libstagefright/httplive/M3UParser.cpp
@@ -46,7 +46,7 @@
FLAG_HAS_URI = 16,
};
- MediaGroup(Type type);
+ explicit MediaGroup(Type type);
Type type() const;
@@ -498,8 +498,8 @@
if (url[0] == '/') {
// URL is an absolute path.
- char *protocolEnd = strstr(baseURL, "//") + 2;
- char *pathStart = strchr(protocolEnd, '/');
+ const char *protocolEnd = strstr(baseURL, "//") + 2;
+ const char *pathStart = strchr(protocolEnd, '/');
if (pathStart != NULL) {
out->setTo(baseURL, pathStart - baseURL);
diff --git a/media/libstagefright/id3/Android.mk b/media/libstagefright/id3/Android.mk
index 2cfba44..bd2e459 100644
--- a/media/libstagefright/id3/Android.mk
+++ b/media/libstagefright/id3/Android.mk
@@ -8,6 +8,8 @@
LOCAL_CLANG := true
LOCAL_SANITIZE := unsigned-integer-overflow signed-integer-overflow
+LOCAL_SHARED_LIBRARIES := libmedia
+
LOCAL_MODULE := libstagefright_id3
include $(BUILD_STATIC_LIBRARY)
diff --git a/media/libstagefright/include/avc_utils.h b/media/libstagefright/include/avc_utils.h
index dafa07e..26afd73 100644
--- a/media/libstagefright/include/avc_utils.h
+++ b/media/libstagefright/include/avc_utils.h
@@ -37,8 +37,8 @@
};
struct NALPosition {
- size_t nalOffset;
- size_t nalSize;
+ uint32_t nalOffset;
+ uint32_t nalSize;
};
// Optionally returns sample aspect ratio as well.
diff --git a/media/libstagefright/matroska/Android.mk b/media/libstagefright/matroska/Android.mk
index b0cbf08..89d7ff2 100644
--- a/media/libstagefright/matroska/Android.mk
+++ b/media/libstagefright/matroska/Android.mk
@@ -13,6 +13,8 @@
LOCAL_CLANG := true
LOCAL_SANITIZE := unsigned-integer-overflow signed-integer-overflow
+LOCAL_SHARED_LIBRARIES := libmedia
+
LOCAL_MODULE:= libstagefright_matroska
include $(BUILD_STATIC_LIBRARY)
diff --git a/media/libstagefright/matroska/MatroskaExtractor.cpp b/media/libstagefright/matroska/MatroskaExtractor.cpp
index 861bdc5..04e6db5 100644
--- a/media/libstagefright/matroska/MatroskaExtractor.cpp
+++ b/media/libstagefright/matroska/MatroskaExtractor.cpp
@@ -39,7 +39,7 @@
namespace android {
struct DataSourceReader : public mkvparser::IMkvReader {
- DataSourceReader(const sp<DataSource> &source)
+ explicit DataSourceReader(const sp<DataSource> &source)
: mSource(source) {
}
diff --git a/media/libstagefright/mpeg2ts/Android.mk b/media/libstagefright/mpeg2ts/Android.mk
index 70afde9..66722a8 100644
--- a/media/libstagefright/mpeg2ts/Android.mk
+++ b/media/libstagefright/mpeg2ts/Android.mk
@@ -17,6 +17,8 @@
LOCAL_CLANG := true
LOCAL_SANITIZE := unsigned-integer-overflow signed-integer-overflow
+LOCAL_SHARED_LIBRARIES := libmedia
+
LOCAL_MODULE:= libstagefright_mpeg2ts
ifeq ($(TARGET_ARCH),arm)
diff --git a/media/libstagefright/omx/OMX.cpp b/media/libstagefright/omx/OMX.cpp
index 2e989b5..f7058d7 100644
--- a/media/libstagefright/omx/OMX.cpp
+++ b/media/libstagefright/omx/OMX.cpp
@@ -48,7 +48,7 @@
// Note that deriving CallbackDispatcher from Thread does not work.
struct OMX::CallbackDispatcherThread : public Thread {
- CallbackDispatcherThread(CallbackDispatcher *dispatcher)
+ explicit CallbackDispatcherThread(CallbackDispatcher *dispatcher)
: mDispatcher(dispatcher) {
}
@@ -64,7 +64,7 @@
////////////////////////////////////////////////////////////////////////////////
struct OMX::CallbackDispatcher : public RefBase {
- CallbackDispatcher(OMXNodeInstance *owner);
+ explicit CallbackDispatcher(OMXNodeInstance *owner);
// Posts |msg| to the listener's queue. If |realTime| is true, the listener thread is notified
// that a new message is available on the queue. Otherwise, the message stays on the queue, but
diff --git a/media/libstagefright/omx/OMXNodeInstance.cpp b/media/libstagefright/omx/OMXNodeInstance.cpp
index 31bab70..462db95 100644
--- a/media/libstagefright/omx/OMXNodeInstance.cpp
+++ b/media/libstagefright/omx/OMXNodeInstance.cpp
@@ -93,17 +93,17 @@
namespace android {
struct BufferMeta {
- BufferMeta(const sp<IMemory> &mem, bool is_backup = false)
+ explicit BufferMeta(const sp<IMemory> &mem, bool is_backup = false)
: mMem(mem),
mIsBackup(is_backup) {
}
- BufferMeta(size_t size)
+ explicit BufferMeta(size_t size)
: mSize(size),
mIsBackup(false) {
}
- BufferMeta(const sp<GraphicBuffer> &graphicBuffer)
+ explicit BufferMeta(const sp<GraphicBuffer> &graphicBuffer)
: mGraphicBuffer(graphicBuffer),
mIsBackup(false) {
}
diff --git a/media/libstagefright/rtsp/Android.mk b/media/libstagefright/rtsp/Android.mk
index bdda19c..35301ce 100644
--- a/media/libstagefright/rtsp/Android.mk
+++ b/media/libstagefright/rtsp/Android.mk
@@ -19,7 +19,7 @@
ASessionDescription.cpp \
SDPLoader.cpp \
-LOCAL_SHARED_LIBRARIES += libcrypto
+LOCAL_SHARED_LIBRARIES += libcrypto libmedia
LOCAL_C_INCLUDES:= \
$(TOP)/frameworks/av/media/libstagefright \
diff --git a/media/libstagefright/tests/SurfaceMediaSource_test.cpp b/media/libstagefright/tests/SurfaceMediaSource_test.cpp
index ad1e684..d419133 100644
--- a/media/libstagefright/tests/SurfaceMediaSource_test.cpp
+++ b/media/libstagefright/tests/SurfaceMediaSource_test.cpp
@@ -593,7 +593,7 @@
struct SimpleDummyRecorder {
sp<MediaSource> mSource;
- SimpleDummyRecorder
+ explicit SimpleDummyRecorder
(const sp<MediaSource> &source): mSource(source) {}
status_t start() { return mSource->start();}
diff --git a/media/libstagefright/timedtext/Android.mk b/media/libstagefright/timedtext/Android.mk
index f2c6365..8d128b8 100644
--- a/media/libstagefright/timedtext/Android.mk
+++ b/media/libstagefright/timedtext/Android.mk
@@ -12,6 +12,8 @@
$(TOP)/frameworks/av/include/media/stagefright/timedtext \
$(TOP)/frameworks/av/media/libstagefright
+LOCAL_SHARED_LIBRARIES := libmedia
+
LOCAL_MODULE:= libstagefright_timedtext
include $(BUILD_STATIC_LIBRARY)
diff --git a/media/libstagefright/wifi-display/source/WifiDisplaySource.cpp b/media/libstagefright/wifi-display/source/WifiDisplaySource.cpp
index e26165e..f0a4ded 100644
--- a/media/libstagefright/wifi-display/source/WifiDisplaySource.cpp
+++ b/media/libstagefright/wifi-display/source/WifiDisplaySource.cpp
@@ -782,7 +782,7 @@
return;
}
- char *commaPos = strchr(s, ',');
+ const char *commaPos = strchr(s, ',');
if (commaPos != NULL) {
s = commaPos + 1;
@@ -1669,7 +1669,7 @@
}
struct WifiDisplaySource::HDCPObserver : public BnHDCPObserver {
- HDCPObserver(const sp<AMessage> ¬ify);
+ explicit HDCPObserver(const sp<AMessage> ¬ify);
virtual void notify(
int msg, int ext1, int ext2, const Parcel *obj);
diff --git a/media/ndk/NdkMediaCodec.cpp b/media/ndk/NdkMediaCodec.cpp
index 50b490d..3d1eca1 100644
--- a/media/ndk/NdkMediaCodec.cpp
+++ b/media/ndk/NdkMediaCodec.cpp
@@ -59,7 +59,7 @@
private:
AMediaCodec* mCodec;
public:
- CodecHandler(AMediaCodec *codec);
+ explicit CodecHandler(AMediaCodec *codec);
virtual void onMessageReceived(const sp<AMessage> &msg);
};
diff --git a/media/utils/ISchedulingPolicyService.cpp b/media/utils/ISchedulingPolicyService.cpp
index f55bc02..f5bfe20 100644
--- a/media/utils/ISchedulingPolicyService.cpp
+++ b/media/utils/ISchedulingPolicyService.cpp
@@ -32,7 +32,7 @@
class BpSchedulingPolicyService : public BpInterface<ISchedulingPolicyService>
{
public:
- BpSchedulingPolicyService(const sp<IBinder>& impl)
+ explicit BpSchedulingPolicyService(const sp<IBinder>& impl)
: BpInterface<ISchedulingPolicyService>(impl)
{
}
diff --git a/radio/IRadio.cpp b/radio/IRadio.cpp
index 242df77..0881a91 100644
--- a/radio/IRadio.cpp
+++ b/radio/IRadio.cpp
@@ -44,7 +44,7 @@
class BpRadio: public BpInterface<IRadio>
{
public:
- BpRadio(const sp<IBinder>& impl)
+ explicit BpRadio(const sp<IBinder>& impl)
: BpInterface<IRadio>(impl)
{
}
diff --git a/radio/IRadioClient.cpp b/radio/IRadioClient.cpp
index 033ca49..ca21949 100644
--- a/radio/IRadioClient.cpp
+++ b/radio/IRadioClient.cpp
@@ -33,7 +33,7 @@
{
public:
- BpRadioClient(const sp<IBinder>& impl)
+ explicit BpRadioClient(const sp<IBinder>& impl)
: BpInterface<IRadioClient>(impl)
{
}
diff --git a/radio/IRadioService.cpp b/radio/IRadioService.cpp
index 81acf9e..960aab4 100644
--- a/radio/IRadioService.cpp
+++ b/radio/IRadioService.cpp
@@ -45,7 +45,7 @@
class BpRadioService: public BpInterface<IRadioService>
{
public:
- BpRadioService(const sp<IBinder>& impl)
+ explicit BpRadioService(const sp<IBinder>& impl)
: BpInterface<IRadioService>(impl)
{
}
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 1d575b3..91cb401 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -1397,11 +1397,15 @@
mAudioFlinger(audioFlinger),
mPid(pid)
{
- size_t heapSize = kClientSharedHeapSizeBytes;
- // Increase heap size on non low ram devices to limit risk of reconnection failure for
- // invalidated tracks
- if (!audioFlinger->isLowRamDevice()) {
- heapSize *= kClientSharedHeapSizeMultiplier;
+ size_t heapSize = property_get_int32("ro.af.client_heap_size_kbyte", 0);
+ heapSize *= 1024;
+ if (!heapSize) {
+ heapSize = kClientSharedHeapSizeBytes;
+ // Increase heap size on non low ram devices to limit risk of reconnection failure for
+ // invalidated tracks
+ if (!audioFlinger->isLowRamDevice()) {
+ heapSize *= kClientSharedHeapSizeMultiplier;
+ }
}
mMemoryDealer = new MemoryDealer(heapSize, "AudioFlinger::Client");
}
diff --git a/services/audiopolicy/common/managerdefinitions/Android.mk b/services/audiopolicy/common/managerdefinitions/Android.mk
index 3b4ae6b..8ca36ea 100644
--- a/services/audiopolicy/common/managerdefinitions/Android.mk
+++ b/services/audiopolicy/common/managerdefinitions/Android.mk
@@ -25,9 +25,12 @@
LOCAL_SHARED_LIBRARIES := \
libcutils \
+ libmedia \
libutils \
liblog \
+LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := libmedia
+
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include \
$(TOPDIR)frameworks/av/services/audiopolicy/common/include \
diff --git a/services/audiopolicy/enginedefault/Android.mk b/services/audiopolicy/enginedefault/Android.mk
index 85d1822..b247e21 100755
--- a/services/audiopolicy/enginedefault/Android.mk
+++ b/services/audiopolicy/enginedefault/Android.mk
@@ -40,6 +40,7 @@
libxml2
LOCAL_SHARED_LIBRARIES += \
+ liblog \
libcutils \
libutils \
libaudioutils \
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 21ce8c9..d8208a8 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -61,6 +61,17 @@
return setDeviceConnectionStateInt(device, state, device_address, device_name);
}
+void AudioPolicyManager::broadcastDeviceConnectionState(audio_devices_t device,
+ audio_policy_dev_state_t state,
+ const String8 &device_address)
+{
+ AudioParameter param(device_address);
+ const String8 key(state == AUDIO_POLICY_DEVICE_STATE_AVAILABLE ?
+ AUDIO_PARAMETER_DEVICE_CONNECT : AUDIO_PARAMETER_DEVICE_DISCONNECT);
+ param.addInt(key, device);
+ mpClientInterface->setParameters(AUDIO_IO_HANDLE_NONE, param.toString());
+}
+
status_t AudioPolicyManager::setDeviceConnectionStateInt(audio_devices_t device,
audio_policy_dev_state_t state,
const char *device_address,
@@ -109,8 +120,15 @@
return NO_MEMORY;
}
+ // Before checking outputs, broadcast connect event to allow HAL to retrieve dynamic
+ // parameters on newly connected devices (instead of opening the outputs...)
+ broadcastDeviceConnectionState(device, state, devDesc->mAddress);
+
if (checkOutputsForDevice(devDesc, state, outputs, devDesc->mAddress) != NO_ERROR) {
mAvailableOutputDevices.remove(devDesc);
+
+ broadcastDeviceConnectionState(device, AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE,
+ devDesc->mAddress);
return INVALID_OPERATION;
}
// Propagate device availability to Engine
@@ -122,11 +140,6 @@
ALOGV("setDeviceConnectionState() checkOutputsForDevice() returned %zu outputs",
outputs.size());
- // Send connect to HALs
- AudioParameter param = AudioParameter(devDesc->mAddress);
- param.addInt(String8(AUDIO_PARAMETER_DEVICE_CONNECT), device);
- mpClientInterface->setParameters(AUDIO_IO_HANDLE_NONE, param.toString());
-
} break;
// handle output device disconnection
case AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE: {
@@ -138,9 +151,7 @@
ALOGV("setDeviceConnectionState() disconnecting output device %x", device);
// Send Disconnect to HALs
- AudioParameter param = AudioParameter(devDesc->mAddress);
- param.addInt(String8(AUDIO_PARAMETER_DEVICE_DISCONNECT), device);
- mpClientInterface->setParameters(AUDIO_IO_HANDLE_NONE, param.toString());
+ broadcastDeviceConnectionState(device, state, devDesc->mAddress);
// remove device from available output devices
mAvailableOutputDevices.remove(devDesc);
@@ -223,7 +234,14 @@
device);
return INVALID_OPERATION;
}
+
+ // Before checking intputs, broadcast connect event to allow HAL to retrieve dynamic
+ // parameters on newly connected devices (instead of opening the inputs...)
+ broadcastDeviceConnectionState(device, state, devDesc->mAddress);
+
if (checkInputsForDevice(devDesc, state, inputs, devDesc->mAddress) != NO_ERROR) {
+ broadcastDeviceConnectionState(device, AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE,
+ devDesc->mAddress);
return INVALID_OPERATION;
}
@@ -234,11 +252,6 @@
return NO_MEMORY;
}
- // Set connect to HALs
- AudioParameter param = AudioParameter(devDesc->mAddress);
- param.addInt(String8(AUDIO_PARAMETER_DEVICE_CONNECT), device);
- mpClientInterface->setParameters(AUDIO_IO_HANDLE_NONE, param.toString());
-
// Propagate device availability to Engine
mEngine->setDeviceConnectionState(devDesc, state);
} break;
@@ -253,9 +266,7 @@
ALOGV("setDeviceConnectionState() disconnecting input device %x", device);
// Set Disconnect to HALs
- AudioParameter param = AudioParameter(devDesc->mAddress);
- param.addInt(String8(AUDIO_PARAMETER_DEVICE_DISCONNECT), device);
- mpClientInterface->setParameters(AUDIO_IO_HANDLE_NONE, param.toString());
+ broadcastDeviceConnectionState(device, state, devDesc->mAddress);
checkInputsForDevice(devDesc, state, inputs, devDesc->mAddress);
mAvailableInputDevices.remove(devDesc);
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.h b/services/audiopolicy/managerdefault/AudioPolicyManager.h
index 2d6a873..0526f02 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.h
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.h
@@ -592,6 +592,15 @@
void updateAudioProfiles(audio_devices_t device, audio_io_handle_t ioHandle,
AudioProfileVector &profiles);
+ // Notify the policy client of any change of device state with AUDIO_IO_HANDLE_NONE,
+ // so that the client interprets it as global to audio hardware interfaces.
+ // It can give a chance to HAL implementer to retrieve dynamic capabilities associated
+ // to this device for example.
+ // TODO avoid opening stream to retrieve capabilities of a profile.
+ void broadcastDeviceConnectionState(audio_devices_t device,
+ audio_policy_dev_state_t state,
+ const String8 &device_address);
+
// updates device caching and output for streams that can influence the
// routing of notifications
void handleNotificationRoutingForStream(audio_stream_type_t stream);
diff --git a/services/camera/libcameraservice/Android.mk b/services/camera/libcameraservice/Android.mk
index ebe65e4..a2ca3a8 100644
--- a/services/camera/libcameraservice/Android.mk
+++ b/services/camera/libcameraservice/Android.mk
@@ -69,6 +69,8 @@
libjpeg \
libmemunreachable
+LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := libbinder
+
LOCAL_C_INCLUDES += \
system/media/private/camera/include \
frameworks/native/include/media/openmax \
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index ff73c28..62781bc 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -103,7 +103,7 @@
sp<CameraService> cs = const_cast<CameraService*>(
static_cast<const CameraService*>(callbacks));
- cs->onDeviceStatusChanged(static_cast<camera_device_status_t>(camera_id),
+ cs->onDeviceStatusChanged(camera_id,
static_cast<camera_device_status_t>(new_status));
}
@@ -272,12 +272,14 @@
}
sp<ICameraServiceProxy> CameraService::getCameraServiceProxy() {
+ sp<ICameraServiceProxy> proxyBinder = nullptr;
+#ifndef __BRILLO__
sp<IServiceManager> sm = defaultServiceManager();
sp<IBinder> binder = sm->getService(String16("media.camera.proxy"));
- if (binder == nullptr) {
- return nullptr;
+ if (binder != nullptr) {
+ proxyBinder = interface_cast<ICameraServiceProxy>(binder);
}
- sp<ICameraServiceProxy> proxyBinder = interface_cast<ICameraServiceProxy>(binder);
+#endif
return proxyBinder;
}
@@ -296,7 +298,7 @@
gCameraService = nullptr;
}
-void CameraService::onDeviceStatusChanged(camera_device_status_t cameraId,
+void CameraService::onDeviceStatusChanged(int cameraId,
camera_device_status_t newStatus) {
ALOGI("%s: Status changed for cameraId=%d, newStatus=%d", __FUNCTION__,
cameraId, newStatus);
@@ -923,6 +925,48 @@
const String8& clientName8, /*inout*/int& clientUid, /*inout*/int& clientPid,
/*out*/int& originalClientPid) const {
+#if !defined(__BRILLO__)
+ Status allowed = validateClientPermissionsLocked(cameraId, clientName8, clientUid, clientPid,
+ originalClientPid);
+ if (!allowed.isOk()) {
+ return allowed;
+ }
+#endif // defined(__BRILLO__)
+
+ int callingPid = getCallingPid();
+
+ if (!mModule) {
+ ALOGE("CameraService::connect X (PID %d) rejected (camera HAL module not loaded)",
+ callingPid);
+ return STATUS_ERROR_FMT(ERROR_DISCONNECTED,
+ "No camera HAL module available to open camera device \"%s\"", cameraId.string());
+ }
+
+ if (getCameraState(cameraId) == nullptr) {
+ ALOGE("CameraService::connect X (PID %d) rejected (invalid camera ID %s)", callingPid,
+ cameraId.string());
+ return STATUS_ERROR_FMT(ERROR_DISCONNECTED,
+ "No camera device with ID \"%s\" available", cameraId.string());
+ }
+
+ status_t err = checkIfDeviceIsUsable(cameraId);
+ if (err != NO_ERROR) {
+ switch(err) {
+ case -ENODEV:
+ case -EBUSY:
+ return STATUS_ERROR_FMT(ERROR_DISCONNECTED,
+ "No camera device with ID \"%s\" currently available", cameraId.string());
+ default:
+ return STATUS_ERROR_FMT(ERROR_INVALID_OPERATION,
+ "Unknown error connecting to ID \"%s\"", cameraId.string());
+ }
+ }
+ return Status::ok();
+}
+
+Status CameraService::validateClientPermissionsLocked(const String8& cameraId,
+ const String8& clientName8, int& clientUid, int& clientPid,
+ /*out*/int& originalClientPid) const {
int callingPid = getCallingPid();
int callingUid = getCallingUid();
@@ -966,20 +1010,6 @@
originalClientPid = clientPid;
clientPid = callingPid;
- if (!mModule) {
- ALOGE("CameraService::connect X (PID %d) rejected (camera HAL module not loaded)",
- callingPid);
- return STATUS_ERROR_FMT(ERROR_DISCONNECTED,
- "No camera HAL module available to open camera device \"%s\"", cameraId.string());
- }
-
- if (getCameraState(cameraId) == nullptr) {
- ALOGE("CameraService::connect X (PID %d) rejected (invalid camera ID %s)", callingPid,
- cameraId.string());
- return STATUS_ERROR_FMT(ERROR_DISCONNECTED,
- "No camera device with ID \"%s\" available", cameraId.string());
- }
-
userid_t clientUserId = multiuser_get_user_id(clientUid);
// Only allow clients who are being used by the current foreground device user, unless calling
@@ -993,18 +1023,6 @@
clientUserId, cameraId.string());
}
- status_t err = checkIfDeviceIsUsable(cameraId);
- if (err != NO_ERROR) {
- switch(err) {
- case -ENODEV:
- case -EBUSY:
- return STATUS_ERROR_FMT(ERROR_DISCONNECTED,
- "No camera device with ID \"%s\" currently available", cameraId.string());
- default:
- return STATUS_ERROR_FMT(ERROR_INVALID_OPERATION,
- "Unknown error connecting to ID \"%s\"", cameraId.string());
- }
- }
return Status::ok();
}
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index 11b1351..4332ce3 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -95,7 +95,7 @@
/////////////////////////////////////////////////////////////////////
// HAL Callbacks
- virtual void onDeviceStatusChanged(camera_device_status_t cameraId,
+ virtual void onDeviceStatusChanged(int cameraId,
camera_device_status_t newStatus);
virtual void onTorchStatusChanged(const String8& cameraId,
int32_t newStatus);
@@ -495,7 +495,9 @@
// mediaserver to connect to camera (using MediaRecorder to connect to camera). In that case,
// clientPid is the PID of mediaserver and originalClientPid is the PID of the application.
binder::Status validateConnectLocked(const String8& cameraId, const String8& clientName8,
- /*inout*/int& clientUid, /*inout*/int& clientPid, /*out*/int& originalClientPid) const;
+ /*inout*/int& clientUid, /*inout*/int& clientPid, /*out*/int& originalClientPid) const;
+ binder::Status validateClientPermissionsLocked(const String8& cameraId, const String8& clientName8,
+ /*inout*/int& clientUid, /*inout*/int& clientPid, /*out*/int& originalClientPid) const;
// Handle active client evictions, and update service state.
// Only call with with mServiceLock held.
diff --git a/services/camera/libcameraservice/device3/Camera3ZslStream.cpp b/services/camera/libcameraservice/device3/Camera3ZslStream.cpp
index 7414c4c..ea138b7 100644
--- a/services/camera/libcameraservice/device3/Camera3ZslStream.cpp
+++ b/services/camera/libcameraservice/device3/Camera3ZslStream.cpp
@@ -40,7 +40,7 @@
SELECT_NEITHER = 0,
};
- TimestampFinder(nsecs_t timestamp) : mTimestamp(timestamp) {}
+ explicit TimestampFinder(nsecs_t timestamp) : mTimestamp(timestamp) {}
~TimestampFinder() {}
template <typename T>
diff --git a/soundtrigger/ISoundTrigger.cpp b/soundtrigger/ISoundTrigger.cpp
index 4df2068..25332a4 100644
--- a/soundtrigger/ISoundTrigger.cpp
+++ b/soundtrigger/ISoundTrigger.cpp
@@ -37,7 +37,7 @@
class BpSoundTrigger: public BpInterface<ISoundTrigger>
{
public:
- BpSoundTrigger(const sp<IBinder>& impl)
+ explicit BpSoundTrigger(const sp<IBinder>& impl)
: BpInterface<ISoundTrigger>(impl)
{
}
diff --git a/soundtrigger/ISoundTriggerClient.cpp b/soundtrigger/ISoundTriggerClient.cpp
index e0d3add..1385631 100644
--- a/soundtrigger/ISoundTriggerClient.cpp
+++ b/soundtrigger/ISoundTriggerClient.cpp
@@ -35,7 +35,7 @@
{
public:
- BpSoundTriggerClient(const sp<IBinder>& impl)
+ explicit BpSoundTriggerClient(const sp<IBinder>& impl)
: BpInterface<ISoundTriggerClient>(impl)
{
}
diff --git a/soundtrigger/ISoundTriggerHwService.cpp b/soundtrigger/ISoundTriggerHwService.cpp
index e37bae3..d44f5cb 100644
--- a/soundtrigger/ISoundTriggerHwService.cpp
+++ b/soundtrigger/ISoundTriggerHwService.cpp
@@ -45,7 +45,7 @@
class BpSoundTriggerHwService: public BpInterface<ISoundTriggerHwService>
{
public:
- BpSoundTriggerHwService(const sp<IBinder>& impl)
+ explicit BpSoundTriggerHwService(const sp<IBinder>& impl)
: BpInterface<ISoundTriggerHwService>(impl)
{
}