Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ SnapshotManager::~SnapshotManager(){
}
SnapshotManager::SnapshotManager(Logger& logger, QVideoFrameCache& cache)
: m_logger(logger)
, m_converter(logger)
, m_cache(cache)
, m_stats_conversion("ConvertFrame", "ms", 1000, std::chrono::seconds(10))
{}
Expand All @@ -46,9 +47,10 @@ VideoSnapshot SnapshotManager::convert(QVideoFrame frame, WallClock timestamp) n
snapshot.timestamp = timestamp;
try{
WallClock time0 = current_time();
snapshot.frame = std::make_shared<const ImageRGB32>(
QImage_to_ImageRGB32(frame_to_image(frame))
);
// Not QVideoFrame::toImage() once the own conversion matched it:
// memory grows with each toImage() on some computers
// (VideoFrameConversion.h).
snapshot.frame = std::make_shared<const ImageRGB32>(m_converter.convert(frame));
WallClock time1 = current_time();
WriteSpinLock lg(m_stats_lock);
m_stats_conversion.report_data(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "CommonFramework/Tools/StatAccumulator.h"
#include "CommonFramework/VideoPipeline/VideoFeed.h"
#include "QVideoFrameCache.h"
#include "VideoFrameConversion.h"

namespace PokemonAutomation{

Expand Down Expand Up @@ -47,6 +48,7 @@ class SnapshotManager{

private:
Logger& m_logger;
VideoFrameConverter m_converter;
QVideoFrameCache& m_cache;

Mutex m_lock;
Expand Down
Loading