File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,12 @@ class AvExport VideoFrame : public Frame
70
70
* @brief Allocate the image buffer of the frame.
71
71
*/
72
72
void allocateAVPicture (const VideoFrameDesc& desc);
73
+
74
+ /* *
75
+ * @note To allocate new image buffer if needed.
76
+ * @see allocateAVPicture
77
+ */
78
+ friend class VideoGenerator ;
73
79
};
74
80
}
75
81
Original file line number Diff line number Diff line change @@ -37,6 +37,14 @@ VideoGenerator::~VideoGenerator()
37
37
38
38
bool VideoGenerator::decodeNextFrame (Frame& frameBuffer)
39
39
{
40
+ // check the given frame
41
+ if (!frameBuffer.isVideoFrame ())
42
+ {
43
+ LOG_WARN (" The given frame is not a valid video frame: allocate a new AVPicture to put generated data into it." );
44
+ frameBuffer.clear ();
45
+ static_cast <VideoFrame&>(frameBuffer).allocateAVPicture (_frameDesc);
46
+ }
47
+
40
48
// Generate black image
41
49
if (!_inputFrame)
42
50
{
You can’t perform that action at this time.
0 commit comments