Skip to content
Snippets Groups Projects
Commit e350d1b5 authored by Philippe Gorley's avatar Philippe Gorley Committed by Guillaume Roguez
Browse files

accel: clarify usage of extractData callback


Moves the frame reference switch to the extractData wrapper function
to clarify that the output frame received in the callback is indeed
an output and not a temporary frame.

Change-Id: Ic21a3a7517647d263621b23debe1a4fb7f810a8e
Reviewed-by: default avatarGuillaume Roguez <guillaume.roguez@savoirfairelinux.com>
parent 9df12e2f
No related branches found
No related tags found
No related merge requests found
......@@ -124,8 +124,12 @@ HardwareAccel::extractData(VideoFrame& input)
auto outFrame = output->pointer();
outFrame->format = AV_PIX_FMT_YUV420P;
// call the acceleration's implementation
extractData(input, *output);
// move outFrame into inFrame so the caller receives extracted image data
// but we have to delete inFrame first
av_frame_unref(inFrame);
av_frame_move_ref(inFrame, outFrame);
} catch (const std::runtime_error& e) {
fail(false);
RING_ERR("%s", e.what());
......
......@@ -53,8 +53,6 @@ class HardwareAccel {
virtual bool check() = 0;
virtual bool init() = 0;
virtual int allocateBuffer(AVFrame* frame, int flags) = 0;
// The reference to the extracted frame should be moved to input
// as that's the frame returned to the MediaDecoder
virtual void extractData(VideoFrame& input, VideoFrame& output) = 0;
protected:
......
......@@ -71,9 +71,6 @@ VaapiAccel::extractData(VideoFrame& input, VideoFrame& output)
if (av_frame_copy_props(outFrame, inFrame) < 0 ) {
av_frame_unref(outFrame);
}
av_frame_unref(inFrame);
av_frame_move_ref(inFrame, outFrame);
}
bool
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment