mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-03-31 20:23:20 -04:00
Allocate the temp frame inside Assign, instead of keeping it around.
This commit is contained in:
@@ -348,11 +348,6 @@ bool Image::Assign(const AVFrame *frame) {
|
||||
|
||||
// Desired format
|
||||
AVPixelFormat format = (AVPixelFormat)AVPixFormat();
|
||||
av_frame_ptr dest_frame{av_frame_alloc()};
|
||||
if (!dest_frame) {
|
||||
Error("Unable to allocate destination frame");
|
||||
return false;
|
||||
}
|
||||
sws_convert_context = sws_getCachedContext(
|
||||
sws_convert_context,
|
||||
frame->width, frame->height, (AVPixelFormat)frame->format,
|
||||
@@ -364,13 +359,18 @@ bool Image::Assign(const AVFrame *frame) {
|
||||
Error("Unable to create conversion context");
|
||||
return false;
|
||||
}
|
||||
bool result = Assign(frame, sws_convert_context, dest_frame.get());
|
||||
bool result = Assign(frame, sws_convert_context);
|
||||
update_function_pointers();
|
||||
return result;
|
||||
} // end Image::Assign(const AVFrame *frame)
|
||||
|
||||
bool Image::Assign(const AVFrame *frame, SwsContext *convert_context, AVFrame *temp_frame) {
|
||||
PopulateFrame(temp_frame);
|
||||
bool Image::Assign(const AVFrame *frame, SwsContext *convert_context) {
|
||||
av_frame_ptr temp_frame{av_frame_alloc()};
|
||||
if (!temp_frame) {
|
||||
Error("Unable to allocate destination frame");
|
||||
return false;
|
||||
}
|
||||
PopulateFrame(temp_frame.get());
|
||||
zm_dump_video_frame(frame, "source frame before convert");
|
||||
temp_frame->pts = frame->pts;
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ class Image {
|
||||
const size_t buffer_size);
|
||||
void Assign(const Image &image);
|
||||
bool Assign(const AVFrame *frame);
|
||||
bool Assign(const AVFrame *frame, SwsContext *convert_context, AVFrame *temp_frame);
|
||||
bool Assign(const AVFrame *frame, SwsContext *convert_context);
|
||||
void AssignDirect(
|
||||
const unsigned int p_width,
|
||||
const unsigned int p_height,
|
||||
|
||||
Reference in New Issue
Block a user