Skip to content

Commit

Permalink
Merge tag 'android-6.0.1_r24' into HEAD
Browse files Browse the repository at this point in the history
Android 6.0.1 release 24

Change-Id: Ib8e0def00cdbb1e163d8b088a6206c8509c67ea1
  • Loading branch information
gmillz committed Apr 6, 2016
2 parents 81a5e4f + 8696728 commit f8c3c68
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 43 deletions.
2 changes: 1 addition & 1 deletion include/media/mediametadataretriever.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class MediaMetadataRetriever: public RefBase
const char* extractMetadata(int keyCode);

private:
static const sp<IMediaPlayerService>& getService();
static const sp<IMediaPlayerService> getService();

class DeathNotifier: public IBinder::DeathRecipient
{
Expand Down
2 changes: 1 addition & 1 deletion media/libmedia/IDrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ status_t BnDrm::onTransact(

Vector<uint8_t> request;
String8 defaultUrl;
DrmPlugin::KeyRequestType keyRequestType;
DrmPlugin::KeyRequestType keyRequestType = DrmPlugin::kKeyRequestType_Unknown;

status_t result = getKeyRequest(sessionId, initData, mimeType,
keyType, optionalParameters, request, defaultUrl,
Expand Down
82 changes: 49 additions & 33 deletions media/libmedia/IOMX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ class BpOMX : public BpInterface<IOMX> {
remote()->transact(CONFIGURE_VIDEO_TUNNEL_MODE, data, &reply);

status_t err = reply.readInt32();
if (sidebandHandle) {
if (err == OK && sidebandHandle) {
*sidebandHandle = (native_handle_t *)reply.readNativeHandle();
}
return err;
Expand Down Expand Up @@ -694,34 +694,39 @@ status_t BnOMX::onTransact(

size_t size = data.readInt64();

void *params = malloc(size);
data.read(params, size);

status_t err;
switch (code) {
case GET_PARAMETER:
err = getParameter(node, index, params, size);
break;
case SET_PARAMETER:
err = setParameter(node, index, params, size);
break;
case GET_CONFIG:
err = getConfig(node, index, params, size);
break;
case SET_CONFIG:
err = setConfig(node, index, params, size);
break;
case SET_INTERNAL_OPTION:
{
InternalOptionType type =
(InternalOptionType)data.readInt32();

err = setInternalOption(node, index, type, params, size);
break;
status_t err = NO_MEMORY;
void *params = calloc(size, 1);
if (params) {
err = data.read(params, size);
if (err != OK) {
android_errorWriteLog(0x534e4554, "26914474");
} else {
switch (code) {
case GET_PARAMETER:
err = getParameter(node, index, params, size);
break;
case SET_PARAMETER:
err = setParameter(node, index, params, size);
break;
case GET_CONFIG:
err = getConfig(node, index, params, size);
break;
case SET_CONFIG:
err = setConfig(node, index, params, size);
break;
case SET_INTERNAL_OPTION:
{
InternalOptionType type =
(InternalOptionType)data.readInt32();

err = setInternalOption(node, index, type, params, size);
break;
}

default:
TRESPASS();
}
}

default:
TRESPASS();
}

reply->writeInt32(err);
Expand Down Expand Up @@ -846,9 +851,13 @@ status_t BnOMX::onTransact(
OMX_U32 port_index = data.readInt32();

sp<IGraphicBufferProducer> bufferProducer;
MetadataBufferType type;
MetadataBufferType type = kMetadataBufferTypeInvalid;
status_t err = createInputSurface(node, port_index, &bufferProducer, &type);

if ((err != OK) && (type == kMetadataBufferTypeInvalid)) {
android_errorWriteLog(0x534e4554, "26324358");
}

reply->writeInt32(type);
reply->writeInt32(err);

Expand Down Expand Up @@ -888,9 +897,13 @@ status_t BnOMX::onTransact(
sp<IGraphicBufferConsumer> bufferConsumer =
interface_cast<IGraphicBufferConsumer>(data.readStrongBinder());

MetadataBufferType type;
MetadataBufferType type = kMetadataBufferTypeInvalid;
status_t err = setInputSurface(node, port_index, bufferConsumer, &type);

if ((err != OK) && (type == kMetadataBufferTypeInvalid)) {
android_errorWriteLog(0x534e4554, "26324358");
}

reply->writeInt32(type);
reply->writeInt32(err);
return NO_ERROR;
Expand All @@ -916,8 +929,9 @@ status_t BnOMX::onTransact(
OMX_U32 port_index = data.readInt32();
OMX_BOOL enable = (OMX_BOOL)data.readInt32();

MetadataBufferType type;
MetadataBufferType type = kMetadataBufferTypeInvalid;
status_t err = storeMetaDataInBuffers(node, port_index, enable, &type);

reply->writeInt32(type);
reply->writeInt32(err);

Expand Down Expand Up @@ -950,11 +964,13 @@ status_t BnOMX::onTransact(
OMX_BOOL tunneled = (OMX_BOOL)data.readInt32();
OMX_U32 audio_hw_sync = data.readInt32();

native_handle_t *sideband_handle;
native_handle_t *sideband_handle = NULL;
status_t err = configureVideoTunnelMode(
node, port_index, tunneled, audio_hw_sync, &sideband_handle);
reply->writeInt32(err);
reply->writeNativeHandle(sideband_handle);
if(err == OK){
reply->writeNativeHandle(sideband_handle);
}

return NO_ERROR;
}
Expand Down
4 changes: 2 additions & 2 deletions media/libmedia/mediametadataretriever.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Mutex MediaMetadataRetriever::sServiceLock;
sp<IMediaPlayerService> MediaMetadataRetriever::sService;
sp<MediaMetadataRetriever::DeathNotifier> MediaMetadataRetriever::sDeathNotifier;

const sp<IMediaPlayerService>& MediaMetadataRetriever::getService()
const sp<IMediaPlayerService> MediaMetadataRetriever::getService()
{
Mutex::Autolock lock(sServiceLock);
if (sService == 0) {
Expand All @@ -62,7 +62,7 @@ const sp<IMediaPlayerService>& MediaMetadataRetriever::getService()
MediaMetadataRetriever::MediaMetadataRetriever()
{
ALOGV("constructor");
const sp<IMediaPlayerService>& service(getService());
const sp<IMediaPlayerService> service(getService());
if (service == 0) {
ALOGE("failed to obtain MediaMetadataRetrieverService");
return;
Expand Down
9 changes: 7 additions & 2 deletions media/libmediaplayerservice/MediaPlayerService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1970,8 +1970,13 @@ void MediaPlayerService::AudioOutput::pause()
void MediaPlayerService::AudioOutput::close()
{
ALOGV("close");
Mutex::Autolock lock(mLock);
close_l();
sp<AudioTrack> track;
{
Mutex::Autolock lock(mLock);
track = mTrack;
close_l(); // clears mTrack
}
// destruction of the track occurs outside of mutex.
}

void MediaPlayerService::AudioOutput::setVolume(float left, float right)
Expand Down
10 changes: 9 additions & 1 deletion media/libstagefright/MPEG4Extractor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4450,7 +4450,15 @@ status_t MPEG4Source::read(
continue;
}

CHECK(dstOffset + 4 <= mBuffer->size());
if (dstOffset > SIZE_MAX - 4 ||
dstOffset + 4 > SIZE_MAX - nalLength ||
dstOffset + 4 + nalLength > mBuffer->size()) {
ALOGE("b/27208621 : %zu %zu", dstOffset, mBuffer->size());
android_errorWriteLog(0x534e4554, "27208621");
mBuffer->release();
mBuffer = NULL;
return ERROR_MALFORMED;
}

dstData[dstOffset++] = 0;
dstData[dstOffset++] = 0;
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions media/libstagefright/omx/OMXNodeInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ status_t OMXNodeInstance::storeMetaDataInBuffers(
status_t OMXNodeInstance::storeMetaDataInBuffers_l(
OMX_U32 portIndex, OMX_BOOL enable, MetadataBufferType *type) {
if (portIndex != kPortIndexInput && portIndex != kPortIndexOutput) {
android_errorWriteLog(0x534e4554, "26324358");
return BAD_VALUE;
}

Expand Down
23 changes: 20 additions & 3 deletions services/audioflinger/Threads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1641,6 +1641,7 @@ void AudioFlinger::PlaybackThread::dumpInternals(int fd, const Vector<String16>&
dprintf(fd, " Mixer buffer: %p\n", mMixerBuffer);
dprintf(fd, " Effect buffer: %p\n", mEffectBuffer);
dprintf(fd, " Fast track availMask=%#x\n", mFastTrackAvailMask);
dprintf(fd, " Standby delay ns=%lld\n", (long long)mStandbyDelayNs);
AudioStreamOut *output = mOutput;
audio_output_flags_t flags = output != NULL ? output->flags : AUDIO_OUTPUT_FLAG_NONE;
String8 flagsAsString = outputFlagsToString(flags);
Expand Down Expand Up @@ -2560,7 +2561,8 @@ The derived values that are cached:
- mSinkBufferSize from frame count * frame size
- mActiveSleepTimeUs from activeSleepTimeUs()
- mIdleSleepTimeUs from idleSleepTimeUs()
- mStandbyDelayNs from mActiveSleepTimeUs (DIRECT only)
- mStandbyDelayNs from mActiveSleepTimeUs (DIRECT only) or forced to at least
kDefaultStandbyTimeInNsecs when connected to an A2DP device.
- maxPeriod from frame count and sample rate (MIXER only)

The parameters that affect these derived values are:
Expand All @@ -2579,6 +2581,15 @@ void AudioFlinger::PlaybackThread::cacheParameters_l()
mSinkBufferSize = mNormalFrameCount * mFrameSize;
mActiveSleepTimeUs = activeSleepTimeUs();
mIdleSleepTimeUs = idleSleepTimeUs();

// make sure standby delay is not too short when connected to an A2DP sink to avoid
// truncating audio when going to standby.
mStandbyDelayNs = AudioFlinger::mStandbyTimeInNsecs;
if ((mOutDevice & AUDIO_DEVICE_OUT_ALL_A2DP) != 0) {
if (mStandbyDelayNs < kDefaultStandbyTimeInNsecs) {
mStandbyDelayNs = kDefaultStandbyTimeInNsecs;
}
}
}

void AudioFlinger::PlaybackThread::invalidateTracks(audio_stream_type_t streamType)
Expand Down Expand Up @@ -4367,6 +4378,7 @@ bool AudioFlinger::MixerThread::checkForNewParameter_l(const String8& keyValuePa
status_t& status)
{
bool reconfig = false;
bool a2dpDeviceChanged = false;

status = NO_ERROR;

Expand Down Expand Up @@ -4446,6 +4458,8 @@ bool AudioFlinger::MixerThread::checkForNewParameter_l(const String8& keyValuePa
// forward device change to effects that have requested to be
// aware of attached audio device.
if (value != AUDIO_DEVICE_NONE) {
a2dpDeviceChanged =
(mOutDevice & AUDIO_DEVICE_OUT_ALL_A2DP) != (value & AUDIO_DEVICE_OUT_ALL_A2DP);
mOutDevice = value;
for (size_t i = 0; i < mEffectChains.size(); i++) {
mEffectChains[i]->setDevice_l(mOutDevice);
Expand Down Expand Up @@ -4489,7 +4503,7 @@ bool AudioFlinger::MixerThread::checkForNewParameter_l(const String8& keyValuePa
sq->push(FastMixerStateQueue::BLOCK_UNTIL_PUSHED);
}

return reconfig;
return reconfig || a2dpDeviceChanged;
}


Expand Down Expand Up @@ -4929,6 +4943,7 @@ bool AudioFlinger::DirectOutputThread::checkForNewParameter_l(const String8& key
status_t& status)
{
bool reconfig = false;
bool a2dpDeviceChanged = false;

status = NO_ERROR;

Expand All @@ -4939,6 +4954,8 @@ bool AudioFlinger::DirectOutputThread::checkForNewParameter_l(const String8& key
// forward device change to effects that have requested to be
// aware of attached audio device.
if (value != AUDIO_DEVICE_NONE) {
a2dpDeviceChanged =
(mOutDevice & AUDIO_DEVICE_OUT_ALL_A2DP) != (value & AUDIO_DEVICE_OUT_ALL_A2DP);
mOutDevice = value;
for (size_t i = 0; i < mEffectChains.size(); i++) {
mEffectChains[i]->setDevice_l(mOutDevice);
Expand Down Expand Up @@ -4971,7 +4988,7 @@ bool AudioFlinger::DirectOutputThread::checkForNewParameter_l(const String8& key
}
}

return reconfig;
return reconfig || a2dpDeviceChanged;
}

uint32_t AudioFlinger::DirectOutputThread::activeSleepTimeUs() const
Expand Down
1 change: 1 addition & 0 deletions services/camera/libcameraservice/CameraService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ void CameraService::onFirstRef()
ALOGE("Could not load camera HAL module: %d (%s)", err, strerror(-err));
logServiceError("Could not load camera HAL module", err);
mNumberOfCameras = 0;
mNumberOfNormalCameras = 0;
return;
}

Expand Down

0 comments on commit f8c3c68

Please sign in to comment.