correctly move buffer
Some checks failed
ContinuousDelivery / linux-ubuntu (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousDelivery / windows (windows-2022, ) (push) Has been cancelled
ContinuousDelivery / windows (windows-2022, asan) (push) Has been cancelled
ContinuousDelivery / dumpsyms (push) Has been cancelled
ContinuousDelivery / release (push) Has been cancelled
ContinuousIntegration / on ubuntu-24.04-arm (push) Has been cancelled
ContinuousIntegration / asan on ubuntu-24.04-arm (push) Has been cancelled
ContinuousIntegration / on ubuntu-latest (push) Has been cancelled
ContinuousIntegration / asan on ubuntu-latest (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousIntegration / macos (push) Has been cancelled
ContinuousIntegration / windows (push) Has been cancelled

other fixes
This commit is contained in:
Green Sky
2025-12-19 16:06:50 +01:00
parent aef9593095
commit 811a673b0d
4 changed files with 23 additions and 3 deletions

View File

@@ -24,6 +24,24 @@ struct AudioFrame2 {
Span<int16_t> // non owning variant, for direct consumption Span<int16_t> // non owning variant, for direct consumption
> buffer; > buffer;
AudioFrame2(void) = default;
AudioFrame2(const AudioFrame2&) = default;
AudioFrame2(AudioFrame2&& other) :
sample_rate(other.sample_rate),
channels(other.channels),
buffer(std::move(other.buffer))
{}
AudioFrame2(uint32_t sample_rate_, size_t channels_, const std::variant<std::vector<int16_t>, Span<int16_t>>& buffer_) :
sample_rate(sample_rate_),
channels(channels_),
buffer(buffer_)
{}
AudioFrame2(uint32_t sample_rate_, size_t channels_, std::variant<std::vector<int16_t>, Span<int16_t>>&& buffer_) :
sample_rate(sample_rate_),
channels(channels_),
buffer(std::move(buffer_))
{}
// helpers // helpers
Span<int16_t> getSpan(void) const { Span<int16_t> getSpan(void) const {
if (std::holds_alternative<std::vector<int16_t>>(buffer)) { if (std::holds_alternative<std::vector<int16_t>>(buffer)) {

View File

@@ -28,7 +28,7 @@ struct LockedFrameStream2 : public FrameStream2I<FrameType> {
FrameType new_frame = std::move(_frames.front()); FrameType new_frame = std::move(_frames.front());
_frames.pop_front(); _frames.pop_front();
return std::move(new_frame); return new_frame;
} }
bool push(const FrameType& value) { bool push(const FrameType& value) {

View File

@@ -7,7 +7,7 @@
#include "../audio_stream_pop_reframer.hpp" #include "../audio_stream_pop_reframer.hpp"
// "thin" wrapper around sdl audio streams // "thin" wrapper around sdl audio streams
// we dont needs to get fance, as they already provide everything we need // we dont needs to get fancy, as they already provide everything we need
struct SDLAudio2StreamReader : public AudioFrame2Stream2I { struct SDLAudio2StreamReader : public AudioFrame2Stream2I {
std::unique_ptr<SDL_AudioStream, decltype(&SDL_DestroyAudioStream)> _stream; std::unique_ptr<SDL_AudioStream, decltype(&SDL_DestroyAudioStream)> _stream;

View File

@@ -15,11 +15,13 @@
#include "./start_screen.hpp" #include "./start_screen.hpp"
#ifdef __ANDROID__
#include <filesystem> #include <filesystem>
#endif
#include <memory> #include <memory>
#include <iostream> #include <iostream>
#include <string_view> #include <string_view>
#include <thread>
#include <chrono> #include <chrono>
#ifdef TOMATO_BREAKPAD #ifdef TOMATO_BREAKPAD