Merge "Audio policy: volume computation improvement on A2DP for notifications" into nyc-dev
diff --git a/cmds/stagefright/muxer.cpp b/cmds/stagefright/muxer.cpp
index 36fa3b5..0a3bdf3 100644
--- a/cmds/stagefright/muxer.cpp
+++ b/cmds/stagefright/muxer.cpp
@@ -43,6 +43,7 @@
fprintf(stderr, " -h help\n");
fprintf(stderr, " -a use audio\n");
fprintf(stderr, " -v use video\n");
+ fprintf(stderr, " -w mux into WebM container (default is MP4)\n");
fprintf(stderr, " -s Time in milli-seconds when the trim should start\n");
fprintf(stderr, " -e Time in milli-seconds when the trim should end\n");
fprintf(stderr, " -o output file name. Default is /sdcard/muxeroutput.mp4\n");
@@ -60,7 +61,8 @@
bool enableTrim,
int trimStartTimeMs,
int trimEndTimeMs,
- int rotationDegrees) {
+ int rotationDegrees,
+ MediaMuxer::OutputFormat container = MediaMuxer::OUTPUT_FORMAT_MPEG_4) {
sp<NuMediaExtractor> extractor = new NuMediaExtractor;
if (extractor->setDataSource(NULL /* httpService */, path) != OK) {
fprintf(stderr, "unable to instantiate extractor. %s\n", path);
@@ -80,8 +82,7 @@
ALOGE("couldn't open file");
return fd;
}
- sp<MediaMuxer> muxer = new MediaMuxer(fd,
- MediaMuxer::OUTPUT_FORMAT_MPEG_4);
+ sp<MediaMuxer> muxer = new MediaMuxer(fd, container);
close(fd);
size_t trackCount = extractor->countTracks();
@@ -237,9 +238,10 @@
// When trimStartTimeMs and trimEndTimeMs seems valid, we turn this switch
// to true.
bool enableTrim = false;
+ MediaMuxer::OutputFormat container = MediaMuxer::OUTPUT_FORMAT_MPEG_4;
int res;
- while ((res = getopt(argc, argv, "h?avo:s:e:r:")) >= 0) {
+ while ((res = getopt(argc, argv, "h?avo:s:e:r:w")) >= 0) {
switch (res) {
case 'a':
{
@@ -253,6 +255,12 @@
break;
}
+ case 'w':
+ {
+ container = MediaMuxer::OUTPUT_FORMAT_WEBM;
+ break;
+ }
+
case 'o':
{
outputFileName = optarg;
@@ -318,7 +326,7 @@
looper->start();
int result = muxing(argv[0], useAudio, useVideo, outputFileName,
- enableTrim, trimStartTimeMs, trimEndTimeMs, rotationDegrees);
+ enableTrim, trimStartTimeMs, trimEndTimeMs, rotationDegrees, container);
looper->stop();
diff --git a/include/media/stagefright/MetaData.h b/include/media/stagefright/MetaData.h
index 7b43f87..be7e5c1 100644
--- a/include/media/stagefright/MetaData.h
+++ b/include/media/stagefright/MetaData.h
@@ -194,8 +194,7 @@
kKeyNalLengthSize = 'nals', // int32_t
// HDR related
- kKeyMinLuminance = 'minL', // int32_t, min luminance of the content in cd/m2.
- kKeyMaxLuminance = 'maxL', // int32_t, max luminance of the content in cd/m2.
+ kKeyHdrStaticInfo = 'hdrS', // HDRStaticInfo
// color aspects
kKeyColorRange = 'cRng', // int32_t, color range, value defined by ColorAspects.Range
diff --git a/include/media/stagefright/foundation/ABitReader.h b/include/media/stagefright/foundation/ABitReader.h
index c3bf0ff..a30dd2e 100644
--- a/include/media/stagefright/foundation/ABitReader.h
+++ b/include/media/stagefright/foundation/ABitReader.h
@@ -30,23 +30,44 @@
ABitReader(const uint8_t *data, size_t size);
virtual ~ABitReader();
- uint32_t getBits(size_t n);
- void skipBits(size_t n);
+ // Tries to get |n| bits. If not successful, returns |fallback|. Otherwise, returns result.
+ // Reading 0 bits will always succeed and return 0.
+ uint32_t getBitsWithFallback(size_t n, uint32_t fallback);
+ // Tries to get |n| bits. If not successful, returns false. Otherwise, stores result in |out|
+ // and returns true. Use !overRead() to determine if this call was successful. Reading 0 bits
+ // will always succeed and write 0 in |out|.
+ bool getBitsGraceful(size_t n, uint32_t *out);
+
+ // Gets |n| bits and returns result. ABORTS if unsuccessful. Reading 0 bits will always
+ // succeed.
+ uint32_t getBits(size_t n);
+
+ // Tries to skip |n| bits. Returns true iff successful. Skipping 0 bits will always succeed.
+ bool skipBits(size_t n);
+
+ // "Puts" |n| bits with the value |x| back virtually into the bit stream. The put-back bits
+ // are not actually written into the data, but are tracked in a separate buffer that can
+ // store at most 32 bits. This is a no-op if the stream has already been over-read.
void putBits(uint32_t x, size_t n);
size_t numBitsLeft() const;
const uint8_t *data() const;
+ // Returns true iff the stream was over-read (e.g. any getBits operation has been unsuccessful
+ // due to overread (and not trying to read >32 bits).)
+ bool overRead() const { return mOverRead; }
+
protected:
const uint8_t *mData;
size_t mSize;
uint32_t mReservoir; // left-aligned bits
size_t mNumBitsLeft;
+ bool mOverRead;
- virtual void fillReservoir();
+ virtual bool fillReservoir();
DISALLOW_EVIL_CONSTRUCTORS(ABitReader);
};
@@ -60,7 +81,7 @@
private:
int32_t mNumZeros;
- virtual void fillReservoir();
+ virtual bool fillReservoir();
DISALLOW_EVIL_CONSTRUCTORS(NALBitReader);
};
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index f206f5c..1963da3 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -2390,6 +2390,9 @@
} else {
timestamp.mPosition = (uint32_t)(ets.mPosition[location] - frames);
}
+ } else if (location == ExtendedTimestamp::LOCATION_KERNEL) {
+ ALOGV_IF(mPreviousLocation == ExtendedTimestamp::LOCATION_SERVER,
+ "getTimestamp() location moved from server to kernel");
}
mPreviousLocation = location;
} else {
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
index 87d64cd..9f63027 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
@@ -2194,11 +2194,6 @@
mPausedForBuffering = true;
onPause();
}
- // fall-thru
- }
-
- case Source::kWhatBufferingStart:
- {
notifyListener(MEDIA_INFO, MEDIA_INFO_BUFFERING_START, 0);
break;
}
@@ -2216,11 +2211,6 @@
onResume();
}
}
- // fall-thru
- }
-
- case Source::kWhatBufferingEnd:
- {
notifyListener(MEDIA_INFO, MEDIA_INFO_BUFFERING_END, 0);
break;
}
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerSource.h b/media/libmediaplayerservice/nuplayer/NuPlayerSource.h
index fba4540..0176eafa 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerSource.h
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerSource.h
@@ -46,8 +46,6 @@
kWhatFlagsChanged,
kWhatVideoSizeChanged,
kWhatBufferingUpdate,
- kWhatBufferingStart,
- kWhatBufferingEnd,
kWhatPauseOnBufferingStart,
kWhatResumeOnBufferingEnd,
kWhatCacheStats,
diff --git a/media/libmediaplayerservice/nuplayer/RTSPSource.cpp b/media/libmediaplayerservice/nuplayer/RTSPSource.cpp
index ba40876..1b7dff5 100644
--- a/media/libmediaplayerservice/nuplayer/RTSPSource.cpp
+++ b/media/libmediaplayerservice/nuplayer/RTSPSource.cpp
@@ -778,7 +778,7 @@
mBuffering = true;
sp<AMessage> notify = dupNotify();
- notify->setInt32("what", kWhatBufferingStart);
+ notify->setInt32("what", kWhatPauseOnBufferingStart);
notify->post();
}
}
@@ -794,7 +794,7 @@
mBuffering = false;
sp<AMessage> notify = dupNotify();
- notify->setInt32("what", kWhatBufferingEnd);
+ notify->setInt32("what", kWhatResumeOnBufferingEnd);
notify->post();
}
diff --git a/media/libstagefright/HevcUtils.cpp b/media/libstagefright/HevcUtils.cpp
index 087c903..718710a 100644
--- a/media/libstagefright/HevcUtils.cpp
+++ b/media/libstagefright/HevcUtils.cpp
@@ -18,6 +18,7 @@
#define LOG_TAG "HevcUtils"
#include <cstring>
+#include <utility>
#include "include/HevcUtils.h"
#include "include/avc_utils.h"
@@ -39,7 +40,8 @@
kHevcNalUnitTypeSuffixSei,
};
-HevcParameterSets::HevcParameterSets() {
+HevcParameterSets::HevcParameterSets()
+ : mInfo(kInfoNone) {
}
status_t HevcParameterSets::addNalUnit(const uint8_t* data, size_t size) {
@@ -149,17 +151,21 @@
// Skip reserved
reader.skipBits(16);
- mParams.add(kGeneralProfileSpace, reader.getBits(2));
- mParams.add(kGeneralTierFlag, reader.getBits(1));
- mParams.add(kGeneralProfileIdc, reader.getBits(5));
- mParams.add(kGeneralProfileCompatibilityFlags, reader.getBits(32));
- mParams.add(
- kGeneralConstraintIndicatorFlags,
- ((uint64_t)reader.getBits(16) << 32) | reader.getBits(32));
- mParams.add(kGeneralLevelIdc, reader.getBits(8));
- // 96 bits total for general profile.
+ if (reader.atLeastNumBitsLeft(96)) {
+ mParams.add(kGeneralProfileSpace, reader.getBits(2));
+ mParams.add(kGeneralTierFlag, reader.getBits(1));
+ mParams.add(kGeneralProfileIdc, reader.getBits(5));
+ mParams.add(kGeneralProfileCompatibilityFlags, reader.getBits(32));
+ mParams.add(
+ kGeneralConstraintIndicatorFlags,
+ ((uint64_t)reader.getBits(16) << 32) | reader.getBits(32));
+ mParams.add(kGeneralLevelIdc, reader.getBits(8));
+ // 96 bits total for general profile.
+ } else {
+ reader.skipBits(96);
+ }
- return OK;
+ return reader.overRead() ? ERROR_MALFORMED : OK;
}
status_t HevcParameterSets::parseSps(const uint8_t* data, size_t size) {
@@ -167,7 +173,7 @@
NALBitReader reader(data, size);
// Skip sps_video_parameter_set_id
reader.skipBits(4);
- uint8_t maxSubLayersMinus1 = reader.getBits(3);
+ uint8_t maxSubLayersMinus1 = reader.getBitsWithFallback(3, 0);
// Skip sps_temporal_id_nesting_flag;
reader.skipBits(1);
// Skip general profile
@@ -176,8 +182,8 @@
bool subLayerProfilePresentFlag[8];
bool subLayerLevelPresentFlag[8];
for (int i = 0; i < maxSubLayersMinus1; ++i) {
- subLayerProfilePresentFlag[i] = reader.getBits(1);
- subLayerLevelPresentFlag[i] = reader.getBits(1);
+ subLayerProfilePresentFlag[i] = reader.getBitsWithFallback(1, 0);
+ subLayerLevelPresentFlag[i] = reader.getBitsWithFallback(1, 0);
}
// Skip reserved
reader.skipBits(2 * (8 - maxSubLayersMinus1));
@@ -193,31 +199,152 @@
}
}
// Skip sps_seq_parameter_set_id
- parseUE(&reader);
- uint8_t chromaFormatIdc = parseUE(&reader);
+ skipUE(&reader);
+ uint8_t chromaFormatIdc = parseUEWithFallback(&reader, 0);
mParams.add(kChromaFormatIdc, chromaFormatIdc);
if (chromaFormatIdc == 3) {
// Skip separate_colour_plane_flag
reader.skipBits(1);
}
// Skip pic_width_in_luma_samples
- parseUE(&reader);
+ skipUE(&reader);
// Skip pic_height_in_luma_samples
- parseUE(&reader);
- if (reader.getBits(1) /* i.e. conformance_window_flag */) {
+ skipUE(&reader);
+ if (reader.getBitsWithFallback(1, 0) /* i.e. conformance_window_flag */) {
// Skip conf_win_left_offset
- parseUE(&reader);
+ skipUE(&reader);
// Skip conf_win_right_offset
- parseUE(&reader);
+ skipUE(&reader);
// Skip conf_win_top_offset
- parseUE(&reader);
+ skipUE(&reader);
// Skip conf_win_bottom_offset
- parseUE(&reader);
+ skipUE(&reader);
}
- mParams.add(kBitDepthLumaMinus8, parseUE(&reader));
- mParams.add(kBitDepthChromaMinus8, parseUE(&reader));
+ mParams.add(kBitDepthLumaMinus8, parseUEWithFallback(&reader, 0));
+ mParams.add(kBitDepthChromaMinus8, parseUEWithFallback(&reader, 0));
- return OK;
+ // log2_max_pic_order_cnt_lsb_minus4
+ size_t log2MaxPicOrderCntLsb = parseUEWithFallback(&reader, 0) + (size_t)4;
+ bool spsSubLayerOrderingInfoPresentFlag = reader.getBitsWithFallback(1, 0);
+ for (uint32_t i = spsSubLayerOrderingInfoPresentFlag ? 0 : maxSubLayersMinus1;
+ i <= maxSubLayersMinus1; ++i) {
+ skipUE(&reader); // sps_max_dec_pic_buffering_minus1[i]
+ skipUE(&reader); // sps_max_num_reorder_pics[i]
+ skipUE(&reader); // sps_max_latency_increase_plus1[i]
+ }
+
+ skipUE(&reader); // log2_min_luma_coding_block_size_minus3
+ skipUE(&reader); // log2_diff_max_min_luma_coding_block_size
+ skipUE(&reader); // log2_min_luma_transform_block_size_minus2
+ skipUE(&reader); // log2_diff_max_min_luma_transform_block_size
+ skipUE(&reader); // max_transform_hierarchy_depth_inter
+ skipUE(&reader); // max_transform_hierarchy_depth_intra
+ if (reader.getBitsWithFallback(1, 0)) { // scaling_list_enabled_flag u(1)
+ // scaling_list_data
+ if (reader.getBitsWithFallback(1, 0)) { // sps_scaling_list_data_present_flag
+ for (uint32_t sizeId = 0; sizeId < 4; ++sizeId) {
+ for (uint32_t matrixId = 0; matrixId < 6; matrixId += (sizeId == 3) ? 3 : 1) {
+ if (!reader.getBitsWithFallback(1, 1)) {
+ // scaling_list_pred_mode_flag[sizeId][matrixId]
+ skipUE(&reader); // scaling_list_pred_matrix_id_delta[sizeId][matrixId]
+ } else {
+ uint32_t coefNum = std::min(64, (1 << (4 + (sizeId << 1))));
+ if (sizeId > 1) {
+ skipSE(&reader); // scaling_list_dc_coef_minus8[sizeId − 2][matrixId]
+ }
+ for (uint32_t i = 0; i < coefNum; ++i) {
+ skipSE(&reader); // scaling_list_delta_coef
+ }
+ }
+ }
+ }
+ }
+ }
+ reader.skipBits(1); // amp_enabled_flag
+ reader.skipBits(1); // sample_adaptive_offset_enabled_flag u(1)
+ if (reader.getBitsWithFallback(1, 0)) { // pcm_enabled_flag
+ reader.skipBits(4); // pcm_sample_bit_depth_luma_minus1
+ reader.skipBits(4); // pcm_sample_bit_depth_chroma_minus1 u(4)
+ skipUE(&reader); // log2_min_pcm_luma_coding_block_size_minus3
+ skipUE(&reader); // log2_diff_max_min_pcm_luma_coding_block_size
+ reader.skipBits(1); // pcm_loop_filter_disabled_flag
+ }
+ uint32_t numShortTermRefPicSets = parseUEWithFallback(&reader, 0);
+ uint32_t numPics = 0;
+ for (uint32_t i = 0; i < numShortTermRefPicSets; ++i) {
+ // st_ref_pic_set(i)
+ if (i != 0 && reader.getBitsWithFallback(1, 0)) { // inter_ref_pic_set_prediction_flag
+ reader.skipBits(1); // delta_rps_sign
+ skipUE(&reader); // abs_delta_rps_minus1
+ uint32_t nextNumPics = 0;
+ for (uint32_t j = 0; j <= numPics; ++j) {
+ if (reader.getBitsWithFallback(1, 0) // used_by_curr_pic_flag[j]
+ || reader.getBitsWithFallback(1, 0)) { // use_delta_flag[j]
+ ++nextNumPics;
+ }
+ }
+ numPics = nextNumPics;
+ } else {
+ uint32_t numNegativePics = parseUEWithFallback(&reader, 0);
+ uint32_t numPositivePics = parseUEWithFallback(&reader, 0);
+ if (numNegativePics > UINT32_MAX - numPositivePics) {
+ return ERROR_MALFORMED;
+ }
+ numPics = numNegativePics + numPositivePics;
+ for (uint32_t j = 0; j < numPics; ++j) {
+ skipUE(&reader); // delta_poc_s0|1_minus1[i]
+ reader.skipBits(1); // used_by_curr_pic_s0|1_flag[i]
+ }
+ }
+ }
+ if (reader.getBitsWithFallback(1, 0)) { // long_term_ref_pics_present_flag
+ uint32_t numLongTermRefPicSps = parseUEWithFallback(&reader, 0);
+ for (uint32_t i = 0; i < numLongTermRefPicSps; ++i) {
+ reader.skipBits(log2MaxPicOrderCntLsb); // lt_ref_pic_poc_lsb_sps[i]
+ reader.skipBits(1); // used_by_curr_pic_lt_sps_flag[i]
+ }
+ }
+ reader.skipBits(1); // sps_temporal_mvp_enabled_flag
+ reader.skipBits(1); // strong_intra_smoothing_enabled_flag
+ if (reader.getBitsWithFallback(1, 0)) { // vui_parameters_present_flag
+ if (reader.getBitsWithFallback(1, 0)) { // aspect_ratio_info_present_flag
+ uint32_t aspectRatioIdc = reader.getBitsWithFallback(8, 0);
+ if (aspectRatioIdc == 0xFF /* EXTENDED_SAR */) {
+ reader.skipBits(16); // sar_width
+ reader.skipBits(16); // sar_height
+ }
+ }
+ if (reader.getBitsWithFallback(1, 0)) { // overscan_info_present_flag
+ reader.skipBits(1); // overscan_appropriate_flag
+ }
+ if (reader.getBitsWithFallback(1, 0)) { // video_signal_type_present_flag
+ reader.skipBits(3); // video_format
+ uint32_t videoFullRangeFlag;
+ if (reader.getBitsGraceful(1, &videoFullRangeFlag)) {
+ mParams.add(kVideoFullRangeFlag, videoFullRangeFlag);
+ }
+ if (reader.getBitsWithFallback(1, 0)) { // colour_description_present_flag
+ mInfo = (Info)(mInfo | kInfoHasColorDescription);
+ uint32_t colourPrimaries, transferCharacteristics, matrixCoeffs;
+ if (reader.getBitsGraceful(8, &colourPrimaries)) {
+ mParams.add(kColourPrimaries, colourPrimaries);
+ }
+ if (reader.getBitsGraceful(8, &transferCharacteristics)) {
+ mParams.add(kTransferCharacteristics, transferCharacteristics);
+ if (transferCharacteristics == 16 /* ST 2084 */
+ || transferCharacteristics == 18 /* ARIB STD-B67 HLG */) {
+ mInfo = (Info)(mInfo | kInfoIsHdr);
+ }
+ }
+ if (reader.getBitsGraceful(8, &matrixCoeffs)) {
+ mParams.add(kMatrixCoeffs, matrixCoeffs);
+ }
+ }
+ // skip rest of VUI
+ }
+ }
+
+ return reader.overRead() ? ERROR_MALFORMED : OK;
}
status_t HevcParameterSets::parsePps(
diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp
index f29ec11..6a67fcf 100644
--- a/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/MPEG4Extractor.cpp
@@ -1566,8 +1566,9 @@
const char *mime;
CHECK(mLastTrack->meta->findCString(kKeyMIMEType, &mime));
- if (!strcmp(mime, MEDIA_MIMETYPE_VIDEO_AVC)) {
- // AVC requires compression ratio of at least 2, and uses
+ if (!strcmp(mime, MEDIA_MIMETYPE_VIDEO_AVC)
+ || !strcmp(mime, MEDIA_MIMETYPE_VIDEO_HEVC)) {
+ // AVC & HEVC requires compression ratio of at least 2, and uses
// macroblocks
max_size = ((width + 15) / 16) * ((height + 15) / 16) * 192;
} else {
diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp
index 46a32fb..cc5f7a0 100644
--- a/media/libstagefright/MPEG4Writer.cpp
+++ b/media/libstagefright/MPEG4Writer.cpp
@@ -1957,6 +1957,7 @@
if (mProfileIdc != data[1] ||
mProfileCompatible != data[2] ||
mLevelIdc != data[3]) {
+ // COULD DO: set profile/level to the lowest required to support all SPSs
ALOGE("Inconsistent profile/level found in seq parameter sets");
return NULL;
}
diff --git a/media/libstagefright/OMXClient.cpp b/media/libstagefright/OMXClient.cpp
index 7279f6c..e994069 100644
--- a/media/libstagefright/OMXClient.cpp
+++ b/media/libstagefright/OMXClient.cpp
@@ -207,12 +207,14 @@
// static
MuxOMX::node_location MuxOMX::getPreferredCodecLocation(const char *name) {
if (sCodecProcessEnabled) {
+ // all codecs go to codec process unless excluded using system property, in which case
// all non-secure decoders, OMX.google.* codecs and encoders can go in the codec process
// (non-OMX.google.* encoders can be excluded using system property.)
if ((strcasestr(name, "decoder")
&& strcasestr(name, ".secure") != name + strlen(name) - 7)
|| (strcasestr(name, "encoder")
&& !property_get_bool("media.stagefright.legacyencoder", false))
+ || !property_get_bool("media.stagefright.less-secure", false)
|| !strncasecmp(name, "OMX.google.", 11)) {
return CODECPROCESS;
}
diff --git a/media/libstagefright/Utils.cpp b/media/libstagefright/Utils.cpp
index aa64d22..c461ca0 100644
--- a/media/libstagefright/Utils.cpp
+++ b/media/libstagefright/Utils.cpp
@@ -21,15 +21,20 @@
#include <stdio.h>
#include <sys/stat.h>
+#include <utility>
+
#include "include/ESDS.h"
#include "include/HevcUtils.h"
#include <arpa/inet.h>
#include <cutils/properties.h>
#include <media/openmax/OMX_Audio.h>
+#include <media/openmax/OMX_Video.h>
+#include <media/openmax/OMX_VideoExt.h>
#include <media/stagefright/CodecBase.h>
#include <media/stagefright/foundation/ABuffer.h>
#include <media/stagefright/foundation/ADebug.h>
+#include <media/stagefright/foundation/ALookup.h>
#include <media/stagefright/foundation/AMessage.h>
#include <media/stagefright/MetaData.h>
#include <media/stagefright/MediaDefs.h>
@@ -91,6 +96,7 @@
return OK;
}
+#if 0
static void convertMetaDataToMessageInt32(
const sp<MetaData> &meta, sp<AMessage> &msg, uint32_t key, const char *name) {
int32_t value;
@@ -98,6 +104,7 @@
msg->setInt32(name, value);
}
}
+#endif
static void convertMetaDataToMessageColorAspects(const sp<MetaData> &meta, sp<AMessage> &msg) {
// 0 values are unspecified
@@ -134,6 +141,456 @@
}
}
+static bool isHdr(const sp<AMessage> &format) {
+ // if CSD specifies HDR transfer(s), we assume HDR. Otherwise, if it specifies non-HDR
+ // transfers, we must assume non-HDR. This is because CSD trumps any color-transfer key
+ // in the format.
+ int32_t isHdr;
+ if (format->findInt32("android._is-hdr", &isHdr)) {
+ return isHdr;
+ }
+
+ // if user/container supplied HDR static info without transfer set, assume true
+ if (format->contains("hdr-static-info") && !format->contains("color-transfer")) {
+ return true;
+ }
+ // otherwise, verify that an HDR transfer function is set
+ int32_t transfer;
+ if (format->findInt32("color-transfer", &transfer)) {
+ return transfer == ColorUtils::kColorTransferST2084
+ || transfer == ColorUtils::kColorTransferHLG;
+ }
+ return false;
+}
+
+static void parseAacProfileFromCsd(const sp<ABuffer> &csd, sp<AMessage> &format) {
+ if (csd->size() < 2) {
+ return;
+ }
+
+ uint16_t audioObjectType = U16_AT((uint8_t*)csd->data());
+ if ((audioObjectType & 0xF800) == 0xF800) {
+ audioObjectType = 32 + ((audioObjectType >> 5) & 0x3F);
+ } else {
+ audioObjectType >>= 11;
+ }
+
+ const static ALookup<uint16_t, OMX_AUDIO_AACPROFILETYPE> profiles {
+ { 1, OMX_AUDIO_AACObjectMain },
+ { 2, OMX_AUDIO_AACObjectLC },
+ { 3, OMX_AUDIO_AACObjectSSR },
+ { 4, OMX_AUDIO_AACObjectLTP },
+ { 5, OMX_AUDIO_AACObjectHE },
+ { 6, OMX_AUDIO_AACObjectScalable },
+ { 17, OMX_AUDIO_AACObjectERLC },
+ { 23, OMX_AUDIO_AACObjectLD },
+ { 29, OMX_AUDIO_AACObjectHE_PS },
+ { 39, OMX_AUDIO_AACObjectELD },
+ };
+
+ OMX_AUDIO_AACPROFILETYPE profile;
+ if (profiles.map(audioObjectType, &profile)) {
+ format->setInt32("profile", profile);
+ }
+}
+
+static void parseAvcProfileLevelFromAvcc(const uint8_t *ptr, size_t size, sp<AMessage> &format) {
+ if (size < 4 || ptr[0] != 1) { // configurationVersion == 1
+ return;
+ }
+ const uint8_t profile = ptr[1];
+ const uint8_t constraints = ptr[2];
+ const uint8_t level = ptr[3];
+
+ const static ALookup<uint8_t, OMX_VIDEO_AVCLEVELTYPE> levels {
+ { 9, OMX_VIDEO_AVCLevel1b }, // technically, 9 is only used for High+ profiles
+ { 10, OMX_VIDEO_AVCLevel1 },
+ { 11, OMX_VIDEO_AVCLevel11 }, // prefer level 1.1 for the value 11
+ { 11, OMX_VIDEO_AVCLevel1b },
+ { 12, OMX_VIDEO_AVCLevel12 },
+ { 13, OMX_VIDEO_AVCLevel13 },
+ { 20, OMX_VIDEO_AVCLevel2 },
+ { 21, OMX_VIDEO_AVCLevel21 },
+ { 22, OMX_VIDEO_AVCLevel22 },
+ { 30, OMX_VIDEO_AVCLevel3 },
+ { 31, OMX_VIDEO_AVCLevel31 },
+ { 32, OMX_VIDEO_AVCLevel32 },
+ { 40, OMX_VIDEO_AVCLevel4 },
+ { 41, OMX_VIDEO_AVCLevel41 },
+ { 42, OMX_VIDEO_AVCLevel42 },
+ { 50, OMX_VIDEO_AVCLevel5 },
+ { 51, OMX_VIDEO_AVCLevel51 },
+ { 52, OMX_VIDEO_AVCLevel52 },
+ };
+ const static ALookup<uint8_t, OMX_VIDEO_AVCPROFILETYPE> profiles {
+ { 66, OMX_VIDEO_AVCProfileBaseline },
+ { 77, OMX_VIDEO_AVCProfileMain },
+ { 88, OMX_VIDEO_AVCProfileExtended },
+ { 100, OMX_VIDEO_AVCProfileHigh },
+ { 110, OMX_VIDEO_AVCProfileHigh10 },
+ { 122, OMX_VIDEO_AVCProfileHigh422 },
+ { 244, OMX_VIDEO_AVCProfileHigh444 },
+ };
+
+ // set profile & level if they are recognized
+ OMX_VIDEO_AVCPROFILETYPE codecProfile;
+ OMX_VIDEO_AVCLEVELTYPE codecLevel;
+ if (profiles.map(profile, &codecProfile)) {
+ format->setInt32("profile", codecProfile);
+ if (levels.map(level, &codecLevel)) {
+ // for 9 && 11 decide level based on profile and constraint_set3 flag
+ if (level == 11 && (profile == 66 || profile == 77 || profile == 88)) {
+ codecLevel = (constraints & 0x10) ? OMX_VIDEO_AVCLevel1b : OMX_VIDEO_AVCLevel11;
+ }
+ format->setInt32("level", codecLevel);
+ }
+ }
+}
+
+static void parseH263ProfileLevelFromD263(const uint8_t *ptr, size_t size, sp<AMessage> &format) {
+ if (size < 7) {
+ return;
+ }
+
+ const uint8_t profile = ptr[6];
+ const uint8_t level = ptr[5];
+
+ const static ALookup<uint8_t, OMX_VIDEO_H263PROFILETYPE> profiles {
+ { 0, OMX_VIDEO_H263ProfileBaseline },
+ { 1, OMX_VIDEO_H263ProfileH320Coding },
+ { 2, OMX_VIDEO_H263ProfileBackwardCompatible },
+ { 3, OMX_VIDEO_H263ProfileISWV2 },
+ { 4, OMX_VIDEO_H263ProfileISWV3 },
+ { 5, OMX_VIDEO_H263ProfileHighCompression },
+ { 6, OMX_VIDEO_H263ProfileInternet },
+ { 7, OMX_VIDEO_H263ProfileInterlace },
+ { 8, OMX_VIDEO_H263ProfileHighLatency },
+ };
+
+ const static ALookup<uint8_t, OMX_VIDEO_H263LEVELTYPE> levels {
+ { 10, OMX_VIDEO_H263Level10 },
+ { 20, OMX_VIDEO_H263Level20 },
+ { 30, OMX_VIDEO_H263Level30 },
+ { 40, OMX_VIDEO_H263Level40 },
+ { 45, OMX_VIDEO_H263Level45 },
+ { 50, OMX_VIDEO_H263Level50 },
+ { 60, OMX_VIDEO_H263Level60 },
+ { 70, OMX_VIDEO_H263Level70 },
+ };
+
+ // set profile & level if they are recognized
+ OMX_VIDEO_H263PROFILETYPE codecProfile;
+ OMX_VIDEO_H263LEVELTYPE codecLevel;
+ if (profiles.map(profile, &codecProfile)) {
+ format->setInt32("profile", codecProfile);
+ if (levels.map(level, &codecLevel)) {
+ format->setInt32("level", codecLevel);
+ }
+ }
+}
+
+static void parseHevcProfileLevelFromHvcc(const uint8_t *ptr, size_t size, sp<AMessage> &format) {
+ if (size < 13 || ptr[0] != 1) { // configurationVersion == 1
+ return;
+ }
+
+ const uint8_t profile = ptr[1] & 0x1F;
+ const uint8_t tier = (ptr[1] & 0x20) >> 5;
+ const uint8_t level = ptr[12];
+
+ const static ALookup<std::pair<uint8_t, uint8_t>, OMX_VIDEO_HEVCLEVELTYPE> levels {
+ { { 0, 30 }, OMX_VIDEO_HEVCMainTierLevel1 },
+ { { 0, 60 }, OMX_VIDEO_HEVCMainTierLevel2 },
+ { { 0, 63 }, OMX_VIDEO_HEVCMainTierLevel21 },
+ { { 0, 90 }, OMX_VIDEO_HEVCMainTierLevel3 },
+ { { 0, 93 }, OMX_VIDEO_HEVCMainTierLevel31 },
+ { { 0, 120 }, OMX_VIDEO_HEVCMainTierLevel4 },
+ { { 0, 123 }, OMX_VIDEO_HEVCMainTierLevel41 },
+ { { 0, 150 }, OMX_VIDEO_HEVCMainTierLevel5 },
+ { { 0, 153 }, OMX_VIDEO_HEVCMainTierLevel51 },
+ { { 0, 156 }, OMX_VIDEO_HEVCMainTierLevel52 },
+ { { 0, 180 }, OMX_VIDEO_HEVCMainTierLevel6 },
+ { { 0, 183 }, OMX_VIDEO_HEVCMainTierLevel61 },
+ { { 0, 186 }, OMX_VIDEO_HEVCMainTierLevel62 },
+ { { 1, 30 }, OMX_VIDEO_HEVCHighTierLevel1 },
+ { { 1, 60 }, OMX_VIDEO_HEVCHighTierLevel2 },
+ { { 1, 63 }, OMX_VIDEO_HEVCHighTierLevel21 },
+ { { 1, 90 }, OMX_VIDEO_HEVCHighTierLevel3 },
+ { { 1, 93 }, OMX_VIDEO_HEVCHighTierLevel31 },
+ { { 1, 120 }, OMX_VIDEO_HEVCHighTierLevel4 },
+ { { 1, 123 }, OMX_VIDEO_HEVCHighTierLevel41 },
+ { { 1, 150 }, OMX_VIDEO_HEVCHighTierLevel5 },
+ { { 1, 153 }, OMX_VIDEO_HEVCHighTierLevel51 },
+ { { 1, 156 }, OMX_VIDEO_HEVCHighTierLevel52 },
+ { { 1, 180 }, OMX_VIDEO_HEVCHighTierLevel6 },
+ { { 1, 183 }, OMX_VIDEO_HEVCHighTierLevel61 },
+ { { 1, 186 }, OMX_VIDEO_HEVCHighTierLevel62 },
+ };
+
+ const static ALookup<uint8_t, OMX_VIDEO_HEVCPROFILETYPE> profiles {
+ { 1, OMX_VIDEO_HEVCProfileMain },
+ { 2, OMX_VIDEO_HEVCProfileMain10 },
+ };
+
+ // set profile & level if they are recognized
+ OMX_VIDEO_HEVCPROFILETYPE codecProfile;
+ OMX_VIDEO_HEVCLEVELTYPE codecLevel;
+ if (!profiles.map(profile, &codecProfile)) {
+ if (ptr[2] & 0x40 /* general compatibility flag 1 */) {
+ codecProfile = OMX_VIDEO_HEVCProfileMain;
+ } else if (ptr[2] & 0x20 /* general compatibility flag 2 */) {
+ codecProfile = OMX_VIDEO_HEVCProfileMain10;
+ } else {
+ return;
+ }
+ }
+
+ // bump to HDR profile
+ if (isHdr(format) && codecProfile == OMX_VIDEO_HEVCProfileMain10) {
+ codecProfile = OMX_VIDEO_HEVCProfileMain10HDR10;
+ }
+
+ format->setInt32("profile", codecProfile);
+ if (levels.map(std::make_pair(tier, level), &codecLevel)) {
+ format->setInt32("level", codecLevel);
+ }
+}
+
+static void parseMpeg2ProfileLevelFromHeader(
+ const uint8_t *data, size_t size, sp<AMessage> &format) {
+ // find sequence extension
+ const uint8_t *seq = (const uint8_t*)memmem(data, size, "\x00\x00\x01\xB5", 4);
+ if (seq != NULL && seq + 5 < data + size) {
+ const uint8_t start_code = seq[4] >> 4;
+ if (start_code != 1 /* sequence extension ID */) {
+ return;
+ }
+ const uint8_t indication = ((seq[4] & 0xF) << 4) | ((seq[5] & 0xF0) >> 4);
+
+ const static ALookup<uint8_t, OMX_VIDEO_MPEG2PROFILETYPE> profiles {
+ { 0x50, OMX_VIDEO_MPEG2ProfileSimple },
+ { 0x40, OMX_VIDEO_MPEG2ProfileMain },
+ { 0x30, OMX_VIDEO_MPEG2ProfileSNR },
+ { 0x20, OMX_VIDEO_MPEG2ProfileSpatial },
+ { 0x10, OMX_VIDEO_MPEG2ProfileHigh },
+ };
+
+ const static ALookup<uint8_t, OMX_VIDEO_MPEG2LEVELTYPE> levels {
+ { 0x0A, OMX_VIDEO_MPEG2LevelLL },
+ { 0x08, OMX_VIDEO_MPEG2LevelML },
+ { 0x06, OMX_VIDEO_MPEG2LevelH14 },
+ { 0x04, OMX_VIDEO_MPEG2LevelHL },
+ { 0x02, OMX_VIDEO_MPEG2LevelHP },
+ };
+
+ const static ALookup<uint8_t,
+ std::pair<OMX_VIDEO_MPEG2PROFILETYPE, OMX_VIDEO_MPEG2LEVELTYPE>> escapes {
+ /* unsupported
+ { 0x8E, { XXX_MPEG2ProfileMultiView, OMX_VIDEO_MPEG2LevelLL } },
+ { 0x8D, { XXX_MPEG2ProfileMultiView, OMX_VIDEO_MPEG2LevelML } },
+ { 0x8B, { XXX_MPEG2ProfileMultiView, OMX_VIDEO_MPEG2LevelH14 } },
+ { 0x8A, { XXX_MPEG2ProfileMultiView, OMX_VIDEO_MPEG2LevelHL } }, */
+ { 0x85, { OMX_VIDEO_MPEG2Profile422, OMX_VIDEO_MPEG2LevelML } },
+ { 0x82, { OMX_VIDEO_MPEG2Profile422, OMX_VIDEO_MPEG2LevelHL } },
+ };
+
+ OMX_VIDEO_MPEG2PROFILETYPE profile;
+ OMX_VIDEO_MPEG2LEVELTYPE level;
+ std::pair<OMX_VIDEO_MPEG2PROFILETYPE, OMX_VIDEO_MPEG2LEVELTYPE> profileLevel;
+ if (escapes.map(indication, &profileLevel)) {
+ format->setInt32("profile", profileLevel.first);
+ format->setInt32("level", profileLevel.second);
+ } else if (profiles.map(indication & 0x70, &profile)) {
+ format->setInt32("profile", profile);
+ if (levels.map(indication & 0xF, &level)) {
+ format->setInt32("level", level);
+ }
+ }
+ }
+}
+
+static void parseMpeg2ProfileLevelFromEsds(ESDS &esds, sp<AMessage> &format) {
+ // esds seems to only contain the profile for MPEG-2
+ uint8_t objType;
+ if (esds.getObjectTypeIndication(&objType) == OK) {
+ const static ALookup<uint8_t, OMX_VIDEO_MPEG2PROFILETYPE> profiles{
+ { 0x60, OMX_VIDEO_MPEG2ProfileSimple },
+ { 0x61, OMX_VIDEO_MPEG2ProfileMain },
+ { 0x62, OMX_VIDEO_MPEG2ProfileSNR },
+ { 0x63, OMX_VIDEO_MPEG2ProfileSpatial },
+ { 0x64, OMX_VIDEO_MPEG2ProfileHigh },
+ { 0x65, OMX_VIDEO_MPEG2Profile422 },
+ };
+
+ OMX_VIDEO_MPEG2PROFILETYPE profile;
+ if (profiles.map(objType, &profile)) {
+ format->setInt32("profile", profile);
+ }
+ }
+}
+
+static void parseMpeg4ProfileLevelFromCsd(const sp<ABuffer> &csd, sp<AMessage> &format) {
+ const uint8_t *data = csd->data();
+ // find visual object sequence
+ const uint8_t *seq = (const uint8_t*)memmem(data, csd->size(), "\x00\x00\x01\xB0", 4);
+ if (seq != NULL && seq + 4 < data + csd->size()) {
+ const uint8_t indication = seq[4];
+
+ const static ALookup<uint8_t,
+ std::pair<OMX_VIDEO_MPEG4PROFILETYPE, OMX_VIDEO_MPEG4LEVELTYPE>> table {
+ { 0b00000001, { OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level1 } },
+ { 0b00000010, { OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level2 } },
+ { 0b00000011, { OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level3 } },
+ { 0b00000100, { OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level4a } },
+ { 0b00000101, { OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level5 } },
+ { 0b00000110, { OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level6 } },
+ { 0b00001000, { OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level0 } },
+ { 0b00001001, { OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level0b } },
+ { 0b00010000, { OMX_VIDEO_MPEG4ProfileSimpleScalable, OMX_VIDEO_MPEG4Level0 } },
+ { 0b00010001, { OMX_VIDEO_MPEG4ProfileSimpleScalable, OMX_VIDEO_MPEG4Level1 } },
+ { 0b00010010, { OMX_VIDEO_MPEG4ProfileSimpleScalable, OMX_VIDEO_MPEG4Level2 } },
+ /* unsupported
+ { 0b00011101, { XXX_MPEG4ProfileSimpleScalableER, OMX_VIDEO_MPEG4Level0 } },
+ { 0b00011110, { XXX_MPEG4ProfileSimpleScalableER, OMX_VIDEO_MPEG4Level1 } },
+ { 0b00011111, { XXX_MPEG4ProfileSimpleScalableER, OMX_VIDEO_MPEG4Level2 } }, */
+ { 0b00100001, { OMX_VIDEO_MPEG4ProfileCore, OMX_VIDEO_MPEG4Level1 } },
+ { 0b00100010, { OMX_VIDEO_MPEG4ProfileCore, OMX_VIDEO_MPEG4Level2 } },
+ { 0b00110010, { OMX_VIDEO_MPEG4ProfileMain, OMX_VIDEO_MPEG4Level2 } },
+ { 0b00110011, { OMX_VIDEO_MPEG4ProfileMain, OMX_VIDEO_MPEG4Level3 } },
+ { 0b00110100, { OMX_VIDEO_MPEG4ProfileMain, OMX_VIDEO_MPEG4Level4 } },
+ /* deprecated
+ { 0b01000010, { OMX_VIDEO_MPEG4ProfileNbit, OMX_VIDEO_MPEG4Level2 } }, */
+ { 0b01010001, { OMX_VIDEO_MPEG4ProfileScalableTexture, OMX_VIDEO_MPEG4Level1 } },
+ { 0b01100001, { OMX_VIDEO_MPEG4ProfileSimpleFace, OMX_VIDEO_MPEG4Level1 } },
+ { 0b01100010, { OMX_VIDEO_MPEG4ProfileSimpleFace, OMX_VIDEO_MPEG4Level2 } },
+ { 0b01100011, { OMX_VIDEO_MPEG4ProfileSimpleFBA, OMX_VIDEO_MPEG4Level1 } },
+ { 0b01100100, { OMX_VIDEO_MPEG4ProfileSimpleFBA, OMX_VIDEO_MPEG4Level2 } },
+ { 0b01110001, { OMX_VIDEO_MPEG4ProfileBasicAnimated, OMX_VIDEO_MPEG4Level1 } },
+ { 0b01110010, { OMX_VIDEO_MPEG4ProfileBasicAnimated, OMX_VIDEO_MPEG4Level2 } },
+ { 0b10000001, { OMX_VIDEO_MPEG4ProfileHybrid, OMX_VIDEO_MPEG4Level1 } },
+ { 0b10000010, { OMX_VIDEO_MPEG4ProfileHybrid, OMX_VIDEO_MPEG4Level2 } },
+ { 0b10010001, { OMX_VIDEO_MPEG4ProfileAdvancedRealTime, OMX_VIDEO_MPEG4Level1 } },
+ { 0b10010010, { OMX_VIDEO_MPEG4ProfileAdvancedRealTime, OMX_VIDEO_MPEG4Level2 } },
+ { 0b10010011, { OMX_VIDEO_MPEG4ProfileAdvancedRealTime, OMX_VIDEO_MPEG4Level3 } },
+ { 0b10010100, { OMX_VIDEO_MPEG4ProfileAdvancedRealTime, OMX_VIDEO_MPEG4Level4 } },
+ { 0b10100001, { OMX_VIDEO_MPEG4ProfileCoreScalable, OMX_VIDEO_MPEG4Level1 } },
+ { 0b10100010, { OMX_VIDEO_MPEG4ProfileCoreScalable, OMX_VIDEO_MPEG4Level2 } },
+ { 0b10100011, { OMX_VIDEO_MPEG4ProfileCoreScalable, OMX_VIDEO_MPEG4Level3 } },
+ { 0b10110001, { OMX_VIDEO_MPEG4ProfileAdvancedCoding, OMX_VIDEO_MPEG4Level1 } },
+ { 0b10110010, { OMX_VIDEO_MPEG4ProfileAdvancedCoding, OMX_VIDEO_MPEG4Level2 } },
+ { 0b10110011, { OMX_VIDEO_MPEG4ProfileAdvancedCoding, OMX_VIDEO_MPEG4Level3 } },
+ { 0b10110100, { OMX_VIDEO_MPEG4ProfileAdvancedCoding, OMX_VIDEO_MPEG4Level4 } },
+ { 0b11000001, { OMX_VIDEO_MPEG4ProfileAdvancedCore, OMX_VIDEO_MPEG4Level1 } },
+ { 0b11000010, { OMX_VIDEO_MPEG4ProfileAdvancedCore, OMX_VIDEO_MPEG4Level2 } },
+ { 0b11010001, { OMX_VIDEO_MPEG4ProfileAdvancedScalable, OMX_VIDEO_MPEG4Level1 } },
+ { 0b11010010, { OMX_VIDEO_MPEG4ProfileAdvancedScalable, OMX_VIDEO_MPEG4Level2 } },
+ { 0b11010011, { OMX_VIDEO_MPEG4ProfileAdvancedScalable, OMX_VIDEO_MPEG4Level3 } },
+ /* unsupported
+ { 0b11100001, { XXX_MPEG4ProfileSimpleStudio, OMX_VIDEO_MPEG4Level1 } },
+ { 0b11100010, { XXX_MPEG4ProfileSimpleStudio, OMX_VIDEO_MPEG4Level2 } },
+ { 0b11100011, { XXX_MPEG4ProfileSimpleStudio, OMX_VIDEO_MPEG4Level3 } },
+ { 0b11100100, { XXX_MPEG4ProfileSimpleStudio, OMX_VIDEO_MPEG4Level4 } },
+ { 0b11100101, { XXX_MPEG4ProfileCoreStudio, OMX_VIDEO_MPEG4Level1 } },
+ { 0b11100110, { XXX_MPEG4ProfileCoreStudio, OMX_VIDEO_MPEG4Level2 } },
+ { 0b11100111, { XXX_MPEG4ProfileCoreStudio, OMX_VIDEO_MPEG4Level3 } },
+ { 0b11101000, { XXX_MPEG4ProfileCoreStudio, OMX_VIDEO_MPEG4Level4 } },
+ { 0b11101011, { XXX_MPEG4ProfileSimpleStudio, OMX_VIDEO_MPEG4Level5 } },
+ { 0b11101100, { XXX_MPEG4ProfileSimpleStudio, OMX_VIDEO_MPEG4Level6 } }, */
+ { 0b11110000, { OMX_VIDEO_MPEG4ProfileAdvancedSimple, OMX_VIDEO_MPEG4Level0 } },
+ { 0b11110001, { OMX_VIDEO_MPEG4ProfileAdvancedSimple, OMX_VIDEO_MPEG4Level1 } },
+ { 0b11110010, { OMX_VIDEO_MPEG4ProfileAdvancedSimple, OMX_VIDEO_MPEG4Level2 } },
+ { 0b11110011, { OMX_VIDEO_MPEG4ProfileAdvancedSimple, OMX_VIDEO_MPEG4Level3 } },
+ { 0b11110100, { OMX_VIDEO_MPEG4ProfileAdvancedSimple, OMX_VIDEO_MPEG4Level4 } },
+ { 0b11110101, { OMX_VIDEO_MPEG4ProfileAdvancedSimple, OMX_VIDEO_MPEG4Level5 } },
+ { 0b11110111, { OMX_VIDEO_MPEG4ProfileAdvancedSimple, OMX_VIDEO_MPEG4Level3b } },
+ /* deprecated
+ { 0b11111000, { XXX_MPEG4ProfileFineGranularityScalable, OMX_VIDEO_MPEG4Level0 } },
+ { 0b11111001, { XXX_MPEG4ProfileFineGranularityScalable, OMX_VIDEO_MPEG4Level1 } },
+ { 0b11111010, { XXX_MPEG4ProfileFineGranularityScalable, OMX_VIDEO_MPEG4Level2 } },
+ { 0b11111011, { XXX_MPEG4ProfileFineGranularityScalable, OMX_VIDEO_MPEG4Level3 } },
+ { 0b11111100, { XXX_MPEG4ProfileFineGranularityScalable, OMX_VIDEO_MPEG4Level4 } },
+ { 0b11111101, { XXX_MPEG4ProfileFineGranularityScalable, OMX_VIDEO_MPEG4Level5 } }, */
+ };
+
+ std::pair<OMX_VIDEO_MPEG4PROFILETYPE, OMX_VIDEO_MPEG4LEVELTYPE> profileLevel;
+ if (table.map(indication, &profileLevel)) {
+ format->setInt32("profile", profileLevel.first);
+ format->setInt32("level", profileLevel.second);
+ }
+ }
+}
+
+static void parseVp9ProfileLevelFromCsd(const sp<ABuffer> &csd, sp<AMessage> &format) {
+ const uint8_t *data = csd->data();
+ size_t remaining = csd->size();
+
+ while (remaining >= 2) {
+ const uint8_t id = data[0];
+ const uint8_t length = data[1];
+ remaining -= 2;
+ data += 2;
+ if (length > remaining) {
+ break;
+ }
+ switch (id) {
+ case 1 /* profileId */:
+ if (length >= 1) {
+ const static ALookup<uint8_t, OMX_VIDEO_VP9PROFILETYPE> profiles {
+ { 0, OMX_VIDEO_VP9Profile0 },
+ { 1, OMX_VIDEO_VP9Profile1 },
+ { 2, OMX_VIDEO_VP9Profile2 },
+ { 3, OMX_VIDEO_VP9Profile3 },
+ };
+
+ const static ALookup<OMX_VIDEO_VP9PROFILETYPE, OMX_VIDEO_VP9PROFILETYPE> toHdr {
+ { OMX_VIDEO_VP9Profile2, OMX_VIDEO_VP9Profile2HDR },
+ { OMX_VIDEO_VP9Profile3, OMX_VIDEO_VP9Profile3HDR },
+ };
+
+ OMX_VIDEO_VP9PROFILETYPE profile;
+ if (profiles.map(data[0], &profile)) {
+ // convert to HDR profile
+ if (isHdr(format)) {
+ toHdr.lookup(profile, &profile);
+ }
+
+ format->setInt32("profile", profile);
+ }
+ }
+ break;
+ case 2 /* levelId */:
+ if (length >= 1) {
+ const static ALookup<uint8_t, OMX_VIDEO_VP9LEVELTYPE> levels {
+ { 10, OMX_VIDEO_VP9Level1 },
+ { 11, OMX_VIDEO_VP9Level11 },
+ { 20, OMX_VIDEO_VP9Level2 },
+ { 21, OMX_VIDEO_VP9Level21 },
+ { 30, OMX_VIDEO_VP9Level3 },
+ { 31, OMX_VIDEO_VP9Level31 },
+ { 40, OMX_VIDEO_VP9Level4 },
+ { 41, OMX_VIDEO_VP9Level41 },
+ { 50, OMX_VIDEO_VP9Level5 },
+ { 51, OMX_VIDEO_VP9Level51 },
+ { 52, OMX_VIDEO_VP9Level52 },
+ { 60, OMX_VIDEO_VP9Level6 },
+ { 61, OMX_VIDEO_VP9Level61 },
+ { 62, OMX_VIDEO_VP9Level62 },
+ };
+
+ OMX_VIDEO_VP9LEVELTYPE level;
+ if (levels.map(data[0], &level)) {
+ format->setInt32("level", level);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ remaining -= length;
+ data += length;
+ }
+}
+
status_t convertMetaDataToMessage(
const sp<MetaData> &meta, sp<AMessage> *format) {
@@ -157,13 +614,14 @@
msg->setInt64("durationUs", durationUs);
}
- int32_t avgBitRate;
- if (meta->findInt32(kKeyBitRate, &avgBitRate)) {
+ int32_t avgBitRate = 0;
+ if (meta->findInt32(kKeyBitRate, &avgBitRate) && avgBitRate > 0) {
msg->setInt32("bitrate", avgBitRate);
}
int32_t maxBitRate;
- if (meta->findInt32(kKeyMaxBitRate, &maxBitRate)) {
+ if (meta->findInt32(kKeyMaxBitRate, &maxBitRate)
+ && maxBitRate > 0 && maxBitRate >= avgBitRate) {
msg->setInt32("max-bitrate", maxBitRate);
}
@@ -214,8 +672,14 @@
msg->setInt32("rotation-degrees", rotationDegrees);
}
- convertMetaDataToMessageInt32(meta, msg, kKeyMinLuminance, "min-luminance");
- convertMetaDataToMessageInt32(meta, msg, kKeyMaxLuminance, "max-luminance");
+ uint32_t type;
+ const void *data;
+ size_t size;
+ if (meta->findData(kKeyHdrStaticInfo, &type, &data, &size)
+ && type == 'hdrS' && size == sizeof(HDRStaticInfo)) {
+ ColorUtils::setHDRStaticInfoIntoFormat(*(HDRStaticInfo*)data, msg);
+ }
+
convertMetaDataToMessageColorAspects(meta, msg);
} else if (!strncasecmp("audio/", mime, 6)) {
int32_t numChannels, sampleRate;
@@ -294,8 +758,8 @@
ALOGE("b/23680780");
return BAD_VALUE;
}
- uint8_t profile __unused = ptr[1];
- uint8_t level __unused = ptr[3];
+
+ parseAvcProfileLevelFromAvcc(ptr, size, msg);
// There is decodable content out there that fails the following
// assertion, let's be lenient for now...
@@ -391,12 +855,11 @@
ALOGE("b/23680780");
return BAD_VALUE;
}
- uint8_t profile __unused = ptr[1] & 31;
- uint8_t level __unused = ptr[12];
+
+ const size_t dataSize = size; // save for later
ptr += 22;
size -= 22;
-
size_t numofArrays = (char)ptr[0];
ptr += 1;
size -= 1;
@@ -408,6 +871,8 @@
}
buffer->setRange(0, 0);
+ HevcParameterSets hvcc;
+
for (i = 0; i < numofArrays; i++) {
if (size < 3) {
ALOGE("b/23680780");
@@ -439,6 +904,7 @@
if (err != OK) {
return err;
}
+ (void)hvcc.addNalUnit(ptr, length);
ptr += length;
size -= length;
@@ -448,6 +914,14 @@
buffer->meta()->setInt64("timeUs", 0);
msg->setBuffer("csd-0", buffer);
+ // if we saw VUI color information we know whether this is HDR because VUI trumps other
+ // format parameters for HEVC.
+ HevcParameterSets::Info info = hvcc.getInfo();
+ if (info & hvcc.kInfoHasColorDescription) {
+ msg->setInt32("android._is-hdr", (info & hvcc.kInfoIsHdr) != 0);
+ }
+
+ parseHevcProfileLevelFromHvcc((const uint8_t *)data, dataSize, msg);
} else if (meta->findData(kKeyESDS, &type, &data, &size)) {
ESDS esds((const char *)data, size);
if (esds.InitCheck() != (status_t)OK) {
@@ -471,17 +945,33 @@
buffer->meta()->setInt64("timeUs", 0);
msg->setBuffer("csd-0", buffer);
+ if (!strcasecmp(mime, MEDIA_MIMETYPE_VIDEO_MPEG4)) {
+ parseMpeg4ProfileLevelFromCsd(buffer, msg);
+ } else if (!strcasecmp(mime, MEDIA_MIMETYPE_VIDEO_MPEG2)) {
+ parseMpeg2ProfileLevelFromEsds(esds, msg);
+ if (meta->findData(kKeyStreamHeader, &type, &data, &size)) {
+ parseMpeg2ProfileLevelFromHeader((uint8_t*)data, size, msg);
+ }
+ } else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AAC)) {
+ parseAacProfileFromCsd(buffer, msg);
+ }
+
uint32_t maxBitrate, avgBitrate;
if (esds.getBitRate(&maxBitrate, &avgBitrate) == OK) {
- if (!meta->hasData(kKeyMaxBitRate)
- && maxBitrate > 0 && maxBitrate <= INT32_MAX) {
- msg->setInt32("max-bitrate", (int32_t)maxBitrate);
- }
if (!meta->hasData(kKeyBitRate)
&& avgBitrate > 0 && avgBitrate <= INT32_MAX) {
msg->setInt32("bitrate", (int32_t)avgBitrate);
+ } else {
+ (void)msg->findInt32("bitrate", (int32_t*)&avgBitrate);
+ }
+ if (!meta->hasData(kKeyMaxBitRate)
+ && maxBitrate > 0 && maxBitrate <= INT32_MAX && maxBitrate >= avgBitrate) {
+ msg->setInt32("max-bitrate", (int32_t)maxBitrate);
}
}
+ } else if (meta->findData(kTypeD263, &type, &data, &size)) {
+ const uint8_t *ptr = (const uint8_t *)data;
+ parseH263ProfileLevelFromD263(ptr, size, msg);
} else if (meta->findData(kKeyVorbisInfo, &type, &data, &size)) {
sp<ABuffer> buffer = new (std::nothrow) ABuffer(size);
if (buffer.get() == NULL || buffer->base() == NULL) {
@@ -554,6 +1044,8 @@
buffer->meta()->setInt32("csd", true);
buffer->meta()->setInt64("timeUs", 0);
msg->setBuffer("csd-0", buffer);
+
+ parseVp9ProfileLevelFromCsd(buffer, msg);
}
// TODO expose "crypto-key"/kKeyCryptoKey through public api
@@ -714,6 +1206,7 @@
return size;
}
+#if 0
static void convertMessageToMetaDataInt32(
const sp<AMessage> &msg, sp<MetaData> &meta, uint32_t key, const char *name) {
int32_t value;
@@ -721,6 +1214,7 @@
meta->setInt32(key, value);
}
}
+#endif
static void convertMessageToMetaDataColorAspects(const sp<AMessage> &msg, sp<MetaData> &meta) {
// 0 values are unspecified
@@ -769,6 +1263,15 @@
meta->setInt32(kKeyIsSyncFrame, 1);
}
+ int32_t avgBitrate = 0;
+ int32_t maxBitrate;
+ if (msg->findInt32("bitrate", &avgBitrate) && avgBitrate > 0) {
+ meta->setInt32(kKeyBitRate, avgBitrate);
+ }
+ if (msg->findInt32("max-bitrate", &maxBitrate) && maxBitrate > 0 && maxBitrate >= avgBitrate) {
+ meta->setInt32(kKeyMaxBitRate, maxBitrate);
+ }
+
if (mime.startsWith("video/")) {
int32_t width;
int32_t height;
@@ -805,8 +1308,13 @@
meta->setInt32(kKeyRotation, rotationDegrees);
}
- convertMessageToMetaDataInt32(msg, meta, kKeyMinLuminance, "min-luminance");
- convertMessageToMetaDataInt32(msg, meta, kKeyMaxLuminance, "max-luminance");
+ if (msg->contains("hdr-static-info")) {
+ HDRStaticInfo info;
+ if (ColorUtils::getHDRStaticInfoFromFormat(msg, &info)) {
+ meta->setData(kKeyHdrStaticInfo, 'hdrS', &info, sizeof(info));
+ }
+ }
+
convertMessageToMetaDataColorAspects(msg, meta);
} else if (mime.startsWith("audio/")) {
int32_t numChannels;
diff --git a/media/libstagefright/avc_utils.cpp b/media/libstagefright/avc_utils.cpp
index 8ef2dca..30080f3 100644
--- a/media/libstagefright/avc_utils.cpp
+++ b/media/libstagefright/avc_utils.cpp
@@ -41,12 +41,39 @@
return x + (1u << numZeroes) - 1;
}
+unsigned parseUEWithFallback(ABitReader *br, unsigned fallback) {
+ unsigned numZeroes = 0;
+ while (br->getBitsWithFallback(1, 1) == 0) {
+ ++numZeroes;
+ }
+ uint32_t x;
+ if (numZeroes < 32) {
+ if (br->getBitsGraceful(numZeroes, &x)) {
+ return x + (1u << numZeroes) - 1;
+ } else {
+ return fallback;
+ }
+ } else {
+ br->skipBits(numZeroes);
+ return fallback;
+ }
+}
+
signed parseSE(ABitReader *br) {
unsigned codeNum = parseUE(br);
return (codeNum & 1) ? (codeNum + 1) / 2 : -(codeNum / 2);
}
+signed parseSEWithFallback(ABitReader *br, signed fallback) {
+ // NOTE: parseUE cannot normally return ~0 as the max supported value is 0xFFFE
+ unsigned codeNum = parseUEWithFallback(br, ~0U);
+ if (codeNum == ~0U) {
+ return fallback;
+ }
+ return (codeNum & 1) ? (codeNum + 1) / 2 : -(codeNum / 2);
+}
+
static void skipScalingList(ABitReader *br, size_t sizeOfScalingList) {
size_t lastScale = 8;
size_t nextScale = 8;
diff --git a/media/libstagefright/foundation/ABitReader.cpp b/media/libstagefright/foundation/ABitReader.cpp
index 1582b67..c5db9e6 100644
--- a/media/libstagefright/foundation/ABitReader.cpp
+++ b/media/libstagefright/foundation/ABitReader.cpp
@@ -24,14 +24,18 @@
: mData(data),
mSize(size),
mReservoir(0),
- mNumBitsLeft(0) {
+ mNumBitsLeft(0),
+ mOverRead(false) {
}
ABitReader::~ABitReader() {
}
-void ABitReader::fillReservoir() {
- CHECK_GT(mSize, 0u);
+bool ABitReader::fillReservoir() {
+ if (mSize == 0) {
+ mOverRead = true;
+ return false;
+ }
mReservoir = 0;
size_t i;
@@ -44,15 +48,32 @@
mNumBitsLeft = 8 * i;
mReservoir <<= 32 - mNumBitsLeft;
+ return true;
}
uint32_t ABitReader::getBits(size_t n) {
- CHECK_LE(n, 32u);
+ uint32_t ret;
+ CHECK(getBitsGraceful(n, &ret));
+ return ret;
+}
+
+uint32_t ABitReader::getBitsWithFallback(size_t n, uint32_t fallback) {
+ uint32_t ret = fallback;
+ (void)getBitsGraceful(n, &ret);
+ return ret;
+}
+
+bool ABitReader::getBitsGraceful(size_t n, uint32_t *out) {
+ if (n > 32) {
+ return false;
+ }
uint32_t result = 0;
while (n > 0) {
if (mNumBitsLeft == 0) {
- fillReservoir();
+ if (!fillReservoir()) {
+ return false;
+ }
}
size_t m = n;
@@ -67,21 +88,30 @@
n -= m;
}
- return result;
+ *out = result;
+ return true;
}
-void ABitReader::skipBits(size_t n) {
+bool ABitReader::skipBits(size_t n) {
+ uint32_t dummy;
while (n > 32) {
- getBits(32);
+ if (!getBitsGraceful(32, &dummy)) {
+ return false;
+ }
n -= 32;
}
if (n > 0) {
- getBits(n);
+ return getBitsGraceful(n, &dummy);
}
+ return true;
}
void ABitReader::putBits(uint32_t x, size_t n) {
+ if (mOverRead) {
+ return;
+ }
+
CHECK_LE(n, 32u);
while (mNumBitsLeft + n > 32) {
@@ -139,8 +169,11 @@
return (numBitsRemaining <= 0);
}
-void NALBitReader::fillReservoir() {
- CHECK_GT(mSize, 0u);
+bool NALBitReader::fillReservoir() {
+ if (mSize == 0) {
+ mOverRead = true;
+ return false;
+ }
mReservoir = 0;
size_t i = 0;
@@ -165,6 +198,7 @@
mNumBitsLeft = 8 * i;
mReservoir <<= 32 - mNumBitsLeft;
+ return true;
}
} // namespace android
diff --git a/media/libstagefright/include/HevcUtils.h b/media/libstagefright/include/HevcUtils.h
index 0d7bb2f..0f59631 100644
--- a/media/libstagefright/include/HevcUtils.h
+++ b/media/libstagefright/include/HevcUtils.h
@@ -56,10 +56,24 @@
kBitDepthLumaMinus8,
// uint8_t
kBitDepthChromaMinus8,
+ // uint8_t
+ kVideoFullRangeFlag,
+ // uint8_t
+ kColourPrimaries,
+ // uint8_t
+ kTransferCharacteristics,
+ // uint8_t
+ kMatrixCoeffs,
};
class HevcParameterSets {
public:
+ enum Info : uint32_t {
+ kInfoNone = 0,
+ kInfoIsHdr = 1 << 0,
+ kInfoHasColorDescription = 1 << 1,
+ };
+
HevcParameterSets();
status_t addNalUnit(const uint8_t* data, size_t size);
@@ -77,6 +91,8 @@
bool write(size_t index, uint8_t* dest, size_t size);
status_t makeHvcc(uint8_t *hvcc, size_t *hvccSize, size_t nalSizeLength);
+ Info getInfo() const { return mInfo; }
+
private:
status_t parseVps(const uint8_t* data, size_t size);
status_t parseSps(const uint8_t* data, size_t size);
@@ -84,6 +100,7 @@
KeyedVector<uint32_t, uint64_t> mParams;
Vector<sp<ABuffer>> mNalUnits;
+ Info mInfo;
DISALLOW_EVIL_CONSTRUCTORS(HevcParameterSets);
};
diff --git a/media/libstagefright/include/avc_utils.h b/media/libstagefright/include/avc_utils.h
index dafa07e..7465b35 100644
--- a/media/libstagefright/include/avc_utils.h
+++ b/media/libstagefright/include/avc_utils.h
@@ -47,8 +47,34 @@
int32_t *width, int32_t *height,
int32_t *sarWidth = NULL, int32_t *sarHeight = NULL);
+// Gets and returns an unsigned exp-golomb (ue) value from a bit reader |br|. Aborts if the value
+// is more than 64 bits long (>=0xFFFF (!)) or the bit reader overflows.
unsigned parseUE(ABitReader *br);
+// Gets and returns a signed exp-golomb (se) value from a bit reader |br|. Aborts if the value is
+// more than 64 bits long (>0x7FFF || <-0x7FFF (!)) or the bit reader overflows.
+signed parseSE(ABitReader *br);
+
+// Gets an unsigned exp-golomb (ue) value from a bit reader |br|, and returns it if it was
+// successful. Returns |fallback| if it was unsuccessful. Note: if the value was longer that 64
+// bits, it reads past the value and still returns |fallback|.
+unsigned parseUEWithFallback(ABitReader *br, unsigned fallback);
+
+// Gets a signed exp-golomb (se) value from a bit reader |br|, and returns it if it was successful.
+// Returns |fallback| if it was unsuccessful. Note: if the value was longer that 64 bits, it reads
+// past the value and still returns |fallback|.
+signed parseSEWithFallback(ABitReader *br, signed fallback);
+
+// Skips an unsigned exp-golomb (ue) value from bit reader |br|.
+inline void skipUE(ABitReader *br) {
+ (void)parseUEWithFallback(br, 0U);
+}
+
+// Skips a signed exp-golomb (se) value from bit reader |br|.
+inline void skipSE(ABitReader *br) {
+ (void)parseSEWithFallback(br, 0);
+}
+
status_t getNextNALUnit(
const uint8_t **_data, size_t *_size,
const uint8_t **nalStart, size_t *nalSize,
diff --git a/media/libstagefright/matroska/MatroskaExtractor.cpp b/media/libstagefright/matroska/MatroskaExtractor.cpp
index 434be86..383a0ad 100644
--- a/media/libstagefright/matroska/MatroskaExtractor.cpp
+++ b/media/libstagefright/matroska/MatroskaExtractor.cpp
@@ -24,6 +24,7 @@
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/AUtils.h>
#include <media/stagefright/foundation/ABuffer.h>
+#include <media/stagefright/foundation/ColorUtils.h>
#include <media/stagefright/foundation/hexdump.h>
#include <media/stagefright/DataSource.h>
#include <media/stagefright/MediaBuffer.h>
@@ -1058,6 +1059,109 @@
return OK;
}
+static inline bool isValidInt32ColourValue(long long value) {
+ return value != mkvparser::Colour::kValueNotPresent
+ && value >= INT32_MIN
+ && value <= INT32_MAX;
+}
+
+static inline bool isValidUint16ColourValue(long long value) {
+ return value != mkvparser::Colour::kValueNotPresent
+ && value >= 0
+ && value <= UINT16_MAX;
+}
+
+static inline bool isValidPrimary(const mkvparser::PrimaryChromaticity *primary) {
+ return primary != NULL && primary->x >= 0 && primary->x <= 1
+ && primary->y >= 0 && primary->y <= 1;
+}
+
+void MatroskaExtractor::getColorInformation(
+ const mkvparser::VideoTrack *vtrack, sp<MetaData> &meta) {
+ const mkvparser::Colour *color = vtrack->GetColour();
+ if (color == NULL) {
+ return;
+ }
+
+ // Color Aspects
+ {
+ int32_t primaries = 2; // ISO unspecified
+ int32_t transfer = 2; // ISO unspecified
+ int32_t coeffs = 2; // ISO unspecified
+ bool fullRange = false; // default
+ bool rangeSpecified = false;
+
+ if (isValidInt32ColourValue(color->primaries)) {
+ primaries = color->primaries;
+ }
+ if (isValidInt32ColourValue(color->transfer_characteristics)) {
+ transfer = color->transfer_characteristics;
+ }
+ if (isValidInt32ColourValue(color->matrix_coefficients)) {
+ coeffs = color->matrix_coefficients;
+ }
+ if (color->range != mkvparser::Colour::kValueNotPresent
+ && color->range != 0 /* MKV unspecified */) {
+ // We only support MKV broadcast range (== limited) and full range.
+ // We treat all other value as the default limited range.
+ fullRange = color->range == 2 /* MKV fullRange */;
+ rangeSpecified = true;
+ }
+
+ ColorAspects aspects;
+ ColorUtils::convertIsoColorAspectsToCodecAspects(
+ primaries, transfer, coeffs, fullRange, aspects);
+ meta->setInt32(kKeyColorPrimaries, aspects.mPrimaries);
+ meta->setInt32(kKeyTransferFunction, aspects.mTransfer);
+ meta->setInt32(kKeyColorMatrix, aspects.mMatrixCoeffs);
+ meta->setInt32(
+ kKeyColorRange, rangeSpecified ? aspects.mRange : ColorAspects::RangeUnspecified);
+ }
+
+ // HDR Static Info
+ {
+ HDRStaticInfo info, nullInfo; // nullInfo is a fully unspecified static info
+ memset(&info, 0, sizeof(info));
+ memset(&nullInfo, 0, sizeof(nullInfo));
+ if (isValidUint16ColourValue(color->max_cll)) {
+ info.sType1.mMaxContentLightLevel = color->max_cll;
+ }
+ if (isValidUint16ColourValue(color->max_fall)) {
+ info.sType1.mMaxFrameAverageLightLevel = color->max_fall;
+ }
+ const mkvparser::MasteringMetadata *mastering = color->mastering_metadata;
+ if (mastering != NULL) {
+ // Convert matroska values to HDRStaticInfo equivalent values for each fully specified
+ // group. See CTA-681.3 section 3.2.1 for more info.
+ if (mastering->luminance_max >= 0.5 && mastering->luminance_max < 65535.5) {
+ info.sType1.mMaxDisplayLuminance = (uint16_t)(mastering->luminance_max + 0.5);
+ }
+ if (mastering->luminance_min >= 0.00005 && mastering->luminance_min < 6.55355) {
+ info.sType1.mMinDisplayLuminance =
+ (uint16_t)(10000 * mastering->luminance_min + 0.5);
+ }
+ if (isValidPrimary(mastering->white_point)) {
+ info.sType1.mW.x = (uint16_t)(50000 * mastering->white_point->x + 0.5);
+ info.sType1.mW.y = (uint16_t)(50000 * mastering->white_point->y + 0.5);
+ }
+ if (isValidPrimary(mastering->r) && isValidPrimary(mastering->g)
+ && isValidPrimary(mastering->b)) {
+ info.sType1.mR.x = (uint16_t)(50000 * mastering->r->x + 0.5);
+ info.sType1.mR.y = (uint16_t)(50000 * mastering->r->y + 0.5);
+ info.sType1.mG.x = (uint16_t)(50000 * mastering->g->x + 0.5);
+ info.sType1.mG.y = (uint16_t)(50000 * mastering->g->y + 0.5);
+ info.sType1.mB.x = (uint16_t)(50000 * mastering->b->x + 0.5);
+ info.sType1.mB.y = (uint16_t)(50000 * mastering->b->y + 0.5);
+ }
+ }
+ // Only advertise static info if at least one of the groups have been specified.
+ if (memcmp(&info, &nullInfo, sizeof(info)) != 0) {
+ info.mID = HDRStaticInfo::kType1;
+ meta->setData(kKeyHdrStaticInfo, 'hdrS', &info, sizeof(info));
+ }
+ }
+}
+
void MatroskaExtractor::addTracks() {
const mkvparser::Tracks *tracks = mSegment->GetTracks();
@@ -1127,6 +1231,9 @@
meta->setInt32(kKeyWidth, vtrack->GetWidth());
meta->setInt32(kKeyHeight, vtrack->GetHeight());
+
+ getColorInformation(vtrack, meta);
+
break;
}
diff --git a/media/libstagefright/matroska/MatroskaExtractor.h b/media/libstagefright/matroska/MatroskaExtractor.h
index 9406829..665e68e 100644
--- a/media/libstagefright/matroska/MatroskaExtractor.h
+++ b/media/libstagefright/matroska/MatroskaExtractor.h
@@ -29,6 +29,7 @@
struct AMessage;
class String8;
+class MetaData;
struct DataSourceReader;
struct MatroskaSource;
@@ -80,7 +81,7 @@
status_t synthesizeAVCC(TrackInfo *trackInfo, size_t index);
void addTracks();
void findThumbnails();
-
+ void getColorInformation(const mkvparser::VideoTrack *vtrack, sp<MetaData> &meta);
bool isLiveStreaming() const;
MatroskaExtractor(const MatroskaExtractor &);
diff --git a/media/libstagefright/webm/WebmConstants.h b/media/libstagefright/webm/WebmConstants.h
index c53f458..cf6404f 100644
--- a/media/libstagefright/webm/WebmConstants.h
+++ b/media/libstagefright/webm/WebmConstants.h
@@ -98,6 +98,24 @@
kMkvDisplayHeight = 0x54BA,
kMkvDisplayUnit = 0x54B2,
kMkvAspectRatioType = 0x54B3,
+ kMkvColour = 0x55B0,
+ kMkvColourMatrixCoefficients = 0x55B1,
+ kMkvColourRange = 0x55B9,
+ kMkvColourTransferCharacteristics = 0x55BA,
+ kMkvColourPrimaries = 0x55BB,
+ kMkvColourMaxCll = 0x55BC,
+ kMkvColourMaxFall = 0x55BD,
+ kMkvMasteringMetadata = 0x55D0,
+ kMkvMasteringPrimaryRChromaticityX = 0x55D1,
+ kMkvMasteringPrimaryRChromaticityY = 0x55D2,
+ kMkvMasteringPrimaryGChromaticityX = 0x55D3,
+ kMkvMasteringPrimaryGChromaticityY = 0x55D4,
+ kMkvMasteringPrimaryBChromaticityX = 0x55D5,
+ kMkvMasteringPrimaryBChromaticityY = 0x55D6,
+ kMkvMasteringWhitePointChromaticityX = 0x55D7,
+ kMkvMasteringWhitePointChromaticityY = 0x55D8,
+ kMkvMasteringLuminanceMax = 0x55D9,
+ kMkvMasteringLuminanceMin = 0x55DA,
kMkvFrameRate = 0x2383E3,
kMkvAudio = 0xE1,
kMkvSamplingFrequency = 0xB5,
diff --git a/media/libstagefright/webm/WebmElement.cpp b/media/libstagefright/webm/WebmElement.cpp
index f454bf6..6a7da12 100644
--- a/media/libstagefright/webm/WebmElement.cpp
+++ b/media/libstagefright/webm/WebmElement.cpp
@@ -22,6 +22,8 @@
#include "WebmConstants.h"
#include <media/stagefright/foundation/ADebug.h>
+#include <media/stagefright/foundation/ColorUtils.h>
+#include <media/stagefright/MetaData.h>
#include <utils/Log.h>
#include <string.h>
@@ -341,6 +343,7 @@
const char *codec,
uint64_t width,
uint64_t height,
+ const sp<MetaData> &meta,
uint64_t uid,
bool lacing,
const char *lang) {
@@ -362,6 +365,97 @@
videoInfo.push_back(new WebmUnsigned(kMkvPixelWidth, width));
videoInfo.push_back(new WebmUnsigned(kMkvPixelHeight, height));
+ // Color aspects
+ {
+ List<sp<WebmElement> > colorInfo;
+
+ ColorAspects aspects;
+ aspects.mPrimaries = ColorAspects::PrimariesUnspecified;
+ aspects.mTransfer = ColorAspects::TransferUnspecified;
+ aspects.mMatrixCoeffs = ColorAspects::MatrixUnspecified;
+ aspects.mRange = ColorAspects::RangeUnspecified;
+ bool havePrimaries = meta->findInt32(kKeyColorPrimaries, (int32_t*)&aspects.mPrimaries);
+ bool haveTransfer = meta->findInt32(kKeyTransferFunction, (int32_t*)&aspects.mTransfer);
+ bool haveCoeffs = meta->findInt32(kKeyColorMatrix, (int32_t*)&aspects.mMatrixCoeffs);
+ bool haveRange = meta->findInt32(kKeyColorRange, (int32_t*)&aspects.mRange);
+
+ int32_t primaries, transfer, coeffs;
+ bool fullRange;
+ ColorUtils::convertCodecColorAspectsToIsoAspects(
+ aspects, &primaries, &transfer, &coeffs, &fullRange);
+ if (havePrimaries) {
+ colorInfo.push_back(new WebmUnsigned(kMkvColourPrimaries, primaries));
+ }
+ if (haveTransfer) {
+ colorInfo.push_back(new WebmUnsigned(kMkvColourTransferCharacteristics, transfer));
+ }
+ if (haveCoeffs) {
+ colorInfo.push_back(new WebmUnsigned(kMkvColourMatrixCoefficients, coeffs));
+ }
+ if (haveRange) {
+ colorInfo.push_back(new WebmUnsigned(kMkvColourRange, fullRange ? 2 : 1));
+ }
+
+ // Also add HDR static info, some of which goes to MasteringMetadata element
+
+ const HDRStaticInfo *info;
+ uint32_t type;
+ const void *data;
+ size_t size;
+ if (meta->findData(kKeyHdrStaticInfo, &type, &data, &size)
+ && type == 'hdrS' && size == sizeof(*info)) {
+ info = (const HDRStaticInfo*)data;
+ if (info->mID == HDRStaticInfo::kType1) {
+ List<sp<WebmElement> > masteringInfo;
+
+ // convert HDRStaticInfo values to matroska equivalent values for each non-0 group
+ if (info->sType1.mMaxFrameAverageLightLevel) {
+ colorInfo.push_back(new WebmUnsigned(
+ kMkvColourMaxFall, info->sType1.mMaxFrameAverageLightLevel));
+ }
+ if (info->sType1.mMaxContentLightLevel) {
+ colorInfo.push_back(new WebmUnsigned(
+ kMkvColourMaxCll, info->sType1.mMaxContentLightLevel));
+ }
+ if (info->sType1.mMinDisplayLuminance) {
+ masteringInfo.push_back(new WebmFloat(
+ kMkvMasteringLuminanceMin, info->sType1.mMinDisplayLuminance * 0.0001));
+ }
+ if (info->sType1.mMaxDisplayLuminance) {
+ masteringInfo.push_back(new WebmFloat(
+ kMkvMasteringLuminanceMax, (float)info->sType1.mMaxDisplayLuminance));
+ }
+ if (info->sType1.mW.x || info->sType1.mW.y) {
+ masteringInfo.push_back(new WebmFloat(
+ kMkvMasteringWhitePointChromaticityX, info->sType1.mW.x * 0.00002));
+ masteringInfo.push_back(new WebmFloat(
+ kMkvMasteringWhitePointChromaticityY, info->sType1.mW.y * 0.00002));
+ }
+ if (info->sType1.mR.x || info->sType1.mR.x || info->sType1.mG.x
+ || info->sType1.mG.y || info->sType1.mB.x || info->sType1.mB.y) {
+ masteringInfo.push_back(new WebmFloat(
+ kMkvMasteringPrimaryRChromaticityX, info->sType1.mR.x * 0.00002));
+ masteringInfo.push_back(new WebmFloat(
+ kMkvMasteringPrimaryRChromaticityY, info->sType1.mR.y * 0.00002));
+ masteringInfo.push_back(new WebmFloat(
+ kMkvMasteringPrimaryGChromaticityX, info->sType1.mG.x * 0.00002));
+ masteringInfo.push_back(new WebmFloat(
+ kMkvMasteringPrimaryGChromaticityY, info->sType1.mG.y * 0.00002));
+ masteringInfo.push_back(new WebmFloat(
+ kMkvMasteringPrimaryBChromaticityX, info->sType1.mB.x * 0.00002));
+ masteringInfo.push_back(new WebmFloat(
+ kMkvMasteringPrimaryBChromaticityY, info->sType1.mB.y * 0.00002));
+ }
+ if (masteringInfo.size()) {
+ colorInfo.push_back(new WebmMaster(kMkvMasteringMetadata, masteringInfo));
+ }
+ }
+ }
+ if (colorInfo.size()) {
+ videoInfo.push_back(new WebmMaster(kMkvColour, colorInfo));
+ }
+ }
+
trackEntryFields.push_back(new WebmMaster(kMkvVideo, videoInfo));
return new WebmMaster(kMkvTrackEntry, trackEntryFields);
}
diff --git a/media/libstagefright/webm/WebmElement.h b/media/libstagefright/webm/WebmElement.h
index 456c3c7..4e90793 100644
--- a/media/libstagefright/webm/WebmElement.h
+++ b/media/libstagefright/webm/WebmElement.h
@@ -24,6 +24,8 @@
namespace android {
+class MetaData;
+
struct WebmElement : public LightRefBase<WebmElement> {
const uint64_t mId, mSize;
@@ -60,6 +62,7 @@
const char *codec,
uint64_t width,
uint64_t height,
+ const sp<MetaData> &md,
uint64_t uid = 0,
bool lacing = false,
const char *lang = "und");
diff --git a/media/libstagefright/webm/WebmWriter.cpp b/media/libstagefright/webm/WebmWriter.cpp
index 511260a..a1ac253 100644
--- a/media/libstagefright/webm/WebmWriter.cpp
+++ b/media/libstagefright/webm/WebmWriter.cpp
@@ -101,7 +101,7 @@
} else {
CHECK(!"Unsupported codec");
}
- return WebmElement::VideoTrackEntry(codec, width, height);
+ return WebmElement::VideoTrackEntry(codec, width, height, md);
}
// static
diff --git a/services/audioflinger/PatchPanel.cpp b/services/audioflinger/PatchPanel.cpp
index 89de68e..f8671b5 100644
--- a/services/audioflinger/PatchPanel.cpp
+++ b/services/audioflinger/PatchPanel.cpp
@@ -168,6 +168,12 @@
ALOGV("createAudioPatch() removing patch handle %d", *handle);
halHandle = mPatches[index]->mHalHandle;
Patch *removedPatch = mPatches[index];
+ if ((removedPatch->mRecordPatchHandle
+ != AUDIO_PATCH_HANDLE_NONE) ||
+ (removedPatch->mPlaybackPatchHandle !=
+ AUDIO_PATCH_HANDLE_NONE)) {
+ clearPatchConnections(removedPatch);
+ }
mPatches.removeAt(index);
delete removedPatch;
break;
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 9fe61702..3759424 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -1576,7 +1576,7 @@
mActiveTracksGeneration(0),
// mStreamTypes[] initialized in constructor body
mOutput(output),
- mLastWriteTime(0), mNumWrites(0), mNumDelayedWrites(0), mInWrite(false),
+ mLastWriteTime(-1), mNumWrites(0), mNumDelayedWrites(0), mInWrite(false),
mMixerStatus(MIXER_IDLE),
mMixerStatusIgnoringFastTracks(MIXER_IDLE),
mStandbyDelayNs(AudioFlinger::mStandbyTimeInNsecs),
@@ -2537,8 +2537,6 @@
// shared by MIXER and DIRECT, overridden by DUPLICATING
ssize_t AudioFlinger::PlaybackThread::threadLoop_write()
{
- // FIXME rewrite to reduce number of system calls
- mLastWriteTime = systemTime();
mInWrite = true;
ssize_t bytesWritten;
const size_t offset = mCurrentWriteLength - mBytesRemaining;
@@ -2834,6 +2832,8 @@
Vector< sp<Track> > tracksToRemove;
mStandbyTimeNs = systemTime();
+ nsecs_t lastWriteFinished = -1; // time last server write completed
+ int64_t lastFramesWritten = -1; // track changes in timestamp server frames written
// MIXER
nsecs_t lastWarning = 0;
@@ -2884,10 +2884,11 @@
// Gather the framesReleased counters for all active tracks,
// and associate with the sink frames written out. We need
// this to convert the sink timestamp to the track timestamp.
+ bool kernelLocationUpdate = false;
if (mNormalSink != 0) {
// Note: The DuplicatingThread may not have a mNormalSink.
// We always fetch the timestamp here because often the downstream
- // sink will block whie writing.
+ // sink will block while writing.
ExtendedTimestamp timestamp; // use private copy to fetch
(void) mNormalSink->getTimestamp(timestamp);
@@ -2904,6 +2905,10 @@
mTimestamp.mPosition[ExtendedTimestamp::LOCATION_SERVER];
mTimestamp.mTimeNs[ExtendedTimestamp::LOCATION_SERVER_LASTKERNELOK] =
mTimestamp.mTimeNs[ExtendedTimestamp::LOCATION_SERVER];
+ }
+
+ if (timestamp.mTimeNs[ExtendedTimestamp::LOCATION_KERNEL] >= 0) {
+ kernelLocationUpdate = true;
} else {
ALOGV("getTimestamp error - no valid kernel position");
}
@@ -2917,16 +2922,33 @@
// mFramesWritten for non-offloaded tracks are contiguous
// even after standby() is called. This is useful for the track frame
// to sink frame mapping.
- mTimestamp.mPosition[ExtendedTimestamp::LOCATION_SERVER] = mFramesWritten;
- mTimestamp.mTimeNs[ExtendedTimestamp::LOCATION_SERVER] = systemTime();
- const size_t size = mActiveTracks.size();
- for (size_t i = 0; i < size; ++i) {
- sp<Track> t = mActiveTracks[i].promote();
- if (t != 0 && !t->isFastTrack()) {
- t->updateTrackFrameInfo(
- t->mAudioTrackServerProxy->framesReleased(),
- mFramesWritten,
- mTimestamp);
+ bool serverLocationUpdate = false;
+ if (mFramesWritten != lastFramesWritten) {
+ serverLocationUpdate = true;
+ lastFramesWritten = mFramesWritten;
+ }
+ // Only update timestamps if there is a meaningful change.
+ // Either the kernel timestamp must be valid or we have written something.
+ if (kernelLocationUpdate || serverLocationUpdate) {
+ if (serverLocationUpdate) {
+ // use the time before we called the HAL write - it is a bit more accurate
+ // to when the server last read data than the current time here.
+ //
+ // If we haven't written anything, mLastWriteTime will be -1
+ // and we use systemTime().
+ mTimestamp.mPosition[ExtendedTimestamp::LOCATION_SERVER] = mFramesWritten;
+ mTimestamp.mTimeNs[ExtendedTimestamp::LOCATION_SERVER] = mLastWriteTime == -1
+ ? systemTime() : mLastWriteTime;
+ }
+ const size_t size = mActiveTracks.size();
+ for (size_t i = 0; i < size; ++i) {
+ sp<Track> t = mActiveTracks[i].promote();
+ if (t != 0 && !t->isFastTrack()) {
+ t->updateTrackFrameInfo(
+ t->mAudioTrackServerProxy->framesReleased(),
+ mFramesWritten,
+ mTimestamp);
+ }
}
}
@@ -3104,8 +3126,17 @@
// mSleepTimeUs == 0 means we must write to audio hardware
if (mSleepTimeUs == 0) {
ssize_t ret = 0;
+ // We save lastWriteFinished here, as previousLastWriteFinished,
+ // for throttling. On thread start, previousLastWriteFinished will be
+ // set to -1, which properly results in no throttling after the first write.
+ nsecs_t previousLastWriteFinished = lastWriteFinished;
+ nsecs_t delta = 0;
if (mBytesRemaining) {
+ // FIXME rewrite to reduce number of system calls
+ mLastWriteTime = systemTime(); // also used for dumpsys
ret = threadLoop_write();
+ lastWriteFinished = systemTime();
+ delta = lastWriteFinished - mLastWriteTime;
if (ret < 0) {
mBytesRemaining = 0;
} else {
@@ -3119,15 +3150,13 @@
}
if (mType == MIXER && !mStandby) {
// write blocked detection
- nsecs_t now = systemTime();
- nsecs_t delta = now - mLastWriteTime;
if (delta > maxPeriod) {
mNumDelayedWrites++;
- if ((now - lastWarning) > kWarningThrottleNs) {
+ if ((lastWriteFinished - lastWarning) > kWarningThrottleNs) {
ATRACE_NAME("underrun");
ALOGW("write blocked for %llu msecs, %d delayed writes, thread %p",
(unsigned long long) ns2ms(delta), mNumDelayedWrites, this);
- lastWarning = now;
+ lastWarning = lastWriteFinished;
}
}
@@ -3147,7 +3176,9 @@
// (2) minimum buffer sized tracks (even if the track is full,
// the app won't fill fast enough to handle the sudden draw).
- const int32_t deltaMs = delta / 1000000;
+ // it's OK if deltaMs is an overestimate.
+ const int32_t deltaMs =
+ (lastWriteFinished - previousLastWriteFinished) / 1000000;
const int32_t throttleMs = mHalfBufferMs - deltaMs;
if ((signed)mHalfBufferMs >= throttleMs && throttleMs > 0) {
usleep(throttleMs * 1000);
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/example/Android.mk b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Android.mk
similarity index 100%
rename from services/audiopolicy/engineconfigurable/parameter-framework/example/Android.mk
rename to services/audiopolicy/engineconfigurable/parameter-framework/examples/Android.mk
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/example/ParameterFrameworkConfigurationPolicy.xml.in b/services/audiopolicy/engineconfigurable/parameter-framework/examples/ParameterFrameworkConfigurationPolicy.xml.in
similarity index 100%
rename from services/audiopolicy/engineconfigurable/parameter-framework/example/ParameterFrameworkConfigurationPolicy.xml.in
rename to services/audiopolicy/engineconfigurable/parameter-framework/examples/ParameterFrameworkConfigurationPolicy.xml.in
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/example/README.md b/services/audiopolicy/engineconfigurable/parameter-framework/examples/README.md
similarity index 100%
rename from services/audiopolicy/engineconfigurable/parameter-framework/example/README.md
rename to services/audiopolicy/engineconfigurable/parameter-framework/examples/README.md
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/PolicyConfigurableDomains.xml b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/PolicyConfigurableDomains.xml
similarity index 97%
rename from services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/PolicyConfigurableDomains.xml
rename to services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/PolicyConfigurableDomains.xml
index bc7ad6b..df65aad 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/PolicyConfigurableDomains.xml
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/PolicyConfigurableDomains.xml
@@ -15,6 +15,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/bluetooth_sco_headset"/>
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/bluetooth_sco_carkit"/>
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/telephony_tx"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/ip"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/bus"/>
</ConfigurableElements>
<Settings>
<Configuration Name="Calibration">
@@ -39,6 +41,12 @@
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/telephony_tx">
<BitParameter Name="telephony_tx">0</BitParameter>
</ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/ip">
+ <BitParameter Name="ip">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/bus">
+ <BitParameter Name="bus">0</BitParameter>
+ </ConfigurableElement>
</Configuration>
</Settings>
</ConfigurableDomain>
@@ -856,6 +864,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/spdif"/>
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/fm"/>
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/speaker_safe"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/ip"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/bus"/>
</ConfigurableElements>
<Settings>
<Configuration Name="Calibration">
@@ -877,6 +887,12 @@
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/speaker_safe">
<BitParameter Name="speaker_safe">0</BitParameter>
</ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/ip">
+ <BitParameter Name="ip">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/bus">
+ <BitParameter Name="bus">0</BitParameter>
+ </ConfigurableElement>
</Configuration>
</Settings>
</ConfigurableDomain>
@@ -1941,6 +1957,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/speaker_safe"/>
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/aux_line"/>
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/hdmi"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/ip"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/bus"/>
</ConfigurableElements>
<Settings>
<Configuration Name="Calibration">
@@ -1965,6 +1983,12 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/ip">
+ <BitParameter Name="ip">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/bus">
+ <BitParameter Name="bus">0</BitParameter>
+ </ConfigurableElement>
</Configuration>
</Settings>
</ConfigurableDomain>
@@ -2920,6 +2944,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/spdif"/>
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/fm"/>
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/telephony_tx"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/ip"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/bus"/>
</ConfigurableElements>
<Settings>
<Configuration Name="Calibration">
@@ -2941,6 +2967,12 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/telephony_tx">
<BitParameter Name="telephony_tx">0</BitParameter>
</ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/ip">
+ <BitParameter Name="ip">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/bus">
+ <BitParameter Name="bus">0</BitParameter>
+ </ConfigurableElement>
</Configuration>
</Settings>
</ConfigurableDomain>
@@ -3922,6 +3954,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/fm"/>
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/speaker_safe"/>
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/bluetooth_sco_carkit"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/ip"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/bus"/>
</ConfigurableElements>
<Settings>
<Configuration Name="Calibration">
@@ -3934,6 +3968,12 @@
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/bluetooth_sco_carkit">
<BitParameter Name="bluetooth_sco_carkit">0</BitParameter>
</ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/ip">
+ <BitParameter Name="ip">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/bus">
+ <BitParameter Name="bus">0</BitParameter>
+ </ConfigurableElement>
</Configuration>
</Settings>
</ConfigurableDomain>
@@ -5210,6 +5250,9 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/spdif"/>
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/aux_line"/>
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/speaker_safe"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/ip"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/bus"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/fm"/>
</ConfigurableElements>
<Settings>
<Configuration Name="Calibration">
@@ -5225,6 +5268,15 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/speaker_safe">
<BitParameter Name="speaker_safe">0</BitParameter>
</ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/ip">
+ <BitParameter Name="ip">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/bus">
+ <BitParameter Name="bus">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/fm">
+ <BitParameter Name="fm">0</BitParameter>
+ </ConfigurableElement>
</Configuration>
</Settings>
</ConfigurableDomain>
@@ -5356,6 +5408,9 @@
<SelectionCriterionRule SelectionCriterion="AvailableOutputDevices" MatchesWhen="Includes" Value="AnlgDockHeadset"/>
</CompoundRule>
</Configuration>
+ <Configuration Name="NoDevice">
+ <CompoundRule Type="All"/>
+ </Configuration>
</Configurations>
<ConfigurableElements>
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/remote_submix"/>
@@ -5375,7 +5430,6 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/usb_device"/>
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/telephony_tx"/>
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/line"/>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/fm"/>
</ConfigurableElements>
<Settings>
<Configuration Name="RemoteSubmix">
@@ -5430,9 +5484,6 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/fm">
- <BitParameter Name="fm">0</BitParameter>
- </ConfigurableElement>
</Configuration>
<Configuration Name="BluetoothA2dp">
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/remote_submix">
@@ -5486,9 +5537,6 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/fm">
- <BitParameter Name="fm">0</BitParameter>
- </ConfigurableElement>
</Configuration>
<Configuration Name="BluetoothA2dpHeadphones">
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/remote_submix">
@@ -5542,9 +5590,6 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/fm">
- <BitParameter Name="fm">0</BitParameter>
- </ConfigurableElement>
</Configuration>
<Configuration Name="BluetoothA2dpSpeaker">
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/remote_submix">
@@ -5598,9 +5643,6 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/fm">
- <BitParameter Name="fm">0</BitParameter>
- </ConfigurableElement>
</Configuration>
<Configuration Name="WiredHeadphone">
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/remote_submix">
@@ -5654,9 +5696,6 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/fm">
- <BitParameter Name="fm">0</BitParameter>
- </ConfigurableElement>
</Configuration>
<Configuration Name="Line">
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/remote_submix">
@@ -5710,9 +5749,6 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/line">
<BitParameter Name="line">1</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/fm">
- <BitParameter Name="fm">0</BitParameter>
- </ConfigurableElement>
</Configuration>
<Configuration Name="WiredHeadset">
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/remote_submix">
@@ -5766,9 +5802,6 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/fm">
- <BitParameter Name="fm">0</BitParameter>
- </ConfigurableElement>
</Configuration>
<Configuration Name="UsbAccessory">
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/remote_submix">
@@ -5822,9 +5855,6 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/fm">
- <BitParameter Name="fm">0</BitParameter>
- </ConfigurableElement>
</Configuration>
<Configuration Name="UsbDevice">
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/remote_submix">
@@ -5878,9 +5908,6 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/fm">
- <BitParameter Name="fm">0</BitParameter>
- </ConfigurableElement>
</Configuration>
<Configuration Name="DgtlDockHeadset">
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/remote_submix">
@@ -5934,9 +5961,6 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/fm">
- <BitParameter Name="fm">0</BitParameter>
- </ConfigurableElement>
</Configuration>
<Configuration Name="Hdmi">
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/remote_submix">
@@ -5990,9 +6014,6 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/fm">
- <BitParameter Name="fm">0</BitParameter>
- </ConfigurableElement>
</Configuration>
<Configuration Name="AnlgDockHeadset">
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/remote_submix">
@@ -6046,8 +6067,58 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/fm">
- <BitParameter Name="fm">0</BitParameter>
+ </Configuration>
+ <Configuration Name="NoDevice">
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/remote_submix">
+ <BitParameter Name="remote_submix">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/earpiece">
+ <BitParameter Name="earpiece">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/wired_headset">
+ <BitParameter Name="wired_headset">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/wired_headphone">
+ <BitParameter Name="wired_headphone">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/bluetooth_sco">
+ <BitParameter Name="bluetooth_sco">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/bluetooth_sco_headset">
+ <BitParameter Name="bluetooth_sco_headset">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/bluetooth_sco_carkit">
+ <BitParameter Name="bluetooth_sco_carkit">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/bluetooth_a2dp">
+ <BitParameter Name="bluetooth_a2dp">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/bluetooth_a2dp_headphones">
+ <BitParameter Name="bluetooth_a2dp_headphones">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/bluetooth_a2dp_speaker">
+ <BitParameter Name="bluetooth_a2dp_speaker">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/hdmi">
+ <BitParameter Name="hdmi">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/angl_dock_headset">
+ <BitParameter Name="angl_dock_headset">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/dgtl_dock_headset">
+ <BitParameter Name="dgtl_dock_headset">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/usb_accessory">
+ <BitParameter Name="usb_accessory">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/usb_device">
+ <BitParameter Name="usb_device">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/telephony_tx">
+ <BitParameter Name="telephony_tx">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/line">
+ <BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
</Configuration>
</Settings>
@@ -6081,6 +6152,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/transmitted_through_speaker/selected_output_devices/mask/usb_device"/>
<ConfigurableElement Path="/Policy/policy/strategies/transmitted_through_speaker/selected_output_devices/mask/telephony_tx"/>
<ConfigurableElement Path="/Policy/policy/strategies/transmitted_through_speaker/selected_output_devices/mask/line"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/transmitted_through_speaker/selected_output_devices/mask/ip"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/transmitted_through_speaker/selected_output_devices/mask/bus"/>
</ConfigurableElements>
<Settings>
<Configuration Name="Calibration">
@@ -6150,6 +6223,12 @@
<ConfigurableElement Path="/Policy/policy/strategies/transmitted_through_speaker/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/transmitted_through_speaker/selected_output_devices/mask/ip">
+ <BitParameter Name="ip">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/transmitted_through_speaker/selected_output_devices/mask/bus">
+ <BitParameter Name="bus">0</BitParameter>
+ </ConfigurableElement>
</Configuration>
</Settings>
</ConfigurableDomain>
@@ -6193,6 +6272,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/fm"/>
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/speaker_safe"/>
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/telephony_tx"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/ip"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/bus"/>
</ConfigurableElements>
<Settings>
<Configuration Name="Calibration">
@@ -6214,6 +6295,12 @@
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/telephony_tx">
<BitParameter Name="telephony_tx">0</BitParameter>
</ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/ip">
+ <BitParameter Name="ip">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/bus">
+ <BitParameter Name="bus">0</BitParameter>
+ </ConfigurableElement>
</Configuration>
</Settings>
</ConfigurableDomain>
@@ -7453,6 +7540,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/bluetooth_sco_headset"/>
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/bluetooth_sco_carkit"/>
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/telephony_tx"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/ip"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/bus"/>
</ConfigurableElements>
<Settings>
<Configuration Name="Calibration">
@@ -7486,6 +7575,12 @@
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/telephony_tx">
<BitParameter Name="telephony_tx">0</BitParameter>
</ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/ip">
+ <BitParameter Name="ip">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/bus">
+ <BitParameter Name="bus">0</BitParameter>
+ </ConfigurableElement>
</Configuration>
</Settings>
</ConfigurableDomain>
@@ -8378,7 +8473,6 @@
</Configuration>
</Configurations>
<ConfigurableElements>
- <ConfigurableElement Path="/Policy/policy/input_sources/default/applicable_input_device/mask/in"/>
<ConfigurableElement Path="/Policy/policy/input_sources/default/applicable_input_device/mask/communication"/>
<ConfigurableElement Path="/Policy/policy/input_sources/default/applicable_input_device/mask/ambient"/>
<ConfigurableElement Path="/Policy/policy/input_sources/default/applicable_input_device/mask/hdmi"/>
@@ -8393,7 +8487,8 @@
<ConfigurableElement Path="/Policy/policy/input_sources/default/applicable_input_device/mask/line"/>
<ConfigurableElement Path="/Policy/policy/input_sources/default/applicable_input_device/mask/spdif"/>
<ConfigurableElement Path="/Policy/policy/input_sources/default/applicable_input_device/mask/loopback"/>
- <ConfigurableElement Path="/Policy/policy/input_sources/mic/applicable_input_device/mask/in"/>
+ <ConfigurableElement Path="/Policy/policy/input_sources/default/applicable_input_device/mask/ip"/>
+ <ConfigurableElement Path="/Policy/policy/input_sources/default/applicable_input_device/mask/bus"/>
<ConfigurableElement Path="/Policy/policy/input_sources/mic/applicable_input_device/mask/communication"/>
<ConfigurableElement Path="/Policy/policy/input_sources/mic/applicable_input_device/mask/ambient"/>
<ConfigurableElement Path="/Policy/policy/input_sources/mic/applicable_input_device/mask/hdmi"/>
@@ -8408,7 +8503,8 @@
<ConfigurableElement Path="/Policy/policy/input_sources/mic/applicable_input_device/mask/line"/>
<ConfigurableElement Path="/Policy/policy/input_sources/mic/applicable_input_device/mask/spdif"/>
<ConfigurableElement Path="/Policy/policy/input_sources/mic/applicable_input_device/mask/loopback"/>
- <ConfigurableElement Path="/Policy/policy/input_sources/voice_downlink/applicable_input_device/mask/in"/>
+ <ConfigurableElement Path="/Policy/policy/input_sources/mic/applicable_input_device/mask/ip"/>
+ <ConfigurableElement Path="/Policy/policy/input_sources/mic/applicable_input_device/mask/bus"/>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_downlink/applicable_input_device/mask/communication"/>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_downlink/applicable_input_device/mask/ambient"/>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_downlink/applicable_input_device/mask/builtin_mic"/>
@@ -8427,7 +8523,8 @@
<ConfigurableElement Path="/Policy/policy/input_sources/voice_downlink/applicable_input_device/mask/spdif"/>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_downlink/applicable_input_device/mask/bluetooth_a2dp"/>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_downlink/applicable_input_device/mask/loopback"/>
- <ConfigurableElement Path="/Policy/policy/input_sources/voice_call/applicable_input_device/mask/in"/>
+ <ConfigurableElement Path="/Policy/policy/input_sources/voice_downlink/applicable_input_device/mask/ip"/>
+ <ConfigurableElement Path="/Policy/policy/input_sources/voice_downlink/applicable_input_device/mask/bus"/>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_call/applicable_input_device/mask/communication"/>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_call/applicable_input_device/mask/ambient"/>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_call/applicable_input_device/mask/builtin_mic"/>
@@ -8446,7 +8543,8 @@
<ConfigurableElement Path="/Policy/policy/input_sources/voice_call/applicable_input_device/mask/spdif"/>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_call/applicable_input_device/mask/bluetooth_a2dp"/>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_call/applicable_input_device/mask/loopback"/>
- <ConfigurableElement Path="/Policy/policy/input_sources/voice_uplink/applicable_input_device/mask/in"/>
+ <ConfigurableElement Path="/Policy/policy/input_sources/voice_call/applicable_input_device/mask/ip"/>
+ <ConfigurableElement Path="/Policy/policy/input_sources/voice_call/applicable_input_device/mask/bus"/>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_uplink/applicable_input_device/mask/communication"/>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_uplink/applicable_input_device/mask/ambient"/>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_uplink/applicable_input_device/mask/builtin_mic"/>
@@ -8465,7 +8563,8 @@
<ConfigurableElement Path="/Policy/policy/input_sources/voice_uplink/applicable_input_device/mask/spdif"/>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_uplink/applicable_input_device/mask/bluetooth_a2dp"/>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_uplink/applicable_input_device/mask/loopback"/>
- <ConfigurableElement Path="/Policy/policy/input_sources/camcorder/applicable_input_device/mask/in"/>
+ <ConfigurableElement Path="/Policy/policy/input_sources/voice_uplink/applicable_input_device/mask/ip"/>
+ <ConfigurableElement Path="/Policy/policy/input_sources/voice_uplink/applicable_input_device/mask/bus"/>
<ConfigurableElement Path="/Policy/policy/input_sources/camcorder/applicable_input_device/mask/communication"/>
<ConfigurableElement Path="/Policy/policy/input_sources/camcorder/applicable_input_device/mask/ambient"/>
<ConfigurableElement Path="/Policy/policy/input_sources/camcorder/applicable_input_device/mask/bluetooth_sco_headset"/>
@@ -8483,7 +8582,8 @@
<ConfigurableElement Path="/Policy/policy/input_sources/camcorder/applicable_input_device/mask/spdif"/>
<ConfigurableElement Path="/Policy/policy/input_sources/camcorder/applicable_input_device/mask/bluetooth_a2dp"/>
<ConfigurableElement Path="/Policy/policy/input_sources/camcorder/applicable_input_device/mask/loopback"/>
- <ConfigurableElement Path="/Policy/policy/input_sources/voice_recognition/applicable_input_device/mask/in"/>
+ <ConfigurableElement Path="/Policy/policy/input_sources/camcorder/applicable_input_device/mask/ip"/>
+ <ConfigurableElement Path="/Policy/policy/input_sources/camcorder/applicable_input_device/mask/bus"/>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_recognition/applicable_input_device/mask/communication"/>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_recognition/applicable_input_device/mask/ambient"/>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_recognition/applicable_input_device/mask/hdmi"/>
@@ -8499,7 +8599,8 @@
<ConfigurableElement Path="/Policy/policy/input_sources/voice_recognition/applicable_input_device/mask/spdif"/>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_recognition/applicable_input_device/mask/bluetooth_a2dp"/>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_recognition/applicable_input_device/mask/loopback"/>
- <ConfigurableElement Path="/Policy/policy/input_sources/voice_communication/applicable_input_device/mask/in"/>
+ <ConfigurableElement Path="/Policy/policy/input_sources/voice_recognition/applicable_input_device/mask/ip"/>
+ <ConfigurableElement Path="/Policy/policy/input_sources/voice_recognition/applicable_input_device/mask/bus"/>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_communication/applicable_input_device/mask/communication"/>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_communication/applicable_input_device/mask/ambient"/>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_communication/applicable_input_device/mask/hdmi"/>
@@ -8514,7 +8615,8 @@
<ConfigurableElement Path="/Policy/policy/input_sources/voice_communication/applicable_input_device/mask/spdif"/>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_communication/applicable_input_device/mask/bluetooth_a2dp"/>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_communication/applicable_input_device/mask/loopback"/>
- <ConfigurableElement Path="/Policy/policy/input_sources/remote_submix/applicable_input_device/mask/in"/>
+ <ConfigurableElement Path="/Policy/policy/input_sources/voice_communication/applicable_input_device/mask/ip"/>
+ <ConfigurableElement Path="/Policy/policy/input_sources/voice_communication/applicable_input_device/mask/bus"/>
<ConfigurableElement Path="/Policy/policy/input_sources/remote_submix/applicable_input_device/mask/communication"/>
<ConfigurableElement Path="/Policy/policy/input_sources/remote_submix/applicable_input_device/mask/ambient"/>
<ConfigurableElement Path="/Policy/policy/input_sources/remote_submix/applicable_input_device/mask/builtin_mic"/>
@@ -8533,7 +8635,8 @@
<ConfigurableElement Path="/Policy/policy/input_sources/remote_submix/applicable_input_device/mask/spdif"/>
<ConfigurableElement Path="/Policy/policy/input_sources/remote_submix/applicable_input_device/mask/bluetooth_a2dp"/>
<ConfigurableElement Path="/Policy/policy/input_sources/remote_submix/applicable_input_device/mask/loopback"/>
- <ConfigurableElement Path="/Policy/policy/input_sources/hotword/applicable_input_device/mask/in"/>
+ <ConfigurableElement Path="/Policy/policy/input_sources/remote_submix/applicable_input_device/mask/ip"/>
+ <ConfigurableElement Path="/Policy/policy/input_sources/remote_submix/applicable_input_device/mask/bus"/>
<ConfigurableElement Path="/Policy/policy/input_sources/hotword/applicable_input_device/mask/communication"/>
<ConfigurableElement Path="/Policy/policy/input_sources/hotword/applicable_input_device/mask/ambient"/>
<ConfigurableElement Path="/Policy/policy/input_sources/hotword/applicable_input_device/mask/hdmi"/>
@@ -8549,7 +8652,8 @@
<ConfigurableElement Path="/Policy/policy/input_sources/hotword/applicable_input_device/mask/spdif"/>
<ConfigurableElement Path="/Policy/policy/input_sources/hotword/applicable_input_device/mask/bluetooth_a2dp"/>
<ConfigurableElement Path="/Policy/policy/input_sources/hotword/applicable_input_device/mask/loopback"/>
- <ConfigurableElement Path="/Policy/policy/input_sources/unprocessed/applicable_input_device/mask/in"/>
+ <ConfigurableElement Path="/Policy/policy/input_sources/hotword/applicable_input_device/mask/ip"/>
+ <ConfigurableElement Path="/Policy/policy/input_sources/hotword/applicable_input_device/mask/bus"/>
<ConfigurableElement Path="/Policy/policy/input_sources/unprocessed/applicable_input_device/mask/communication"/>
<ConfigurableElement Path="/Policy/policy/input_sources/unprocessed/applicable_input_device/mask/ambient"/>
<ConfigurableElement Path="/Policy/policy/input_sources/unprocessed/applicable_input_device/mask/hdmi"/>
@@ -8565,7 +8669,8 @@
<ConfigurableElement Path="/Policy/policy/input_sources/unprocessed/applicable_input_device/mask/spdif"/>
<ConfigurableElement Path="/Policy/policy/input_sources/unprocessed/applicable_input_device/mask/bluetooth_a2dp"/>
<ConfigurableElement Path="/Policy/policy/input_sources/unprocessed/applicable_input_device/mask/loopback"/>
- <ConfigurableElement Path="/Policy/policy/input_sources/fm_tuner/applicable_input_device/mask/in"/>
+ <ConfigurableElement Path="/Policy/policy/input_sources/unprocessed/applicable_input_device/mask/ip"/>
+ <ConfigurableElement Path="/Policy/policy/input_sources/unprocessed/applicable_input_device/mask/bus"/>
<ConfigurableElement Path="/Policy/policy/input_sources/fm_tuner/applicable_input_device/mask/communication"/>
<ConfigurableElement Path="/Policy/policy/input_sources/fm_tuner/applicable_input_device/mask/ambient"/>
<ConfigurableElement Path="/Policy/policy/input_sources/fm_tuner/applicable_input_device/mask/bluetooth_sco_headset"/>
@@ -8584,12 +8689,11 @@
<ConfigurableElement Path="/Policy/policy/input_sources/fm_tuner/applicable_input_device/mask/spdif"/>
<ConfigurableElement Path="/Policy/policy/input_sources/fm_tuner/applicable_input_device/mask/bluetooth_a2dp"/>
<ConfigurableElement Path="/Policy/policy/input_sources/fm_tuner/applicable_input_device/mask/loopback"/>
+ <ConfigurableElement Path="/Policy/policy/input_sources/fm_tuner/applicable_input_device/mask/ip"/>
+ <ConfigurableElement Path="/Policy/policy/input_sources/fm_tuner/applicable_input_device/mask/bus"/>
</ConfigurableElements>
<Settings>
<Configuration Name="Calibration">
- <ConfigurableElement Path="/Policy/policy/input_sources/default/applicable_input_device/mask/in">
- <BitParameter Name="in">1</BitParameter>
- </ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/input_sources/default/applicable_input_device/mask/communication">
<BitParameter Name="communication">0</BitParameter>
</ConfigurableElement>
@@ -8632,8 +8736,11 @@
<ConfigurableElement Path="/Policy/policy/input_sources/default/applicable_input_device/mask/loopback">
<BitParameter Name="loopback">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/input_sources/mic/applicable_input_device/mask/in">
- <BitParameter Name="in">1</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/input_sources/default/applicable_input_device/mask/ip">
+ <BitParameter Name="ip">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/input_sources/default/applicable_input_device/mask/bus">
+ <BitParameter Name="bus">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/input_sources/mic/applicable_input_device/mask/communication">
<BitParameter Name="communication">0</BitParameter>
@@ -8677,8 +8784,11 @@
<ConfigurableElement Path="/Policy/policy/input_sources/mic/applicable_input_device/mask/loopback">
<BitParameter Name="loopback">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/input_sources/voice_downlink/applicable_input_device/mask/in">
- <BitParameter Name="in">1</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/input_sources/mic/applicable_input_device/mask/ip">
+ <BitParameter Name="ip">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/input_sources/mic/applicable_input_device/mask/bus">
+ <BitParameter Name="bus">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_downlink/applicable_input_device/mask/communication">
<BitParameter Name="communication">0</BitParameter>
@@ -8734,8 +8844,11 @@
<ConfigurableElement Path="/Policy/policy/input_sources/voice_downlink/applicable_input_device/mask/loopback">
<BitParameter Name="loopback">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/input_sources/voice_call/applicable_input_device/mask/in">
- <BitParameter Name="in">1</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/input_sources/voice_downlink/applicable_input_device/mask/ip">
+ <BitParameter Name="ip">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/input_sources/voice_downlink/applicable_input_device/mask/bus">
+ <BitParameter Name="bus">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_call/applicable_input_device/mask/communication">
<BitParameter Name="communication">0</BitParameter>
@@ -8791,8 +8904,11 @@
<ConfigurableElement Path="/Policy/policy/input_sources/voice_call/applicable_input_device/mask/loopback">
<BitParameter Name="loopback">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/input_sources/voice_uplink/applicable_input_device/mask/in">
- <BitParameter Name="in">1</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/input_sources/voice_call/applicable_input_device/mask/ip">
+ <BitParameter Name="ip">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/input_sources/voice_call/applicable_input_device/mask/bus">
+ <BitParameter Name="bus">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_uplink/applicable_input_device/mask/communication">
<BitParameter Name="communication">0</BitParameter>
@@ -8848,8 +8964,11 @@
<ConfigurableElement Path="/Policy/policy/input_sources/voice_uplink/applicable_input_device/mask/loopback">
<BitParameter Name="loopback">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/input_sources/camcorder/applicable_input_device/mask/in">
- <BitParameter Name="in">1</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/input_sources/voice_uplink/applicable_input_device/mask/ip">
+ <BitParameter Name="ip">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/input_sources/voice_uplink/applicable_input_device/mask/bus">
+ <BitParameter Name="bus">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/input_sources/camcorder/applicable_input_device/mask/communication">
<BitParameter Name="communication">0</BitParameter>
@@ -8902,8 +9021,11 @@
<ConfigurableElement Path="/Policy/policy/input_sources/camcorder/applicable_input_device/mask/loopback">
<BitParameter Name="loopback">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/input_sources/voice_recognition/applicable_input_device/mask/in">
- <BitParameter Name="in">1</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/input_sources/camcorder/applicable_input_device/mask/ip">
+ <BitParameter Name="ip">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/input_sources/camcorder/applicable_input_device/mask/bus">
+ <BitParameter Name="bus">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_recognition/applicable_input_device/mask/communication">
<BitParameter Name="communication">0</BitParameter>
@@ -8950,8 +9072,11 @@
<ConfigurableElement Path="/Policy/policy/input_sources/voice_recognition/applicable_input_device/mask/loopback">
<BitParameter Name="loopback">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/input_sources/voice_communication/applicable_input_device/mask/in">
- <BitParameter Name="in">1</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/input_sources/voice_recognition/applicable_input_device/mask/ip">
+ <BitParameter Name="ip">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/input_sources/voice_recognition/applicable_input_device/mask/bus">
+ <BitParameter Name="bus">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/input_sources/voice_communication/applicable_input_device/mask/communication">
<BitParameter Name="communication">0</BitParameter>
@@ -8995,8 +9120,11 @@
<ConfigurableElement Path="/Policy/policy/input_sources/voice_communication/applicable_input_device/mask/loopback">
<BitParameter Name="loopback">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/input_sources/remote_submix/applicable_input_device/mask/in">
- <BitParameter Name="in">1</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/input_sources/voice_communication/applicable_input_device/mask/ip">
+ <BitParameter Name="ip">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/input_sources/voice_communication/applicable_input_device/mask/bus">
+ <BitParameter Name="bus">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/input_sources/remote_submix/applicable_input_device/mask/communication">
<BitParameter Name="communication">0</BitParameter>
@@ -9052,8 +9180,11 @@
<ConfigurableElement Path="/Policy/policy/input_sources/remote_submix/applicable_input_device/mask/loopback">
<BitParameter Name="loopback">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/input_sources/hotword/applicable_input_device/mask/in">
- <BitParameter Name="in">1</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/input_sources/remote_submix/applicable_input_device/mask/ip">
+ <BitParameter Name="ip">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/input_sources/remote_submix/applicable_input_device/mask/bus">
+ <BitParameter Name="bus">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/input_sources/hotword/applicable_input_device/mask/communication">
<BitParameter Name="communication">0</BitParameter>
@@ -9100,8 +9231,11 @@
<ConfigurableElement Path="/Policy/policy/input_sources/hotword/applicable_input_device/mask/loopback">
<BitParameter Name="loopback">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/input_sources/unprocessed/applicable_input_device/mask/in">
- <BitParameter Name="in">1</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/input_sources/hotword/applicable_input_device/mask/ip">
+ <BitParameter Name="ip">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/input_sources/hotword/applicable_input_device/mask/bus">
+ <BitParameter Name="bus">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/input_sources/unprocessed/applicable_input_device/mask/communication">
<BitParameter Name="communication">0</BitParameter>
@@ -9148,8 +9282,11 @@
<ConfigurableElement Path="/Policy/policy/input_sources/unprocessed/applicable_input_device/mask/loopback">
<BitParameter Name="loopback">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/input_sources/fm_tuner/applicable_input_device/mask/in">
- <BitParameter Name="in">1</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/input_sources/unprocessed/applicable_input_device/mask/ip">
+ <BitParameter Name="ip">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/input_sources/unprocessed/applicable_input_device/mask/bus">
+ <BitParameter Name="bus">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/input_sources/fm_tuner/applicable_input_device/mask/communication">
<BitParameter Name="communication">0</BitParameter>
@@ -9205,6 +9342,12 @@
<ConfigurableElement Path="/Policy/policy/input_sources/fm_tuner/applicable_input_device/mask/loopback">
<BitParameter Name="loopback">0</BitParameter>
</ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/input_sources/fm_tuner/applicable_input_device/mask/ip">
+ <BitParameter Name="ip">0</BitParameter>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Policy/policy/input_sources/fm_tuner/applicable_input_device/mask/bus">
+ <BitParameter Name="bus">0</BitParameter>
+ </ConfigurableElement>
</Configuration>
</Settings>
</ConfigurableDomain>
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_input_source.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_input_source.pfw
similarity index 97%
rename from services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_input_source.pfw
rename to services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_input_source.pfw
index 16bcb01..b60b786 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_input_source.pfw
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_input_source.pfw
@@ -1,12 +1,7 @@
supDomain: DeviceForInputSource
domain: Calibration
conf: Calibration
- #
- # Note that ALL input devices must have the sign bit set to 1.
- # As the devices is a mask, use the "in" bit as a direction indicator.
- #
component: /Policy/policy/input_sources/default/applicable_input_device/mask
- in = 1
communication = 0
ambient = 0
hdmi = 0
@@ -21,8 +16,9 @@
line = 0
spdif = 0
loopback = 0
+ ip = 0
+ bus = 0
component: /Policy/policy/input_sources/mic/applicable_input_device/mask
- in = 1
communication = 0
ambient = 0
hdmi = 0
@@ -37,8 +33,9 @@
line = 0
spdif = 0
loopback = 0
+ ip = 0
+ bus = 0
component: /Policy/policy/input_sources/voice_downlink/applicable_input_device/mask
- in = 1
communication = 0
ambient = 0
builtin_mic = 0
@@ -57,8 +54,9 @@
spdif = 0
bluetooth_a2dp = 0
loopback = 0
+ ip = 0
+ bus = 0
component: /Policy/policy/input_sources/voice_call/applicable_input_device/mask
- in = 1
communication = 0
ambient = 0
builtin_mic = 0
@@ -77,8 +75,9 @@
spdif = 0
bluetooth_a2dp = 0
loopback = 0
+ ip = 0
+ bus = 0
component: /Policy/policy/input_sources/voice_uplink/applicable_input_device/mask
- in = 1
communication = 0
ambient = 0
builtin_mic = 0
@@ -97,8 +96,9 @@
spdif = 0
bluetooth_a2dp = 0
loopback = 0
+ ip = 0
+ bus = 0
component: /Policy/policy/input_sources/camcorder/applicable_input_device/mask
- in = 1
communication = 0
ambient = 0
bluetooth_sco_headset = 0
@@ -116,8 +116,9 @@
spdif = 0
bluetooth_a2dp = 0
loopback = 0
+ ip = 0
+ bus = 0
component: /Policy/policy/input_sources/voice_recognition/applicable_input_device/mask
- in = 1
communication = 0
ambient = 0
hdmi = 0
@@ -133,8 +134,9 @@
spdif = 0
bluetooth_a2dp = 0
loopback = 0
+ ip = 0
+ bus = 0
component: /Policy/policy/input_sources/voice_communication/applicable_input_device/mask
- in = 1
communication = 0
ambient = 0
hdmi = 0
@@ -149,8 +151,9 @@
spdif = 0
bluetooth_a2dp = 0
loopback = 0
+ ip = 0
+ bus = 0
component: /Policy/policy/input_sources/remote_submix/applicable_input_device/mask
- in = 1
communication = 0
ambient = 0
builtin_mic = 0
@@ -169,8 +172,9 @@
spdif = 0
bluetooth_a2dp = 0
loopback = 0
+ ip = 0
+ bus = 0
component: /Policy/policy/input_sources/hotword/applicable_input_device/mask
- in = 1
communication = 0
ambient = 0
hdmi = 0
@@ -186,8 +190,9 @@
spdif = 0
bluetooth_a2dp = 0
loopback = 0
+ ip = 0
+ bus = 0
component: /Policy/policy/input_sources/unprocessed/applicable_input_device/mask
- in = 1
communication = 0
ambient = 0
hdmi = 0
@@ -203,8 +208,9 @@
spdif = 0
bluetooth_a2dp = 0
loopback = 0
+ ip = 0
+ bus = 0
component: /Policy/policy/input_sources/fm_tuner/applicable_input_device/mask
- in = 1
communication = 0
ambient = 0
bluetooth_sco_headset = 0
@@ -223,6 +229,8 @@
spdif = 0
bluetooth_a2dp = 0
loopback = 0
+ ip = 0
+ bus = 0
domain: DefaultAndMic
conf: A2dp
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_accessibility.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_accessibility.pfw
similarity index 99%
rename from services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_accessibility.pfw
rename to services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_accessibility.pfw
index dacf5b2..1036f2e 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_accessibility.pfw
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_accessibility.pfw
@@ -16,6 +16,8 @@
fm = 0
speaker_safe = 0
telephony_tx = 0
+ ip = 0
+ bus = 0
domain: Device
conf: RemoteSubmix
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_dtmf.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_dtmf.pfw
similarity index 99%
rename from services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_dtmf.pfw
rename to services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_dtmf.pfw
index d9469c0..71fa42f 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_dtmf.pfw
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_dtmf.pfw
@@ -8,6 +8,8 @@
fm = 0
speaker_safe = 0
bluetooth_sco_carkit = 0
+ ip = 0
+ bus = 0
domain: Device2
conf: RemoteSubmix
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_enforced_audible.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_enforced_audible.pfw
similarity index 94%
rename from services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_enforced_audible.pfw
rename to services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_enforced_audible.pfw
index 593ef64..30c86b2 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_enforced_audible.pfw
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_enforced_audible.pfw
@@ -10,6 +10,9 @@
spdif = 0
aux_line = 0
speaker_safe = 0
+ ip = 0
+ bus = 0
+ fm = 0
domain: Speaker
conf: Selected
@@ -76,7 +79,6 @@
usb_device = 0
telephony_tx = 0
line = 0
- fm = 0
conf: BluetoothA2dp
AvailableOutputDevices Includes BluetoothA2dp
@@ -100,7 +102,6 @@
usb_device = 0
telephony_tx = 0
line = 0
- fm = 0
conf: BluetoothA2dpHeadphones
AvailableOutputDevices Includes BluetoothA2dpHeadphones
@@ -124,7 +125,6 @@
usb_device = 0
telephony_tx = 0
line = 0
- fm = 0
conf: BluetoothA2dpSpeaker
AvailableOutputDevices Includes BluetoothA2dpSpeaker
@@ -148,7 +148,6 @@
usb_device = 0
telephony_tx = 0
line = 0
- fm = 0
conf: WiredHeadphone
ForceUseForMedia IsNot ForceSpeaker
@@ -172,7 +171,6 @@
usb_device = 0
telephony_tx = 0
line = 0
- fm = 0
conf: Line
ForceUseForMedia IsNot ForceSpeaker
@@ -196,7 +194,6 @@
usb_device = 0
telephony_tx = 0
line = 1
- fm = 0
conf: WiredHeadset
ForceUseForMedia IsNot ForceSpeaker
@@ -220,7 +217,6 @@
usb_device = 0
telephony_tx = 0
line = 0
- fm = 0
conf: UsbAccessory
ForceUseForMedia IsNot ForceSpeaker
@@ -244,7 +240,6 @@
usb_device = 0
telephony_tx = 0
line = 0
- fm = 0
conf: UsbDevice
ForceUseForMedia IsNot ForceSpeaker
@@ -268,7 +263,6 @@
usb_device = 1
telephony_tx = 0
line = 0
- fm = 0
conf: DgtlDockHeadset
ForceUseForMedia IsNot ForceSpeaker
@@ -292,7 +286,6 @@
usb_device = 0
telephony_tx = 0
line = 0
- fm = 0
conf: Hdmi
ForceUseForMedia IsNot ForceSpeaker
@@ -316,7 +309,6 @@
usb_device = 0
telephony_tx = 0
line = 0
- fm = 0
conf: AnlgDockHeadset
ForceUseForMedia IsNot ForceSpeaker
@@ -341,5 +333,25 @@
usb_device = 0
telephony_tx = 0
line = 0
- fm = 0
+
+ conf: NoDevice
+ component: /Policy/policy/strategies/enforced_audible/selected_output_devices/mask
+ remote_submix = 0
+ earpiece = 0
+ wired_headset = 0
+ wired_headphone = 0
+ bluetooth_sco = 0
+ bluetooth_sco_headset = 0
+ bluetooth_sco_carkit = 0
+ bluetooth_a2dp = 0
+ bluetooth_a2dp_headphones = 0
+ bluetooth_a2dp_speaker = 0
+ hdmi = 0
+ angl_dock_headset = 0
+ dgtl_dock_headset = 0
+ usb_accessory = 0
+ usb_device = 0
+ telephony_tx = 0
+ line = 0
+
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_media.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_media.pfw
similarity index 99%
rename from services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_media.pfw
rename to services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_media.pfw
index 006ac60..062e120 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_media.pfw
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_media.pfw
@@ -12,6 +12,8 @@
bluetooth_sco_headset = 0
bluetooth_sco_carkit = 0
telephony_tx = 0
+ ip = 0
+ bus = 0
domain: Device2
conf: RemoteSubmix
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_phone.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_phone.pfw
similarity index 99%
rename from services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_phone.pfw
rename to services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_phone.pfw
index 0dad830..3b61f5d 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_phone.pfw
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_phone.pfw
@@ -12,6 +12,8 @@
spdif = 0
fm = 0
speaker_safe = 0
+ ip = 0
+ bus = 0
domain: Device
conf: ScoCarkit
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_rerouting.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_rerouting.pfw
similarity index 99%
rename from services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_rerouting.pfw
rename to services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_rerouting.pfw
index d390a33..9d9525d 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_rerouting.pfw
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_rerouting.pfw
@@ -17,6 +17,8 @@
bluetooth_sco_headset = 0
bluetooth_sco_carkit = 0
telephony_tx = 0
+ ip = 0
+ bus = 0
domain: Device2
conf: RemoteSubmix
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_sonification.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_sonification.pfw
similarity index 99%
rename from services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_sonification.pfw
rename to services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_sonification.pfw
index 96723f6..5193c32 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_sonification.pfw
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_sonification.pfw
@@ -16,6 +16,8 @@
# Sonification follows phone strategy if in call but HDMI is not reachable
#
hdmi = 0
+ ip = 0
+ bus = 0
domain: Speaker
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_sonification_respectful.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_sonification_respectful.pfw
similarity index 99%
rename from services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_sonification_respectful.pfw
rename to services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_sonification_respectful.pfw
index 7626944..961fa41 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_sonification_respectful.pfw
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_sonification_respectful.pfw
@@ -22,6 +22,8 @@
spdif = 0
fm = 0
telephony_tx = 0
+ ip = 0
+ bus = 0
domain: Speakers
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_transmitted_through_speaker.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_transmitted_through_speaker.pfw
similarity index 97%
rename from services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_transmitted_through_speaker.pfw
rename to services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_transmitted_through_speaker.pfw
index e5ae9d9..7eebe2a 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/device_for_strategy_transmitted_through_speaker.pfw
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/device_for_strategy_transmitted_through_speaker.pfw
@@ -26,6 +26,8 @@
usb_device = 0
telephony_tx = 0
line = 0
+ ip = 0
+ bus = 0
domain: Speaker
conf: Selected
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/strategy_for_stream.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/strategy_for_stream.pfw
similarity index 100%
rename from services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/strategy_for_stream.pfw
rename to services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/strategy_for_stream.pfw
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/strategy_for_usage.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/strategy_for_usage.pfw
similarity index 100%
rename from services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/strategy_for_usage.pfw
rename to services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/strategy_for_usage.pfw
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/volumes.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/volumes.pfw
similarity index 100%
rename from services/audiopolicy/engineconfigurable/parameter-framework/example/Settings/volumes.pfw
rename to services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/volumes.pfw
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/example/Structure/PolicyClass.xml b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Structure/PolicyClass.xml
similarity index 100%
rename from services/audiopolicy/engineconfigurable/parameter-framework/example/Structure/PolicyClass.xml
rename to services/audiopolicy/engineconfigurable/parameter-framework/examples/Structure/PolicyClass.xml
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/example/Structure/PolicySubsystem-CommonTypes.xml b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Structure/PolicySubsystem-CommonTypes.xml
similarity index 94%
rename from services/audiopolicy/engineconfigurable/parameter-framework/example/Structure/PolicySubsystem-CommonTypes.xml
rename to services/audiopolicy/engineconfigurable/parameter-framework/examples/Structure/PolicySubsystem-CommonTypes.xml
index 6d6145a..faedfc4 100755
--- a/services/audiopolicy/engineconfigurable/parameter-framework/example/Structure/PolicySubsystem-CommonTypes.xml
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Structure/PolicySubsystem-CommonTypes.xml
@@ -35,6 +35,8 @@
<BitParameter Name="fm" Size="1" Pos="20"/>
<BitParameter Name="aux_line" Size="1" Pos="21"/>
<BitParameter Name="speaker_safe" Size="1" Pos="22"/>
+ <BitParameter Name="ip" Size="1" Pos="23"/>
+ <BitParameter Name="bus" Size="1" Pos="24"/>
</BitParameterBlock>
</ComponentType>
@@ -62,7 +64,8 @@
<BitParameter Name="spdif" Size="1" Pos="16"/>
<BitParameter Name="bluetooth_a2dp" Size="1" Pos="17"/>
<BitParameter Name="loopback" Size="1" Pos="18"/>
- <BitParameter Name="in" Size="1" Pos="31"/>
+ <BitParameter Name="ip" Size="1" Pos="19"/>
+ <BitParameter Name="bus" Size="1" Pos="20"/>
</BitParameterBlock>
</ComponentType>
@@ -83,6 +86,10 @@
<BitParameter Name="compress_offload" Size="1" Pos="4"/>
<BitParameter Name="non_blocking" Size="1" Pos="5"/>
<BitParameter Name="hw_av_sync" Size="1" Pos="6"/>
+ <BitParameter Name="tts" Size="1" Pos="7"/>
+ <BitParameter Name="raw" Size="1" Pos="8"/>
+ <BitParameter Name="sync" Size="1" Pos="9"/>
+ <BitParameter Name="iec958_nonaudio" Size="1" Pos="10"/>
</BitParameterBlock>
</ComponentType>
@@ -94,6 +101,8 @@
<BitParameterBlock Name="mask" Size="32">
<BitParameter Name="fast" Size="1" Pos="0"/>
<BitParameter Name="hw_hotword" Size="1" Pos="2"/>
+ <BitParameter Name="raw" Size="1" Pos="3"/>
+ <BitParameter Name="sync" Size="1" Pos="4"/>
</BitParameterBlock>
</ComponentType>
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/example/Structure/PolicySubsystem.xml b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Structure/PolicySubsystem.xml
similarity index 100%
rename from services/audiopolicy/engineconfigurable/parameter-framework/example/Structure/PolicySubsystem.xml
rename to services/audiopolicy/engineconfigurable/parameter-framework/examples/Structure/PolicySubsystem.xml
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/example/policy_criteria.txt b/services/audiopolicy/engineconfigurable/parameter-framework/examples/policy_criteria.txt
similarity index 96%
rename from services/audiopolicy/engineconfigurable/parameter-framework/example/policy_criteria.txt
rename to services/audiopolicy/engineconfigurable/parameter-framework/examples/policy_criteria.txt
index 28a7ef1..146767e 100755
--- a/services/audiopolicy/engineconfigurable/parameter-framework/example/policy_criteria.txt
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/policy_criteria.txt
@@ -1,6 +1,6 @@
ExclusiveCriterion TelephonyMode : Normal RingTone InCall InCommunication
-InclusiveCriterion AvailableInputDevices : Communication Ambient BuiltinMic BluetoothScoHeadset WiredHeadset Hdmi TelephonyRx BackMic RemoteSubmix AnlgDockHeadset DgtlDockHeadset UsbAccessory UsbDevice FmTuner TvTuner Line Spdif BluetoothA2dp Loopback
-InclusiveCriterion AvailableOutputDevices : Earpiece Speaker WiredSpeaker WiredHeadset WiredHeadphone BluetoothSco BluetoothScoHeadset BluetoothScoCarkit BluetoothA2dp BluetoothA2dpHeadphones BluetoothA2dpSpeaker Hdmi AnlgDockHeadset DgtlDockHeadset UsbAccessory UsbDevice RemoteSubmix TelephonyTx Line HdmiArc Spdif Fm AuxLine SpeakerSafe
+InclusiveCriterion AvailableInputDevices : Communication Ambient BuiltinMic BluetoothScoHeadset WiredHeadset Hdmi TelephonyRx BackMic RemoteSubmix AnlgDockHeadset DgtlDockHeadset UsbAccessory UsbDevice FmTuner TvTuner Line Spdif BluetoothA2dp Loopback Ip Bus
+InclusiveCriterion AvailableOutputDevices : Earpiece Speaker WiredSpeaker WiredHeadset WiredHeadphone BluetoothSco BluetoothScoHeadset BluetoothScoCarkit BluetoothA2dp BluetoothA2dpHeadphones BluetoothA2dpSpeaker Hdmi AnlgDockHeadset DgtlDockHeadset UsbAccessory UsbDevice RemoteSubmix TelephonyTx Line HdmiArc Spdif Fm AuxLine SpeakerSafe Ip Bus
ExclusiveCriterion ForceUseForCommunication : ForceNone ForceSpeaker ForceBtSco
ExclusiveCriterion ForceUseForMedia : ForceNone ForceSpeaker ForceHeadphones ForceBtA2dp ForceWiredAccessory ForceAnalogDock ForceDigitalDock ForceNoBtA2dp ForceSystemEnforced
ExclusiveCriterion ForceUseForRecord : ForceNone ForceBtSco ForceWiredAccessory
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/InputSource.cpp b/services/audiopolicy/engineconfigurable/parameter-framework/plugin/InputSource.cpp
index eac4efe..bff824a 100755
--- a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/InputSource.cpp
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/plugin/InputSource.cpp
@@ -42,5 +42,6 @@
{
uint32_t applicableInputDevice;
blackboardRead(&applicableInputDevice, sizeof(applicableInputDevice));
- return mPolicyPluginInterface->setDeviceForInputSource(mId, applicableInputDevice);
+ return mPolicyPluginInterface->setDeviceForInputSource(
+ mId, AUDIO_DEVICE_BIT_IN | applicableInputDevice);
}
diff --git a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
index 02603b8..c9b3abc 100644
--- a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
+++ b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
@@ -287,7 +287,7 @@
bool updatePid = (pid == -1);
const uid_t callingUid = IPCThreadState::self()->getCallingUid();
if (!isTrustedCallingUid(callingUid)) {
- ALOGW_IF(uid != -1 && uid != (int)callingUid,
+ ALOGW_IF(uid != (uid_t)-1 && uid != callingUid,
"%s uid %d tried to pass itself off as %d", __FUNCTION__, callingUid, uid);
uid = callingUid;
updatePid = true;
@@ -295,7 +295,7 @@
if (updatePid) {
const pid_t callingPid = IPCThreadState::self()->getCallingPid();
- ALOGW_IF(pid != -1 && pid != callingPid,
+ ALOGW_IF(pid != (pid_t)-1 && pid != callingPid,
"%s uid %d pid %d tried to pass itself off as pid %d",
__func__, callingUid, callingPid, pid);
pid = callingPid;