Skip to content

Commit

Permalink
Merge tag 'android-5.1.0_r1' into HEAD
Browse files Browse the repository at this point in the history
Android 5.1.0 release 1

Conflicts:
	include/media/stagefright/ACodec.h
	include/media/stagefright/foundation/AWakeLock.h
	media/libmedia/AudioTrack.cpp
	media/libmediaplayerservice/MediaPlayerFactory.cpp
	media/libmediaplayerservice/nuplayer/GenericSource.cpp
	media/libmediaplayerservice/nuplayer/GenericSource.h
	media/libmediaplayerservice/nuplayer/NuPlayer.cpp
	media/libmediaplayerservice/nuplayer/NuPlayer.h
	media/libmediaplayerservice/nuplayer/NuPlayerDecoder.h
	media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
	media/libmediaplayerservice/nuplayer/NuPlayerRenderer.h
	media/libstagefright/ACodec.cpp
	media/libstagefright/CameraSource.cpp
	media/libstagefright/MediaCodec.cpp
	media/libstagefright/MediaCodecSource.cpp
	media/libstagefright/foundation/AWakeLock.cpp
	media/libstagefright/foundation/Android.mk
	media/libstagefright/httplive/PlaylistFetcher.h
	media/libstagefright/omx/OMXNodeInstance.cpp
	services/audioflinger/AudioFlinger.cpp
	services/audioflinger/Threads.cpp
	services/audiopolicy/AudioPolicyManager.cpp
	services/audiopolicy/AudioPolicyManager.h

Change-Id: Ibf7f492d2e7d62f7a6dd49ce075cf275540fdbb3
  • Loading branch information
