Merge "IOMX: separate node interface from IOMX"
diff --git a/include/media/audiohal/StreamHalInterface.h b/include/media/audiohal/StreamHalInterface.h
index 5a7b4b6..8f42fe7 100644
--- a/include/media/audiohal/StreamHalInterface.h
+++ b/include/media/audiohal/StreamHalInterface.h
@@ -102,7 +102,7 @@
// Set the callback for notifying completion of non-blocking write and drain.
// The callback must be owned by someone else. The output stream does not own it
// to avoid strong pointer loops.
- virtual status_t setCallback(sp<StreamOutHalInterfaceCallback> callback) = 0;
+ virtual status_t setCallback(wp<StreamOutHalInterfaceCallback> callback) = 0;
// Returns whether pause and resume operations are supported.
virtual status_t supportsPauseAndResume(bool *supportsPause, bool *supportsResume) = 0;
diff --git a/include/media/stagefright/MediaCodec.h b/include/media/stagefright/MediaCodec.h
index 98780ce..e3e5c2d 100644
--- a/include/media/stagefright/MediaCodec.h
+++ b/include/media/stagefright/MediaCodec.h
@@ -33,7 +33,7 @@
struct AReplyToken;
struct AString;
struct CodecBase;
-struct IBatteryStats;
+class IBatteryStats;
struct ICrypto;
class MediaCodecBuffer;
class IMemory;
@@ -42,7 +42,7 @@
class IResourceManagerService;
struct PersistentSurface;
struct SoftwareRenderer;
-struct Surface;
+class Surface;
struct MediaCodec : public AHandler {
enum ConfigureFlags {
diff --git a/media/libaudiohal/StreamHalLocal.cpp b/media/libaudiohal/StreamHalLocal.cpp
index cd97cc8..59314eb 100644
--- a/media/libaudiohal/StreamHalLocal.cpp
+++ b/media/libaudiohal/StreamHalLocal.cpp
@@ -140,7 +140,7 @@
return mStream->get_next_write_timestamp(mStream, timestamp);
}
-status_t StreamOutHalLocal::setCallback(sp<StreamOutHalInterfaceCallback> callback) {
+status_t StreamOutHalLocal::setCallback(wp<StreamOutHalInterfaceCallback> callback) {
if (mStream->set_callback == NULL) return INVALID_OPERATION;
status_t result = mStream->set_callback(mStream, StreamOutHalLocal::asyncCallback, this);
if (result == OK) {
diff --git a/media/libaudiohal/StreamHalLocal.h b/media/libaudiohal/StreamHalLocal.h
index 7144e65..5e6f41a 100644
--- a/media/libaudiohal/StreamHalLocal.h
+++ b/media/libaudiohal/StreamHalLocal.h
@@ -92,7 +92,7 @@
virtual status_t getNextWriteTimestamp(int64_t *timestamp);
// Set the callback for notifying completion of non-blocking write and drain.
- virtual status_t setCallback(sp<StreamOutHalInterfaceCallback> callback);
+ virtual status_t setCallback(wp<StreamOutHalInterfaceCallback> callback);
// Returns whether pause and resume operations are supported.
virtual status_t supportsPauseAndResume(bool *supportsPause, bool *supportsResume);
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index 95c91d1..d45dbcd 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -684,10 +684,18 @@
sp<IServiceManager> sm = defaultServiceManager();
sp<IBinder> binder = sm->getService(String16("media.extractor"));
+ if (binder == NULL) {
+ ALOGE("extractor service not available");
+ return NULL;
+ }
mExtractorDeathListener = new ServiceDeathNotifier(binder, p, MEDIAEXTRACTOR_PROCESS_DEATH);
binder->linkToDeath(mExtractorDeathListener);
binder = sm->getService(String16("media.codec"));
+ if (binder == NULL) {
+ ALOGE("codec service not available");
+ return NULL;
+ }
mCodecDeathListener = new ServiceDeathNotifier(binder, p, MEDIACODEC_PROCESS_DEATH);
binder->linkToDeath(mCodecDeathListener);
diff --git a/media/libstagefright/SurfaceMediaSource.cpp b/media/libstagefright/SurfaceMediaSource.cpp
index 15ff569..4f1ef30 100644
--- a/media/libstagefright/SurfaceMediaSource.cpp
+++ b/media/libstagefright/SurfaceMediaSource.cpp
@@ -112,7 +112,7 @@
Mutex::Autolock lock(mMutex);
result.append(buffer);
- mConsumer->dump(result, "");
+ mConsumer->dumpState(result, "");
}
status_t SurfaceMediaSource::setFrameRate(int32_t fps)
diff --git a/services/audiopolicy/common/managerdefinitions/include/AudioInputDescriptor.h b/services/audiopolicy/common/managerdefinitions/include/AudioInputDescriptor.h
index 2b66c81..5445413 100644
--- a/services/audiopolicy/common/managerdefinitions/include/AudioInputDescriptor.h
+++ b/services/audiopolicy/common/managerdefinitions/include/AudioInputDescriptor.h
@@ -95,7 +95,9 @@
sp<AudioInputDescriptor> getInputFromId(audio_port_handle_t id) const;
- uint32_t activeInputsCount() const;
+ // count active capture sessions using one of the specified devices.
+ // ignore devices if AUDIO_DEVICE_IN_DEFAULT is passed
+ uint32_t activeInputsCountOnDevices(audio_devices_t devices = AUDIO_DEVICE_IN_DEFAULT) const;
/**
* return io handle of active input or 0 if no input is active
diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioInputDescriptor.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioInputDescriptor.cpp
index 1164607..44f9637 100644
--- a/services/audiopolicy/common/managerdefinitions/src/AudioInputDescriptor.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/AudioInputDescriptor.cpp
@@ -241,12 +241,14 @@
return inputDesc;
}
-uint32_t AudioInputCollection::activeInputsCount() const
+uint32_t AudioInputCollection::activeInputsCountOnDevices(audio_devices_t devices) const
{
uint32_t count = 0;
for (size_t i = 0; i < size(); i++) {
const sp<AudioInputDescriptor> inputDescriptor = valueAt(i);
- if (inputDescriptor->isActive()) {
+ if (inputDescriptor->isActive() &&
+ ((devices == AUDIO_DEVICE_IN_DEFAULT) ||
+ ((inputDescriptor->mDevice & devices & ~AUDIO_DEVICE_BIT_IN) != 0))) {
count++;
}
}
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 39d156c..5dcd41c 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -1727,7 +1727,7 @@
if (isInCall()) {
*concurrency |= API_INPUT_CONCURRENCY_CALL;
}
- if (mInputs.activeInputsCount() != 0) {
+ if (mInputs.activeInputsCountOnDevices() != 0) {
*concurrency |= API_INPUT_CONCURRENCY_CAPTURE;
}
@@ -1739,8 +1739,10 @@
mInputRoutes.incRouteActivity(session);
if (audioSession->activeCount() == 1 || mInputRoutes.hasRouteChanged(session)) {
-
- setInputDevice(input, getNewInputDevice(inputDesc), true /* force */);
+ // indicate active capture to sound trigger service if starting capture from a mic on
+ // primary HW module
+ audio_devices_t device = getNewInputDevice(inputDesc);
+ setInputDevice(input, device, true /* force */);
if (inputDesc->getAudioSessionCount(true/*activeOnly*/) == 1) {
// if input maps to a dynamic policy with an activity listener, notify of state change
@@ -1750,7 +1752,9 @@
MIX_STATE_MIXING);
}
- if (mInputs.activeInputsCount() == 0) {
+ audio_devices_t primaryInputDevices = availablePrimaryInputDevices();
+ if (((device & primaryInputDevices & ~AUDIO_DEVICE_BIT_IN) != 0) &&
+ mInputs.activeInputsCountOnDevices(primaryInputDevices) == 0) {
SoundTrigger::setCaptureState(true);
}
@@ -1833,9 +1837,14 @@
}
}
+ audio_devices_t device = inputDesc->mDevice;
resetInputDevice(input);
- if (mInputs.activeInputsCount() == 0) {
+ // indicate inactive capture to sound trigger service if stopping capture from a mic on
+ // primary HW module
+ audio_devices_t primaryInputDevices = availablePrimaryInputDevices();
+ if (((device & primaryInputDevices & ~AUDIO_DEVICE_BIT_IN) != 0) &&
+ mInputs.activeInputsCountOnDevices(primaryInputDevices) == 0) {
SoundTrigger::setCaptureState(false);
}
inputDesc->clearPreemptedSessions();