win test commit (#2)
Signed-off-by: fufesou <shuanglongchen@yeah.net> Co-authored-by: fufesou <shuanglongchen@yeah.net> Co-authored-by: fufesou <fufesou@users.noreply.github.com>
This commit is contained in:
parent
35e480aa73
commit
e118e96341
4 changed files with 57 additions and 20 deletions
|
|
@ -1,7 +1,45 @@
|
|||
#include <flutter/texture_registrar.h>
|
||||
#include <mutex>
|
||||
#include <chrono>
|
||||
|
||||
#pragma once
|
||||
|
||||
using namespace std;
|
||||
using namespace std::chrono;
|
||||
class Timer
|
||||
{
|
||||
public:
|
||||
Timer() : m_begin(high_resolution_clock::now()) {}
|
||||
void reset() { m_begin = high_resolution_clock::now(); }
|
||||
int64_t elapsed() const
|
||||
{
|
||||
return duration_cast<chrono::milliseconds>(high_resolution_clock::now() - m_begin).count();
|
||||
}
|
||||
int64_t elapsed_micro() const
|
||||
{
|
||||
return duration_cast<chrono::microseconds>(high_resolution_clock::now() - m_begin).count();
|
||||
}
|
||||
int64_t elapsed_nano() const
|
||||
{
|
||||
return duration_cast<chrono::nanoseconds>(high_resolution_clock::now() - m_begin).count();
|
||||
}
|
||||
int64_t elapsed_seconds() const
|
||||
{
|
||||
return duration_cast<chrono::seconds>(high_resolution_clock::now() - m_begin).count();
|
||||
}
|
||||
int64_t elapsed_minutes() const
|
||||
{
|
||||
return duration_cast<chrono::minutes>(high_resolution_clock::now() - m_begin).count();
|
||||
}
|
||||
int64_t elapsed_hours() const
|
||||
{
|
||||
return duration_cast<chrono::hours>(high_resolution_clock::now() - m_begin).count();
|
||||
}
|
||||
private:
|
||||
time_point<high_resolution_clock> m_begin;
|
||||
};
|
||||
|
||||
|
||||
class TextureRgba
|
||||
{
|
||||
public:
|
||||
|
|
@ -10,8 +48,6 @@ public:
|
|||
|
||||
void MarkVideoFrameAvailable(std::vector<uint8_t>& buffer, size_t width, size_t height);
|
||||
|
||||
void MarkVideoFrameAvailablePtr(const uint8_t* buffer, size_t width, size_t height);
|
||||
|
||||
int64_t texture_id() const { return texture_id_; };
|
||||
|
||||
const FlutterDesktopPixelBuffer* buffer();
|
||||
|
|
@ -23,5 +59,6 @@ private:
|
|||
int64_t texture_id_;
|
||||
mutable std::mutex mutex_;
|
||||
std::vector<uint8_t> buffer_tmp_;
|
||||
Timer timer_;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue