diff --git a/services/engine/histreamer/avmetadatahelper/avmetadatahelper_impl.cpp b/services/engine/histreamer/avmetadatahelper/avmetadatahelper_impl.cpp index 29fc160f008a3dbc11edcfc40c3ff4fef5547a96..c67f7e36f0e62c5884e9e955b3c3fb3a5cbe9c63 100644 --- a/services/engine/histreamer/avmetadatahelper/avmetadatahelper_impl.cpp +++ b/services/engine/histreamer/avmetadatahelper/avmetadatahelper_impl.cpp @@ -137,6 +137,18 @@ Status AVMetadataHelperImpl::SetSourceInternel(const std::string &uri, bool isFo Status ret = mediaDemuxer_->SetDataSource(std::make_shared(uri)); CHECK_AND_RETURN_RET_LOG(ret == Status::OK, ret, "0x%{public}06" PRIXPTR " SetSourceInternel demuxer failed to call SetDataSource", FAKE_POINTER(this)); + bool isWatchDevice = mediaDemuxer_->IsWatchDevice(); + if (isWatchDevice) { + MEDIA_LOGI("Watch detected, boosting read thread priority"); + Status boostRet = mediaDemuxer_->BoostReadThreadPriority(); + if (boostRet != Status::OK) { + MEDIA_LOGW("Boosting for watch ended in failure, ret: %{public}d", static_cast(boostRet)); + } else { + MEDIA_LOGI("Boosting for watch ended successfully"); + } + } else { + MEDIA_LOGD("Non-watch detected, not boosting"); + } return Status::OK; } @@ -166,6 +178,18 @@ Status AVMetadataHelperImpl::SetSourceInternel(const std::shared_ptrSetDataSource(std::make_shared(dataSrc)); CHECK_AND_RETURN_RET_LOG(ret == Status::OK, ret, "Failed to call SetDataSource"); + bool isWatchDevice = mediaDemuxer_->IsWatchDevice(); + if (isWatchDevice) { + MEDIA_LOGI("Watch detected, boosting read thread priority"); + Status boostRet = mediaDemuxer_->BoostReadThreadPriority(); + if (boostRet != Status::OK) { + MEDIA_LOGW("Boosting for watch ended in failure, ret: %{public}d", static_cast(boostRet)); + } else { + MEDIA_LOGI("Boosting for watch ended successfully"); + } + } else { + MEDIA_LOGD("Non-watch detected, not boosting"); + } return Status::OK; } @@ -191,6 +215,18 @@ Status AVMetadataHelperImpl::SetSourceInternel(const std::string &uri, } CHECK_AND_RETURN_RET_LOG(ret == Status::OK, ret, "0x%{public}06" PRIXPTR " SetSourceInternel demuxer failed to call SetDataSource", FAKE_POINTER(this)); + bool isWatchDevice = mediaDemuxer_->IsWatchDevice(); + if (isWatchDevice) { + MEDIA_LOGI("Watch detected, boosting read thread priority"); + Status boostRet = mediaDemuxer_->BoostReadThreadPriority(); + if (boostRet != Status::OK) { + MEDIA_LOGW("Boosting ended in failure, ret: %{public}d", static_cast(boostRet)); + } else { + MEDIA_LOGI("Boosting ended successfully"); + } + } else { + MEDIA_LOGD("Non-watch detected, not boosting"); + } return Status::OK; }