Anh Nguyen committed Mar 10, 2015
2 parents 6f46aa9 + e2c8023 commit 5f1f365
Show file tree
Hide file tree
Showing 493 changed files with 13,675 additions and 5,408 deletions.
5 changes: 5 additions & 0 deletions camera/CameraParameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,11 @@ void CameraParameters::getSupportedPreviewFormats(Vector<int>& formats) const {
const char* supportedPreviewFormats =
get(CameraParameters::KEY_SUPPORTED_PREVIEW_FORMATS);

if (supportedPreviewFormats == NULL) {
ALOGW("%s: No supported preview formats.", __FUNCTION__);
return;
}

String8 fmtStr(supportedPreviewFormats);
char* prevFmts = fmtStr.lockBuffer(fmtStr.size());

Expand Down
6 changes: 3 additions & 3 deletions camera/camera2/CaptureRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ status_t CaptureRequest::readFromParcel(Parcel* parcel) {
}

// Surface.writeToParcel
String16 name = parcel->readString16();
ALOGV("%s: Read surface name = %s",
__FUNCTION__, String8(name).string());
const char16_t* name = parcel->readString16Inplace(&len);
ALOGV("%s: Read surface name = %s", __FUNCTION__,
name != NULL ? String8(name).string() : "<null>");
sp<IBinder> binder(parcel->readStrongBinder());
ALOGV("%s: Read surface binder = %p",
__FUNCTION__, binder.get());
Expand Down
2 changes: 1 addition & 1 deletion cmds/screenrecord/FrameOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void FrameOutput::reduceRgbaToRgb(uint8_t* buf, unsigned int pixelCount) {
}

// Callback; executes on arbitrary thread.
void FrameOutput::onFrameAvailable() {
void FrameOutput::onFrameAvailable(const BufferItem& /* item */) {
Mutex::Autolock _l(mMutex);
mFrameAvailable = true;
mEventCond.signal();
Expand Down
2 changes: 1 addition & 1 deletion cmds/screenrecord/FrameOutput.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class FrameOutput : public GLConsumer::FrameAvailableListener {
}

// (overrides GLConsumer::FrameAvailableListener method)
virtual void onFrameAvailable();
virtual void onFrameAvailable(const BufferItem& item);

// Reduces RGBA to RGB, in place.
static void reduceRgbaToRgb(uint8_t* buf, unsigned int pixelCount);
Expand Down
2 changes: 1 addition & 1 deletion cmds/screenrecord/Overlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ void Overlay::getTimeString_l(nsecs_t monotonicNsec, char* buf, size_t bufLen) {
}

// Callback; executes on arbitrary thread.
void Overlay::onFrameAvailable() {
void Overlay::onFrameAvailable(const BufferItem& /* item */) {
ALOGV("Overlay::onFrameAvailable");
Mutex::Autolock _l(mMutex);
mFrameAvailable = true;
Expand Down
2 changes: 1 addition & 1 deletion cmds/screenrecord/Overlay.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class Overlay : public GLConsumer::FrameAvailableListener, Thread {
const Program& texRender, TextRenderer& textRenderer);

// (overrides GLConsumer::FrameAvailableListener method)
virtual void onFrameAvailable();
virtual void onFrameAvailable(const BufferItem& item);

// (overrides Thread method)
virtual bool threadLoop();
Expand Down
10 changes: 10 additions & 0 deletions drm/mediadrm/plugins/clearkey/DrmPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,21 @@ class DrmPlugin : public android::DrmPlugin {
return android::ERROR_DRM_CANNOT_HANDLE;
}

virtual status_t getSecureStop(Vector<uint8_t> const &ssid, Vector<uint8_t> &secureStop) {
UNUSED(ssid);
UNUSED(secureStop);
return android::ERROR_DRM_CANNOT_HANDLE;
}

virtual status_t releaseSecureStops(const Vector<uint8_t>& ssRelease) {
UNUSED(ssRelease);
return android::ERROR_DRM_CANNOT_HANDLE;
}

virtual status_t releaseAllSecureStops() {
return android::ERROR_DRM_CANNOT_HANDLE;
}

virtual status_t getPropertyString(
const String8& name, String8& value) const;

Expand Down
25 changes: 25 additions & 0 deletions drm/mediadrm/plugins/mock/MockDrmCryptoPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,24 @@ namespace android {
return OK;
}

status_t MockDrmPlugin::getSecureStop(Vector<uint8_t> const &ssid, Vector<uint8_t> &secureStop)
{
Mutex::Autolock lock(mLock);
ALOGD("MockDrmPlugin::getSecureStop()");

// Properties used in mock test, set by cts test app returned from mock plugin
// byte[] mock-secure-stop -> first secure stop in list

ssize_t index = mByteArrayProperties.indexOfKey(String8("mock-secure-stop"));
if (index < 0) {
ALOGD("Missing 'mock-secure-stop' parameter for mock");
return BAD_VALUE;
} else {
secureStop = mByteArrayProperties.valueAt(index);
}
return OK;
}

status_t MockDrmPlugin::getSecureStops(List<Vector<uint8_t> > &secureStops)
{
Mutex::Autolock lock(mLock);
Expand Down Expand Up @@ -349,6 +367,13 @@ namespace android {
return OK;
}

status_t MockDrmPlugin::releaseAllSecureStops()
{
Mutex::Autolock lock(mLock);
ALOGD("MockDrmPlugin::releaseAllSecureStops()");
return OK;
}

status_t MockDrmPlugin::getPropertyString(String8 const &name, String8 &value) const
{
ALOGD("MockDrmPlugin::getPropertyString(name=%s)", name.string());
Expand Down
2 changes: 2 additions & 0 deletions drm/mediadrm/plugins/mock/MockDrmCryptoPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ namespace android {
status_t unprovisionDevice();

status_t getSecureStops(List<Vector<uint8_t> > &secureStops);
status_t getSecureStop(Vector<uint8_t> const &ssid, Vector<uint8_t> &secureStop);
status_t releaseSecureStops(Vector<uint8_t> const &ssRelease);
status_t releaseAllSecureStops();

status_t getPropertyString(String8 const &name, String8 &value ) const;
status_t getPropertyByteArray(String8 const &name,
Expand Down
2 changes: 1 addition & 1 deletion include/camera/ProCamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ class ProCamera :
}

protected:
virtual void onFrameAvailable() {
virtual void onFrameAvailable(const BufferItem& /* item */) {
sp<ProCamera> c = mCamera.promote();
if (c.get() != NULL) {
c->onFrameAvailable(mStreamId);
Expand Down
9 changes: 7 additions & 2 deletions include/media/AudioEffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,11 @@ class AudioEffect : public RefBase
*
* Returned value
* *descriptor updated with descriptors of pre processings enabled by default
* *count number of descriptors returned if returned status is N_ERROR.
* *count number of descriptors returned if returned status is NO_ERROR.
* total number of pre processing enabled by default if returned status is
* NO_MEMORY. This happens if the count passed as input is less than the number
* of descriptors to return
* of descriptors to return.
* *count is limited to kMaxPreProcessing on return.
*/
static status_t queryDefaultPreProcessing(int audioSession,
effect_descriptor_t *descriptors,
Expand Down Expand Up @@ -391,6 +392,10 @@ class AudioEffect : public RefBase
*/
static status_t guidToString(const effect_uuid_t *guid, char *str, size_t maxLen);

// kMaxPreProcessing is a reasonable value for the maximum number of preprocessing effects
// that can be applied simultaneously.
static const uint32_t kMaxPreProcessing = 10;

protected:
bool mEnabled; // enable state
int32_t mSessionId; // audio session ID
Expand Down
82 changes: 82 additions & 0 deletions include/media/AudioPolicy.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* Copyright (C) 2014 The Android Open Source 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_AUDIO_POLICY_H
#define ANDROID_AUDIO_POLICY_H

#include <system/audio.h>
#include <system/audio_policy.h>
#include <binder/Parcel.h>
#include <utils/String8.h>
#include <utils/Vector.h>

namespace android {

// Keep in sync with AudioMix.java, AudioMixingRule.java, AudioPolicyConfig.java
#define RULE_EXCLUSION_MASK 0x8000
#define RULE_MATCH_ATTRIBUTE_USAGE 0x1
#define RULE_MATCH_ATTRIBUTE_CAPTURE_PRESET (0x1 << 1)
#define RULE_EXCLUDE_ATTRIBUTE_USAGE (RULE_EXCLUSION_MASK|RULE_MATCH_ATTRIBUTE_USAGE)
#define RULE_EXCLUDE_ATTRIBUTE_CAPTURE_PRESET \
(RULE_EXCLUSION_MASK|RULE_MATCH_ATTRIBUTE_CAPTURE_PRESET)

#define MIX_TYPE_INVALID -1
#define MIX_TYPE_PLAYERS 0
#define MIX_TYPE_RECORDERS 1

#define ROUTE_FLAG_RENDER 0x1
#define ROUTE_FLAG_LOOP_BACK (0x1 << 1)

#define MAX_MIXES_PER_POLICY 10
#define MAX_CRITERIA_PER_MIX 20

class AttributeMatchCriterion {
public:
AttributeMatchCriterion() {}
AttributeMatchCriterion(audio_usage_t usage, audio_source_t source, uint32_t rule);

status_t readFromParcel(Parcel *parcel);
status_t writeToParcel(Parcel *parcel) const;

union {
audio_usage_t mUsage;
audio_source_t mSource;
} mAttr;
uint32_t mRule;
};

class AudioMix {
public:
AudioMix() {}
AudioMix(Vector<AttributeMatchCriterion> criteria, uint32_t mixType, audio_config_t format,
uint32_t routeFlags, String8 registrationId) :
mCriteria(criteria), mMixType(mixType), mFormat(format),
mRouteFlags(routeFlags), mRegistrationId(registrationId) {}

status_t readFromParcel(Parcel *parcel);
status_t writeToParcel(Parcel *parcel) const;

Vector<AttributeMatchCriterion> mCriteria;
uint32_t mMixType;
audio_config_t mFormat;
uint32_t mRouteFlags;
String8 mRegistrationId;
};

}; // namespace android

#endif // ANDROID_AUDIO_POLICY_H
53 changes: 52 additions & 1 deletion include/media/AudioPolicyHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include <system/audio.h>

audio_stream_type_t audio_attributes_to_stream_type(const audio_attributes_t *attr)
static audio_stream_type_t audio_attributes_to_stream_type(const audio_attributes_t *attr)
{
// flags to stream type mapping
if ((attr->flags & AUDIO_FLAG_AUDIBILITY_ENFORCED) == AUDIO_FLAG_AUDIBILITY_ENFORCED) {
Expand Down Expand Up @@ -61,4 +61,55 @@ audio_stream_type_t audio_attributes_to_stream_type(const audio_attributes_t *at
}
}

static void stream_type_to_audio_attributes(audio_stream_type_t streamType,
audio_attributes_t *attr) {
memset(attr, 0, sizeof(audio_attributes_t));

switch (streamType) {
case AUDIO_STREAM_DEFAULT:
case AUDIO_STREAM_MUSIC:
attr->content_type = AUDIO_CONTENT_TYPE_MUSIC;
attr->usage = AUDIO_USAGE_MEDIA;
break;
case AUDIO_STREAM_VOICE_CALL:
attr->content_type = AUDIO_CONTENT_TYPE_SPEECH;
attr->usage = AUDIO_USAGE_VOICE_COMMUNICATION;
break;
case AUDIO_STREAM_ENFORCED_AUDIBLE:
attr->flags |= AUDIO_FLAG_AUDIBILITY_ENFORCED;
// intended fall through, attributes in common with STREAM_SYSTEM
case AUDIO_STREAM_SYSTEM:
attr->content_type = AUDIO_CONTENT_TYPE_SONIFICATION;
attr->usage = AUDIO_USAGE_ASSISTANCE_SONIFICATION;
break;
case AUDIO_STREAM_RING:
attr->content_type = AUDIO_CONTENT_TYPE_SONIFICATION;
attr->usage = AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE;
break;
case AUDIO_STREAM_ALARM:
attr->content_type = AUDIO_CONTENT_TYPE_SONIFICATION;
attr->usage = AUDIO_USAGE_ALARM;
break;
case AUDIO_STREAM_NOTIFICATION:
attr->content_type = AUDIO_CONTENT_TYPE_SONIFICATION;
attr->usage = AUDIO_USAGE_NOTIFICATION;
break;
case AUDIO_STREAM_BLUETOOTH_SCO:
attr->content_type = AUDIO_CONTENT_TYPE_SPEECH;
attr->usage = AUDIO_USAGE_VOICE_COMMUNICATION;
attr->flags |= AUDIO_FLAG_SCO;
break;
case AUDIO_STREAM_DTMF:
attr->content_type = AUDIO_CONTENT_TYPE_SONIFICATION;
attr->usage = AUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING;
break;
case AUDIO_STREAM_TTS:
attr->content_type = AUDIO_CONTENT_TYPE_SPEECH;
attr->usage = AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY;
break;
default:
ALOGE("invalid stream type %d when converting to attributes", streamType);
}
}

#endif //AUDIO_POLICY_HELPER_H_
11 changes: 7 additions & 4 deletions include/media/AudioRecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ class AudioRecord : public RefBase
* transferType: How data is transferred from AudioRecord.
* flags: See comments on audio_input_flags_t in <system/audio.h>
* threadCanCallJava: Not present in parameter list, and so is fixed at false.
* pAttributes: if not NULL, supersedes inputSource for use case selection
*/

AudioRecord(audio_source_t inputSource,
Expand All @@ -164,7 +165,8 @@ class AudioRecord : public RefBase
uint32_t notificationFrames = 0,
int sessionId = AUDIO_SESSION_ALLOCATE,
transfer_type transferType = TRANSFER_DEFAULT,
audio_input_flags_t flags = AUDIO_INPUT_FLAG_NONE);
audio_input_flags_t flags = AUDIO_INPUT_FLAG_NONE,
const audio_attributes_t* pAttributes = NULL);

/* Terminates the AudioRecord and unregisters it from AudioFlinger.
* Also destroys all resources associated with the AudioRecord.
Expand Down Expand Up @@ -198,7 +200,8 @@ class AudioRecord : public RefBase
bool threadCanCallJava = false,
int sessionId = AUDIO_SESSION_ALLOCATE,
transfer_type transferType = TRANSFER_DEFAULT,
audio_input_flags_t flags = AUDIO_INPUT_FLAG_NONE);
audio_input_flags_t flags = AUDIO_INPUT_FLAG_NONE,
const audio_attributes_t* pAttributes = NULL);

/* Result of constructing the AudioRecord. This must be checked for successful initialization
* before using any AudioRecord API (except for set()), because using
Expand All @@ -219,7 +222,7 @@ class AudioRecord : public RefBase
uint32_t channelCount() const { return mChannelCount; }
size_t frameCount() const { return mFrameCount; }
size_t frameSize() const { return mFrameSize; }
audio_source_t inputSource() const { return mInputSource; }
audio_source_t inputSource() const { return mAttributes.source; }

/* After it's created the track is not active. Call start() to
* make it active. If set, the callback will start being called.
Expand Down Expand Up @@ -489,7 +492,6 @@ class AudioRecord : public RefBase
audio_format_t mFormat;
uint32_t mChannelCount;
size_t mFrameSize; // app-level frame size == AudioFlinger frame size
audio_source_t mInputSource;
uint32_t mLatency; // in ms
audio_channel_mask_t mChannelMask;
audio_input_flags_t mFlags;
Expand Down Expand Up @@ -529,6 +531,7 @@ class AudioRecord : public RefBase

sp<DeathNotifier> mDeathNotifier;
uint32_t mSequence; // incremented for each new IAudioRecord attempt
audio_attributes_t mAttributes;
};

}; // namespace android
Expand Down
Loading

0 comments on commit 5f1f365

Please sign in to comment.