File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -132,17 +132,25 @@ FilterGraph::~FilterGraph()
132
132
avfilter_graph_free (&_graph);
133
133
}
134
134
135
+ size_t FilterGraph::getAvailableFrameSize (const std::vector<IFrame*>& inputs, const size_t & index)
136
+ {
137
+ size_t frameSize = inputs.at (index)->getDataSize ();
138
+ if (frameSize == 0 )
139
+ frameSize = _inputFramesBuffer.at (index).getDataSize ();
140
+ return frameSize;
141
+ }
142
+
135
143
size_t FilterGraph::getMinInputFrameSize (const std::vector<IFrame*>& inputs)
136
144
{
137
145
if (!inputs.size ())
138
146
return 0 ;
139
147
140
- int minFrameSize = inputs. at ( 0 )-> getDataSize ( );
148
+ size_t minFrameSize = getAvailableFrameSize (inputs, 0 );
141
149
for (size_t index = 1 ; index < inputs.size (); ++index)
142
150
{
143
- // if the input frame is shorter, and if there is no data enough into the corresponding frame buffer
144
- if (minFrameSize > inputs. at (index)-> getDataSize () && minFrameSize > _inputFramesBuffer. at (index). getDataSize () )
145
- minFrameSize = inputs. at (index)-> getDataSize () ;
151
+ const size_t availableFrameSize = getAvailableFrameSize (inputs, index);
152
+ if (minFrameSize > availableFrameSize )
153
+ minFrameSize = availableFrameSize ;
146
154
}
147
155
return minFrameSize;
148
156
}
Original file line number Diff line number Diff line change @@ -127,7 +127,15 @@ class AvExport FilterGraph
127
127
void addOutBuffer (const IFrame& output);
128
128
// @}
129
129
130
+ /* *
131
+ * @brief Return the input frame size if not null, or the available size into the corresponding frame buffer
132
+ */
133
+ size_t getAvailableFrameSize (const std::vector<IFrame*>& inputs, const size_t & index);
134
+ /* *
135
+ * @brief Get the minimum size between input frames, or available frame buffers
136
+ */
130
137
size_t getMinInputFrameSize (const std::vector<IFrame*>& inputs);
138
+
131
139
bool areInputFrameSizeEqual (const std::vector<IFrame*>& inputs);
132
140
bool areFrameBuffersEmpty ();
133
141
You can’t perform that action at this time.
0 commit comments