diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-12-08 10:22:59 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-12-08 12:17:14 +0000 |
commit | 69b8f9169ffd66fdeca1ac60a4bc06b91d106186 (patch) | |
tree | c8b7f735583d0b4e0c0b61a014a7f4b3b26e85ab /chromium/extensions/browser/api/media_perception_private/conversion_utils.cc | |
parent | daa093eea7c773db06799a13bd7e4e2e2a9f8f14 (diff) | |
download | qtwebengine-chromium-69b8f9169ffd66fdeca1ac60a4bc06b91d106186.tar.gz |
BASELINE: Update Chromium to 63.0.3239.87
Change-Id: Iac27464730121b4fac76869d87d622504642e016
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'chromium/extensions/browser/api/media_perception_private/conversion_utils.cc')
-rw-r--r-- | chromium/extensions/browser/api/media_perception_private/conversion_utils.cc | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/chromium/extensions/browser/api/media_perception_private/conversion_utils.cc b/chromium/extensions/browser/api/media_perception_private/conversion_utils.cc index 8ea457ea397..f8849a4b051 100644 --- a/chromium/extensions/browser/api/media_perception_private/conversion_utils.cc +++ b/chromium/extensions/browser/api/media_perception_private/conversion_utils.cc @@ -77,6 +77,8 @@ EntityType EntityTypeProtoToIdl(const mri::Entity& entity) { return ENTITY_TYPE_PERSON; case mri::Entity::MOTION_REGION: return ENTITY_TYPE_MOTION_REGION; + case mri::Entity::LABELED_REGION: + return ENTITY_TYPE_LABELED_REGION; case mri::Entity::UNSPECIFIED: return ENTITY_TYPE_UNSPECIFIED; } @@ -100,9 +102,29 @@ Entity EntityProtoToIdl(const mri::Entity& entity) { if (entity.has_depth()) entity_result.depth = DistanceProtoToIdl(entity.depth()); + if (entity.has_label()) + entity_result.entity_label = std::make_unique<std::string>(entity.label()); + return entity_result; } +PacketLatency PacketLatencyProtoToIdl( + const mri::PacketLatency& packet_latency) { + PacketLatency packet_latency_result; + + if (packet_latency.has_label()) { + packet_latency_result.packet_label = + std::make_unique<std::string>(packet_latency.label()); + } + + if (packet_latency.has_latency_usec()) { + packet_latency_result.latency_usec = + std::make_unique<int>(packet_latency.latency_usec()); + } + + return packet_latency_result; +} + FramePerception FramePerceptionProtoToIdl( const mri::FramePerception& frame_perception) { FramePerception frame_perception_result; @@ -127,6 +149,14 @@ FramePerception FramePerceptionProtoToIdl( for (const auto& entity : frame_perception.entity()) frame_perception_result.entities->emplace_back(EntityProtoToIdl(entity)); } + if (frame_perception.packet_latency_size() > 0) { + frame_perception_result.packet_latency = + std::make_unique<std::vector<PacketLatency>>(); + for (const auto& packet_latency : frame_perception.packet_latency()) { + frame_perception_result.packet_latency->emplace_back( + PacketLatencyProtoToIdl(packet_latency)); + } + } return frame_perception_result; } @@ -223,6 +253,24 @@ mri::State::Status StateStatusIdlToProto(const State& state) { return mri::State::STATUS_UNSPECIFIED; } +void VideoStreamParamIdlToProto(mri::VideoStreamParam* param_result, + const VideoStreamParam& param) { + if (param_result == nullptr) + return; + + if (param.id) + param_result->set_id(*param.id); + + if (param.width) + param_result->set_width(*param.width); + + if (param.height) + param_result->set_height(*param.height); + + if (param.frame_rate) + param_result->set_frame_rate(*param.frame_rate); +} + } // namespace State StateProtoToIdl(const mri::State& state) { @@ -243,6 +291,15 @@ mri::State StateIdlToProto(const State& state) { if (state.device_context) state_result.set_device_context(*state.device_context); + if (state.video_stream_param && state.video_stream_param.get() != nullptr) { + for (size_t i = 0; i < state.video_stream_param.get()->size(); ++i) { + mri::VideoStreamParam* video_stream_param_result = + state_result.add_video_stream_param(); + VideoStreamParamIdlToProto(video_stream_param_result, + state.video_stream_param.get()->at(i)); + } + } + return state_result; } |