Experimental: Adding more QImage clean-up logging, to track buffer addresses

This commit is contained in:
Jonathan Thomas
2022-07-26 21:40:28 -05:00
parent 2c193463ce
commit 01d16fe04a
3 changed files with 8 additions and 5 deletions

View File

@@ -1358,9 +1358,11 @@ void FFmpegReader::ProcessVideoPacket(int64_t requested_frame) {
// Add Image data to frame
if (!ffmpeg_has_alpha(AV_GET_CODEC_PIXEL_FORMAT(pStream, pCodecCtx))) {
// Add image with no alpha channel, Speed optimization
std::cout << "FFmpegReader::ProcessVideoPacket (A AddImage for frame: " << f->number << ", buffer: " << ( void * )&buffer[0] << ")" << std::endl;
f->AddImage(width, height, bytes_per_pixel, QImage::Format_RGBA8888_Premultiplied, buffer);
} else {
// Add image with alpha channel (this will be converted to premultipled when needed, but is slower)
std::cout << "FFmpegReader::ProcessVideoPacket (B AddImage for frame: " << f->number << ", buffer: " << ( void * )&buffer[0] << ")" << std::endl;
f->AddImage(width, height, bytes_per_pixel, QImage::Format_RGBA8888, buffer);
}

View File

@@ -763,6 +763,7 @@ void Frame::AddImage(
(QImageCleanupFunction) &openshot::cleanUpBuffer,
(void*) pixels_
);
std::cout << "Frame::AddImage, number: " << number << ", Cleanup buffer: " << ( void * )&pixels_[0] << ", width: " << new_width << ", height: " << new_height << std::endl;
AddImage(new_image);
}

View File

@@ -29,14 +29,14 @@ namespace openshot {
// Clean up buffer after QImage is deleted
static inline void cleanUpBuffer(void *info)
{
std::cout << "--> cleanUpBuffer, info: " << info << std::endl;
std::cout << "--> cleanUpBuffer" << std::endl;
if (!info)
return;
// Remove buffer since QImage tells us to
std::cout << "--> reinterpret cast, info: " << info << std::endl;
auto* qbuffer = reinterpret_cast<unsigned char*>(info);
std::cout << "--> delete pointer, info: " << info << std::endl;
//delete[] qbuffer;
std::cout << "--> reinterpret cast" << std::endl;
uint8_t *qbuffer = reinterpret_cast<uint8_t *>(info);
std::cout << "--> delete pointer, buffer: " << ( void * )&qbuffer[0] << std::endl;
delete[] qbuffer;
}
} // namespace