fix: add copy on windows
This commit is contained in:
parent
0a97c09233
commit
7ab1554948
2 changed files with 5 additions and 5 deletions
|
|
@ -19,10 +19,10 @@ TextureRgba::~TextureRgba()
|
||||||
void TextureRgba::MarkVideoFrameAvailable(const std::vector<uint8_t>& buffer, size_t width, size_t height)
|
void TextureRgba::MarkVideoFrameAvailable(const std::vector<uint8_t>& buffer, size_t width, size_t height)
|
||||||
{
|
{
|
||||||
const std::lock_guard<std::mutex> lock(mutex_);
|
const std::lock_guard<std::mutex> lock(mutex_);
|
||||||
// FIXME: maybe without copy, it's easily crash with corrupt memory access.
|
// FIXME: remove copy.
|
||||||
// buffer_tmp_.resize(buffer.size());
|
buffer_tmp_.resize(buffer.size());
|
||||||
// std::copy(buffer.begin(), buffer.end(), buffer_tmp_.begin());
|
std::copy(buffer.begin(), buffer.end(), buffer_tmp_.begin());
|
||||||
flutter_pixel_buffer_.buffer = &buffer[0];
|
flutter_pixel_buffer_.buffer = &buffer_tmp_[0];
|
||||||
flutter_pixel_buffer_.width = width;
|
flutter_pixel_buffer_.width = width;
|
||||||
flutter_pixel_buffer_.height = height;
|
flutter_pixel_buffer_.height = height;
|
||||||
texture_registrar_->MarkTextureFrameAvailable(texture_id_);
|
texture_registrar_->MarkTextureFrameAvailable(texture_id_);
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,6 @@ private:
|
||||||
std::unique_ptr<flutter::TextureVariant> texture_ = nullptr;
|
std::unique_ptr<flutter::TextureVariant> texture_ = nullptr;
|
||||||
int64_t texture_id_;
|
int64_t texture_id_;
|
||||||
mutable std::mutex mutex_;
|
mutable std::mutex mutex_;
|
||||||
// std::vector<uint8_t> buffer_tmp_;
|
std::vector<uint8_t> buffer_tmp_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue