Experimental: Adding some fsanitize flags, a new example exe, a mutex on FFmpegReader::Close, and some additional clean-up code on AddImage (when a previous image exists)

This commit is contained in:
Jonathan Thomas
2022-07-27 15:33:40 -05:00
parent 01d16fe04a
commit 5ee38518da
4 changed files with 19 additions and 40 deletions

View File

@@ -23,50 +23,15 @@ using namespace openshot;
int main(int argc, char* argv[]) {
// Types for storing time durations in whole and fractional milliseconds
using ms = std::chrono::milliseconds;
using s = std::chrono::seconds;
using double_ms = std::chrono::duration<double, ms::period>;
// FFmpeg Reader performance test
const auto total_1 = std::chrono::high_resolution_clock::now();
FFmpegReader r9("/home/jonathan/Videos/sintel_trailer-1080p.mp4");
FFmpegReader r9("/home/jonathan/Downloads/pts-test-files/broken-files/lady-talking-1.mp4");
r9.Open();
for (long int frame = 1; frame <= 1000; frame++)
for (long int frame = 1; frame <= r9.info.video_length; frame++)
{
const auto time1 = std::chrono::high_resolution_clock::now();
std::cout << "Requesting Frame: #: " << frame << std::endl;
std::shared_ptr<Frame> f = r9.GetFrame(frame);
const auto time2 = std::chrono::high_resolution_clock::now();
std::cout << "FFmpegReader: " << frame
<< " (" << double_ms(time2 - time1).count() << " ms)\n";
}
const auto total_2 = std::chrono::high_resolution_clock::now();
auto total_sec = std::chrono::duration_cast<ms>(total_2 - total_1);
std::cout << "FFmpegReader TOTAL: " << total_sec.count() << " ms\n";
r9.Close();
// Timeline Reader performance test
Timeline tm(r9.info);
Clip *c = new Clip(&r9);
tm.AddClip(c);
tm.Open();
const auto total_3 = std::chrono::high_resolution_clock::now();
for (long int frame = 1; frame <= 1000; frame++)
{
const auto time1 = std::chrono::high_resolution_clock::now();
std::shared_ptr<Frame> f = tm.GetFrame(frame);
const auto time2 = std::chrono::high_resolution_clock::now();
std::cout << "Timeline: " << frame
<< " (" << double_ms(time2 - time1).count() << " ms)\n";
}
const auto total_4 = std::chrono::high_resolution_clock::now();
total_sec = std::chrono::duration_cast<ms>(total_4 - total_3);
std::cout << "Timeline TOTAL: " << total_sec.count() << " ms\n";
tm.Close();
std::cout << "Completed successfully!\n";
return 0;
exit(0);
}