Loading drm/drmserver/drmserver.rc +0 −7 Original line number Original line Diff line number Diff line service drm /system/bin/drmserver service drm /system/bin/drmserver disabled class main class main user drm user drm group drm system inet drmrpc readproc group drm system inet drmrpc readproc writepid /dev/cpuset/foreground/tasks writepid /dev/cpuset/foreground/tasks on property:drm.service.enabled=true start drm on property:drm.service.enabled=1 start drm drm/libdrmframework/DrmManagerClientImpl.cpp +9 −6 Original line number Original line Diff line number Diff line Loading @@ -52,22 +52,25 @@ void DrmManagerClientImpl::remove(int uniqueId) { const sp<IDrmManagerService>& DrmManagerClientImpl::getDrmManagerService() { const sp<IDrmManagerService>& DrmManagerClientImpl::getDrmManagerService() { Mutex::Autolock lock(sMutex); Mutex::Autolock lock(sMutex); if (NULL == sDrmManagerService.get()) { if (NULL == sDrmManagerService.get()) { char value[PROPERTY_VALUE_MAX]; if (property_get("drm.service.enabled", value, NULL) == 0) { // Drm is undefined for this device return sDrmManagerService; } sp<IServiceManager> sm = defaultServiceManager(); sp<IServiceManager> sm = defaultServiceManager(); sp<IBinder> binder; sp<IBinder> binder; for(int i = 0; i < 10; i++) { do { binder = sm->getService(String16("drm.drmManager")); binder = sm->getService(String16("drm.drmManager")); if (binder != 0) { if (binder != 0) { break; break; } } ALOGW("DrmManagerService not published, waiting... %d", i); ALOGW("DrmManagerService not published, waiting..."); struct timespec reqt; struct timespec reqt; reqt.tv_sec = 0; reqt.tv_sec = 0; reqt.tv_nsec = 500000000; //0.5 sec reqt.tv_nsec = 500000000; //0.5 sec nanosleep(&reqt, NULL); nanosleep(&reqt, NULL); } } while (true); if (binder == NULL) { return sDrmManagerService; } if (NULL == sDeathNotifier.get()) { if (NULL == sDeathNotifier.get()) { sDeathNotifier = new DeathNotifier(); sDeathNotifier = new DeathNotifier(); } } Loading media/codec2/hidl/client/client.cpp +46 −3 Original line number Original line Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <codec2/hidl/client.h> #include <codec2/hidl/client.h> #include <C2Debug.h> #include <C2Debug.h> #include <C2BufferPriv.h> #include <C2BufferPriv.h> #include <C2Config.h> // for C2StreamUsageTuning #include <C2PlatformSupport.h> #include <C2PlatformSupport.h> #include <android/hardware/media/bufferpool/2.0/IClientManager.h> #include <android/hardware/media/bufferpool/2.0/IClientManager.h> Loading @@ -41,7 +42,10 @@ #include <cutils/native_handle.h> #include <cutils/native_handle.h> #include <gui/bufferqueue/2.0/B2HGraphicBufferProducer.h> #include <gui/bufferqueue/2.0/B2HGraphicBufferProducer.h> #include <gui/bufferqueue/2.0/H2BGraphicBufferProducer.h> #include <gui/bufferqueue/2.0/H2BGraphicBufferProducer.h> #include <hardware/gralloc.h> // for GRALLOC_USAGE_* #include <hidl/HidlSupport.h> #include <hidl/HidlSupport.h> #include <system/window.h> // for NATIVE_WINDOW_QUERY_* #include <media/stagefright/foundation/ADebug.h> // for asString(status_t) #include <deque> #include <deque> Loading Loading @@ -81,6 +85,10 @@ namespace /* unnamed */ { // c2_status_t value that corresponds to hwbinder transaction failure. // c2_status_t value that corresponds to hwbinder transaction failure. constexpr c2_status_t C2_TRANSACTION_FAILED = C2_CORRUPTED; constexpr c2_status_t C2_TRANSACTION_FAILED = C2_CORRUPTED; // By default prepare buffer to be displayed on any of the common surfaces constexpr uint64_t kDefaultConsumerUsage = (GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_COMPOSER); // Searches for a name in GetServiceNames() and returns the index found. If the // Searches for a name in GetServiceNames() and returns the index found. If the // name is not found, the returned index will be equal to // name is not found, the returned index will be equal to // GetServiceNames().size(). // GetServiceNames().size(). Loading Loading @@ -1507,8 +1515,43 @@ c2_status_t Codec2Client::Component::setOutputSurface( mOutputBufferQueue->configure(surface, generation, bqId, maxDequeueCount, mBase1_2 ? mOutputBufferQueue->configure(surface, generation, bqId, maxDequeueCount, mBase1_2 ? &syncObj : nullptr); &syncObj : nullptr); } } ALOGD("surface generation remote change %u HAL ver: %s", generation, syncObj ? "1.2" : "1.0"); // set consumer bits // TODO: should this get incorporated into setOutputSurface method so that consumer bits // can be set atomically? uint64_t consumerUsage = kDefaultConsumerUsage; { if (surface) { int usage = 0; status_t err = surface->query(NATIVE_WINDOW_CONSUMER_USAGE_BITS, &usage); if (err != NO_ERROR) { ALOGD("setOutputSurface -- failed to get consumer usage bits (%d/%s). ignoring", err, asString(err)); } else { // Note: we are adding the default usage because components must support // producing output frames that can be displayed an all output surfaces. // TODO: do not set usage for tunneled scenario. It is unclear if consumer usage // is meaningful in a tunneled scenario; on one hand output buffers exist, but // they do not exist inside of C2 scope. Any buffer usage shall be communicated // through the sideband channel. // do an unsigned conversion as bit-31 may be 1 consumerUsage = (uint32_t)usage | kDefaultConsumerUsage; } } C2StreamUsageTuning::output outputUsage{ 0u, C2AndroidMemoryUsage::FromGrallocUsage(consumerUsage).expected}; std::vector<std::unique_ptr<C2SettingResult>> failures; c2_status_t err = config({&outputUsage}, C2_MAY_BLOCK, &failures); if (err != C2_OK) { ALOGD("setOutputSurface -- failed to set consumer usage (%d/%s)", err, asString(err)); } } ALOGD("setOutputSurface -- generation=%u consumer usage=%#llx%s", generation, (long long)consumerUsage, syncObj ? " sync" : ""); Return<Status> transStatus = syncObj ? Return<Status> transStatus = syncObj ? mBase1_2->setOutputSurfaceWithSyncObj( mBase1_2->setOutputSurfaceWithSyncObj( Loading @@ -1517,6 +1560,7 @@ c2_status_t Codec2Client::Component::setOutputSurface( mBase1_0->setOutputSurface( mBase1_0->setOutputSurface( static_cast<uint64_t>(blockPoolId), static_cast<uint64_t>(blockPoolId), bqId == 0 ? nullHgbp : igbp); bqId == 0 ? nullHgbp : igbp); if (!transStatus.isOk()) { if (!transStatus.isOk()) { LOG(ERROR) << "setOutputSurface -- transaction failed."; LOG(ERROR) << "setOutputSurface -- transaction failed."; return C2_TRANSACTION_FAILED; return C2_TRANSACTION_FAILED; Loading Loading @@ -1694,4 +1738,3 @@ c2_status_t Codec2Client::InputSurfaceConnection::disconnect() { } } } // namespace android } // namespace android media/codec2/sfplugin/CCodecBufferChannel.cpp +9 −0 Original line number Original line Diff line number Diff line Loading @@ -1341,6 +1341,15 @@ status_t CCodecBufferChannel::start( outputSurface, outputSurface, outputGeneration, outputGeneration, maxDequeueCount); maxDequeueCount); } else { // configure CPU read consumer usage C2StreamUsageTuning::output outputUsage{0u, C2MemoryUsage::CPU_READ}; std::vector<std::unique_ptr<C2SettingResult>> failures; err = mComponent->config({ &outputUsage }, C2_MAY_BLOCK, &failures); // do not print error message for now as most components may not yet // support this setting ALOGD_IF(err != C2_BAD_INDEX, "[%s] Configured output usage [%#llx]", mName, (long long)outputUsage.value); } } if (oStreamFormat.value == C2BufferData::LINEAR) { if (oStreamFormat.value == C2BufferData::LINEAR) { Loading services/audiopolicy/managerdefault/AudioPolicyManager.cpp +4 −2 Original line number Original line Diff line number Diff line Loading @@ -2531,12 +2531,14 @@ status_t AudioPolicyManager::stopInput(audio_port_handle_t portId) ALOGW("%s input %d client %d already stopped", __FUNCTION__, input, client->portId()); ALOGW("%s input %d client %d already stopped", __FUNCTION__, input, client->portId()); return INVALID_OPERATION; return INVALID_OPERATION; } } auto old_source = inputDesc->source(); inputDesc->setClientActive(client, false); inputDesc->setClientActive(client, false); inputDesc->stop(); inputDesc->stop(); if (inputDesc->isActive()) { if (inputDesc->isActive()) { setInputDevice(input, getNewInputDevice(inputDesc), false /* force */); auto current_source = inputDesc->source(); setInputDevice(input, getNewInputDevice(inputDesc), old_source != current_source /* force */); } else { } else { sp<AudioPolicyMix> policyMix = inputDesc->mPolicyMix.promote(); sp<AudioPolicyMix> policyMix = inputDesc->mPolicyMix.promote(); // if input maps to a dynamic policy with an activity listener, notify of state change // if input maps to a dynamic policy with an activity listener, notify of state change Loading Loading
drm/drmserver/drmserver.rc +0 −7 Original line number Original line Diff line number Diff line service drm /system/bin/drmserver service drm /system/bin/drmserver disabled class main class main user drm user drm group drm system inet drmrpc readproc group drm system inet drmrpc readproc writepid /dev/cpuset/foreground/tasks writepid /dev/cpuset/foreground/tasks on property:drm.service.enabled=true start drm on property:drm.service.enabled=1 start drm
drm/libdrmframework/DrmManagerClientImpl.cpp +9 −6 Original line number Original line Diff line number Diff line Loading @@ -52,22 +52,25 @@ void DrmManagerClientImpl::remove(int uniqueId) { const sp<IDrmManagerService>& DrmManagerClientImpl::getDrmManagerService() { const sp<IDrmManagerService>& DrmManagerClientImpl::getDrmManagerService() { Mutex::Autolock lock(sMutex); Mutex::Autolock lock(sMutex); if (NULL == sDrmManagerService.get()) { if (NULL == sDrmManagerService.get()) { char value[PROPERTY_VALUE_MAX]; if (property_get("drm.service.enabled", value, NULL) == 0) { // Drm is undefined for this device return sDrmManagerService; } sp<IServiceManager> sm = defaultServiceManager(); sp<IServiceManager> sm = defaultServiceManager(); sp<IBinder> binder; sp<IBinder> binder; for(int i = 0; i < 10; i++) { do { binder = sm->getService(String16("drm.drmManager")); binder = sm->getService(String16("drm.drmManager")); if (binder != 0) { if (binder != 0) { break; break; } } ALOGW("DrmManagerService not published, waiting... %d", i); ALOGW("DrmManagerService not published, waiting..."); struct timespec reqt; struct timespec reqt; reqt.tv_sec = 0; reqt.tv_sec = 0; reqt.tv_nsec = 500000000; //0.5 sec reqt.tv_nsec = 500000000; //0.5 sec nanosleep(&reqt, NULL); nanosleep(&reqt, NULL); } } while (true); if (binder == NULL) { return sDrmManagerService; } if (NULL == sDeathNotifier.get()) { if (NULL == sDeathNotifier.get()) { sDeathNotifier = new DeathNotifier(); sDeathNotifier = new DeathNotifier(); } } Loading
media/codec2/hidl/client/client.cpp +46 −3 Original line number Original line Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <codec2/hidl/client.h> #include <codec2/hidl/client.h> #include <C2Debug.h> #include <C2Debug.h> #include <C2BufferPriv.h> #include <C2BufferPriv.h> #include <C2Config.h> // for C2StreamUsageTuning #include <C2PlatformSupport.h> #include <C2PlatformSupport.h> #include <android/hardware/media/bufferpool/2.0/IClientManager.h> #include <android/hardware/media/bufferpool/2.0/IClientManager.h> Loading @@ -41,7 +42,10 @@ #include <cutils/native_handle.h> #include <cutils/native_handle.h> #include <gui/bufferqueue/2.0/B2HGraphicBufferProducer.h> #include <gui/bufferqueue/2.0/B2HGraphicBufferProducer.h> #include <gui/bufferqueue/2.0/H2BGraphicBufferProducer.h> #include <gui/bufferqueue/2.0/H2BGraphicBufferProducer.h> #include <hardware/gralloc.h> // for GRALLOC_USAGE_* #include <hidl/HidlSupport.h> #include <hidl/HidlSupport.h> #include <system/window.h> // for NATIVE_WINDOW_QUERY_* #include <media/stagefright/foundation/ADebug.h> // for asString(status_t) #include <deque> #include <deque> Loading Loading @@ -81,6 +85,10 @@ namespace /* unnamed */ { // c2_status_t value that corresponds to hwbinder transaction failure. // c2_status_t value that corresponds to hwbinder transaction failure. constexpr c2_status_t C2_TRANSACTION_FAILED = C2_CORRUPTED; constexpr c2_status_t C2_TRANSACTION_FAILED = C2_CORRUPTED; // By default prepare buffer to be displayed on any of the common surfaces constexpr uint64_t kDefaultConsumerUsage = (GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_COMPOSER); // Searches for a name in GetServiceNames() and returns the index found. If the // Searches for a name in GetServiceNames() and returns the index found. If the // name is not found, the returned index will be equal to // name is not found, the returned index will be equal to // GetServiceNames().size(). // GetServiceNames().size(). Loading Loading @@ -1507,8 +1515,43 @@ c2_status_t Codec2Client::Component::setOutputSurface( mOutputBufferQueue->configure(surface, generation, bqId, maxDequeueCount, mBase1_2 ? mOutputBufferQueue->configure(surface, generation, bqId, maxDequeueCount, mBase1_2 ? &syncObj : nullptr); &syncObj : nullptr); } } ALOGD("surface generation remote change %u HAL ver: %s", generation, syncObj ? "1.2" : "1.0"); // set consumer bits // TODO: should this get incorporated into setOutputSurface method so that consumer bits // can be set atomically? uint64_t consumerUsage = kDefaultConsumerUsage; { if (surface) { int usage = 0; status_t err = surface->query(NATIVE_WINDOW_CONSUMER_USAGE_BITS, &usage); if (err != NO_ERROR) { ALOGD("setOutputSurface -- failed to get consumer usage bits (%d/%s). ignoring", err, asString(err)); } else { // Note: we are adding the default usage because components must support // producing output frames that can be displayed an all output surfaces. // TODO: do not set usage for tunneled scenario. It is unclear if consumer usage // is meaningful in a tunneled scenario; on one hand output buffers exist, but // they do not exist inside of C2 scope. Any buffer usage shall be communicated // through the sideband channel. // do an unsigned conversion as bit-31 may be 1 consumerUsage = (uint32_t)usage | kDefaultConsumerUsage; } } C2StreamUsageTuning::output outputUsage{ 0u, C2AndroidMemoryUsage::FromGrallocUsage(consumerUsage).expected}; std::vector<std::unique_ptr<C2SettingResult>> failures; c2_status_t err = config({&outputUsage}, C2_MAY_BLOCK, &failures); if (err != C2_OK) { ALOGD("setOutputSurface -- failed to set consumer usage (%d/%s)", err, asString(err)); } } ALOGD("setOutputSurface -- generation=%u consumer usage=%#llx%s", generation, (long long)consumerUsage, syncObj ? " sync" : ""); Return<Status> transStatus = syncObj ? Return<Status> transStatus = syncObj ? mBase1_2->setOutputSurfaceWithSyncObj( mBase1_2->setOutputSurfaceWithSyncObj( Loading @@ -1517,6 +1560,7 @@ c2_status_t Codec2Client::Component::setOutputSurface( mBase1_0->setOutputSurface( mBase1_0->setOutputSurface( static_cast<uint64_t>(blockPoolId), static_cast<uint64_t>(blockPoolId), bqId == 0 ? nullHgbp : igbp); bqId == 0 ? nullHgbp : igbp); if (!transStatus.isOk()) { if (!transStatus.isOk()) { LOG(ERROR) << "setOutputSurface -- transaction failed."; LOG(ERROR) << "setOutputSurface -- transaction failed."; return C2_TRANSACTION_FAILED; return C2_TRANSACTION_FAILED; Loading Loading @@ -1694,4 +1738,3 @@ c2_status_t Codec2Client::InputSurfaceConnection::disconnect() { } } } // namespace android } // namespace android
media/codec2/sfplugin/CCodecBufferChannel.cpp +9 −0 Original line number Original line Diff line number Diff line Loading @@ -1341,6 +1341,15 @@ status_t CCodecBufferChannel::start( outputSurface, outputSurface, outputGeneration, outputGeneration, maxDequeueCount); maxDequeueCount); } else { // configure CPU read consumer usage C2StreamUsageTuning::output outputUsage{0u, C2MemoryUsage::CPU_READ}; std::vector<std::unique_ptr<C2SettingResult>> failures; err = mComponent->config({ &outputUsage }, C2_MAY_BLOCK, &failures); // do not print error message for now as most components may not yet // support this setting ALOGD_IF(err != C2_BAD_INDEX, "[%s] Configured output usage [%#llx]", mName, (long long)outputUsage.value); } } if (oStreamFormat.value == C2BufferData::LINEAR) { if (oStreamFormat.value == C2BufferData::LINEAR) { Loading
services/audiopolicy/managerdefault/AudioPolicyManager.cpp +4 −2 Original line number Original line Diff line number Diff line Loading @@ -2531,12 +2531,14 @@ status_t AudioPolicyManager::stopInput(audio_port_handle_t portId) ALOGW("%s input %d client %d already stopped", __FUNCTION__, input, client->portId()); ALOGW("%s input %d client %d already stopped", __FUNCTION__, input, client->portId()); return INVALID_OPERATION; return INVALID_OPERATION; } } auto old_source = inputDesc->source(); inputDesc->setClientActive(client, false); inputDesc->setClientActive(client, false); inputDesc->stop(); inputDesc->stop(); if (inputDesc->isActive()) { if (inputDesc->isActive()) { setInputDevice(input, getNewInputDevice(inputDesc), false /* force */); auto current_source = inputDesc->source(); setInputDevice(input, getNewInputDevice(inputDesc), old_source != current_source /* force */); } else { } else { sp<AudioPolicyMix> policyMix = inputDesc->mPolicyMix.promote(); sp<AudioPolicyMix> policyMix = inputDesc->mPolicyMix.promote(); // if input maps to a dynamic policy with an activity listener, notify of state change // if input maps to a dynamic policy with an activity listener, notify of state change Loading