* kSubAttrWebvttCueAlign \n
* kSubAttrWebvttC
*/
- int32_t i32;
+ intptr_t i32;
/**
* @description String type subtitle atribute value.
/**
* @description Unsigned 32bit integer type subtitle attribute value.
*/
- uint32_t ui32;
+ uintptr_t ui32;
/**
* @description Unsigned 64bit integer type subtitle attribute value.
kVideoRenderer,
};
+enum class RscAllocPolicy {
+ kRscAllocExclusive,
+ kRscAllocConditional,
+ kRscAllocInAppMultiview,
+ kRscAllocExclusiveMfcForced
+};
+
struct ResourceProperty {
ResourceCategory category;
Track track;
+ RscAllocPolicy rsc_alloc_policy;
};
class Resource {
void SetVideoFrameBufferType(DecodedVideoFrameBufferType type) {
decoded_buffer_type_ = type;
}
+ void SetResourceAllocatePolicy(const RscAllocPolicy& policy) { rsc_alloc_policy_ = policy; };
GetDecodedVideoFrameState GetDecodedPacket(DecodedVideoPacket& packet);
bool ReturnDecodedPacket(const DecodedVideoPacket& packet);
bool EnableVideoHole(bool value);
std::unique_ptr<ResourceManager> resource_manager_;
std::unique_ptr<Display> display_;
+ RscAllocPolicy rsc_alloc_policy_ = RscAllocPolicy::kRscAllocExclusive;
GstCapsBuilder caps_builder_;
std::map<std::string, bool> properties_;
#include "trackrenderer/core/error.h"
#include "trackrenderer/core/event.h"
#include "trackrenderer/core/track.h"
+#include "trackrenderer/resource.h"
#include "trackrenderer_capi/buffer.h"
#include "trackrenderer_capi/decoderinputbuffer.h"
#include "trackrenderer_capi/display.h"
const TrackRendererDecodedVideoFrameBufferType& type);
TrackRendererGetDecodedVideoFrameState ConverToGetDecodedVideoFrameState(
const GetDecodedVideoFrameState state);
+RscAllocPolicy ConvertToRscAllocPolicy
+ (const TrackRendererRscAllocPolicy& policy);
} // namespace capi_utils
} // namespace trackrenderer
{ResourceCategory::kVideoDecoder, RM_CATEGORY_VIDEO_DECODER},
{ResourceCategory::kVideoRenderer, RM_CATEGORY_SCALER}};
+const std::map<RscAllocPolicy, rm_requests_resource_state_e>
+ TypeToResourceStateConverter = {
+ {RscAllocPolicy::kRscAllocExclusive, RM_STATE_EXCLUSIVE},
+ {RscAllocPolicy::kRscAllocConditional, RM_STATE_EXCLUSIVE_CONDITIONAL},
+ {RscAllocPolicy::kRscAllocInAppMultiview, RM_STATE_EXCLUSIVE},
+ {RscAllocPolicy::kRscAllocExclusiveMfcForced, RM_STATE_EXCLUSIVE}};
+
void AddRMHandle(ResourceManager *handle) {
TRACKRENDERER_INFO("Resource manager handle[%p]", handle);
std::lock_guard<std::mutex> lock(rsc_lock);
memset(&devices, 0, sizeof(rm_device_return_s));
req.request_num = 1;
- req.state[0] = RM_STATE_EXCLUSIVE;
+ req.state[0] = internal::TypeToResourceStateConverter.at(property.rsc_alloc_policy);
req.category_id[0] = internal::GetCategoryID(property);
req.category_option[0] = rc_get_capable_category_id(resourcemanager_handle_, app_id_.c_str(),category_id);
int rm_ret = rm_allocate_resources(resourcemanager_handle_, &req, &devices);
- if (rm_ret == RM_ERROR) {
- TRACKRENDERER_ERROR("[RM_ERROR] rm_allocate_resources fail");
+ if (rm_ret != RM_OK) {
+ TRACKRENDERER_ERROR("[RM_ERROR] rm_allocate_resources fail[%d] error type[%d]", rm_ret, devices.error_type);
return false;
}
if (track->type == kTrackTypeVideo) {
element = Elements::kDecVideo;
if (factory_type & GST_ELEMENT_FACTORY_TYPE_HARDWARE) {
- std::list<ResourceProperty> properties {{ ResourceCategory::kVideoDecoder, *track }};
+ std::list<ResourceProperty> properties {{ ResourceCategory::kVideoDecoder, *track, rsc_alloc_policy_ }, };
if (!resource_manager_->Acquire(properties)) {
TRACKRENDERER_ERROR("Failed to acquire video hw decoder resource");
return false;
const char* videosink_name = kFakeSinkName;
if (internal::IsDisplayNeeded(display_type)) {
videosink_name = kVideoSinkName;
- std::list<ResourceProperty> properties {{ ResourceCategory::kVideoRenderer, {} }};
+ std::list<ResourceProperty> properties {{ ResourceCategory::kVideoRenderer, {}, rsc_alloc_policy_ }};
if (!resource_manager_->Acquire(properties)) {
TRACKRENDERER_ERROR("Failed to acquire video hw renderer resource");
return false;
int trackrenderer_set_resource_allocate_policy(
TrackRendererHandle handle, TrackRendererRscAllocPolicy policy) {
- TRACKRENDERER_WARN("Not supported on Public");
+ auto priv = static_cast<TrackRendererPrivPtr>(handle);
+ if (!priv) return kFailed;
+
+ if (policy == kTrackRendererRscAllocInAppMultiview
+ || policy == kTrackRendererRscAllocExclusiveMfcForced) {
+ TRACKRENDERER_WARN("Not supported policy (%d) on Public", policy);
+ return kSuccess;
+ }
+
+ priv->renderer->SetResourceAllocatePolicy(
+ plusplayer::trackrenderer::capi_utils::ConvertToRscAllocPolicy(policy));
+
return kSuccess;
}
}
}
+RscAllocPolicy ConvertToRscAllocPolicy(
+ const TrackRendererRscAllocPolicy& policy) {
+ switch (policy) {
+ case kTrackRendererRscAllocExclusive:
+ return RscAllocPolicy::kRscAllocExclusive;
+ case kTrackRendererRscAllocConditional:
+ return RscAllocPolicy::kRscAllocConditional;
+ case kTrackRendererRscAllocInAppMultiview:
+ return RscAllocPolicy::kRscAllocInAppMultiview;
+ case kTrackRendererRscAllocExclusiveMfcForced:
+ return RscAllocPolicy::kRscAllocExclusiveMfcForced;
+ default:
+ TRACKRENDERER_ERROR("unknown policy");
+ return RscAllocPolicy::kRscAllocExclusive;
+ }
+}
+
} // namespace capi_utils
} // namespace trackrenderer