From efbcef28616bd5601cb32d1c1d9fd8300509b969 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Thu, 3 Oct 2024 17:09:46 +0200 Subject: [PATCH] wivrn namespace: client/decoder/shard_accumulator --- client/decoder/android/android_decoder.h | 3 +++ client/decoder/ffmpeg/ffmpeg_decoder.h | 5 ++++- client/decoder/shard_accumulator.cpp | 4 ++++ client/decoder/shard_accumulator.h | 4 ++++ client/scenes/stream.h | 14 +++++++------- 5 files changed, 22 insertions(+), 8 deletions(-) diff --git a/client/decoder/android/android_decoder.h b/client/decoder/android/android_decoder.h index ec152580..23c35a29 100644 --- a/client/decoder/android/android_decoder.h +++ b/client/decoder/android/android_decoder.h @@ -46,7 +46,10 @@ DEUGLIFY(AImage) DEUGLIFY(AImageReader) DEUGLIFY(AMediaCodec) +namespace wivrn +{ class shard_accumulator; +} namespace scenes { diff --git a/client/decoder/ffmpeg/ffmpeg_decoder.h b/client/decoder/ffmpeg/ffmpeg_decoder.h index f90d962d..34f00bbc 100644 --- a/client/decoder/ffmpeg/ffmpeg_decoder.h +++ b/client/decoder/ffmpeg/ffmpeg_decoder.h @@ -27,7 +27,10 @@ #include #include +namespace wivrn +{ class shard_accumulator; +} extern "C" { @@ -126,4 +129,4 @@ public: static std::vector supported_codecs(); }; -} // namespace ffmpeg +} // namespace wivrn::ffmpeg diff --git a/client/decoder/shard_accumulator.cpp b/client/decoder/shard_accumulator.cpp index 22dac398..495a7e3d 100644 --- a/client/decoder/shard_accumulator.cpp +++ b/client/decoder/shard_accumulator.cpp @@ -22,6 +22,9 @@ #include "scenes/stream.h" #include "spdlog/spdlog.h" +namespace wivrn +{ + using namespace wivrn::to_headset; using shard_set = shard_accumulator::shard_set; using data_shard = shard_accumulator::data_shard; @@ -211,3 +214,4 @@ void shard_accumulator::send_feedback(wivrn::from_headset::feedback & feedback) if (scene) scene->send_feedback(feedback); } +} // namespace wivrn diff --git a/client/decoder/shard_accumulator.h b/client/decoder/shard_accumulator.h index e63ce4b0..4777de7f 100644 --- a/client/decoder/shard_accumulator.h +++ b/client/decoder/shard_accumulator.h @@ -34,6 +34,9 @@ using decoder_impl = ::wivrn::ffmpeg::decoder; #include #include +namespace wivrn +{ + class shard_accumulator { std::shared_ptr decoder; @@ -109,3 +112,4 @@ private: void send_feedback(wivrn::from_headset::feedback & feedback); void advance(); }; +} // namespace wivrn diff --git a/client/scenes/stream.h b/client/scenes/stream.h index 33b3f02b..9c47dff5 100644 --- a/client/scenes/stream.h +++ b/client/scenes/stream.h @@ -52,15 +52,15 @@ private: struct accumulator_images { - std::unique_ptr decoder; + std::unique_ptr decoder; vk::raii::DescriptorSetLayout descriptor_set_layout = nullptr; vk::DescriptorSet descriptor_set = nullptr; vk::raii::PipelineLayout blit_pipeline_layout = nullptr; vk::raii::Pipeline blit_pipeline = nullptr; // latest frames from oldest to most recent - std::array, image_buffer_size> latest_frames; + std::array, image_buffer_size> latest_frames; - std::shared_ptr frame(std::optional id) const; + std::shared_ptr frame(std::optional id) const; std::vector frames() const; }; @@ -68,7 +68,7 @@ private: // for frames inside accumulator images std::mutex frames_mutex; - std::vector> common_frame(XrTime display_time); + std::vector> common_frame(XrTime display_time); struct renderpass_output { @@ -125,7 +125,7 @@ private: XrAction plots_toggle_2 = XR_NULL_HANDLE; // Keep a reference to the resources needed to blit the images until vkWaitForFences - std::vector> current_blit_handles; + std::vector> current_blit_handles; stream() = default; @@ -147,7 +147,7 @@ public: void operator()(to_headset::video_stream_description &&); void operator()(audio_data &&); - void push_blit_handle(shard_accumulator * decoder, std::shared_ptr handle); + void push_blit_handle(wivrn::shard_accumulator * decoder, std::shared_ptr handle); void send_feedback(const wivrn::from_headset::feedback & feedback); @@ -231,7 +231,7 @@ private: XrTime last_metric_time = 0; int metrics_offset = 0; - void accumulate_metrics(XrTime predicted_display_time, const std::vector> & blit_handles, const gpu_timestamps & timestamps); + void accumulate_metrics(XrTime predicted_display_time, const std::vector> & blit_handles, const gpu_timestamps & timestamps); XrCompositionLayerQuad plot_performance_metrics(XrTime predicted_display_time); void on_reference_space_changed(XrReferenceSpaceType space, XrTime) override; };