MCPcopy Create free account
hub / github.com/alibaba/CicadaPlayer / updateFrame

Method updateFrame

framework/render/video/glRender/YUVProgramContext.cpp:141–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141int YUVProgramContext::updateFrame(std::unique_ptr<IAFFrame> &frame) {
142
143 if (mProgram == 0) {
144 return -1;
145 }
146
147 int *lineSize = nullptr;
148
149 if (frame != nullptr) {
150 IAFFrame::videoInfo &videoInfo = frame->getInfo().video;
151 if (mFrameWidth != videoInfo.width || mFrameHeight != videoInfo.height ||
152 mDar != videoInfo.dar) {
153 mDar = videoInfo.dar;
154 mFrameWidth = videoInfo.width;
155 mFrameHeight = videoInfo.height;
156 mRegionChanged = true;
157 }
158
159 if (mCropRect.left != videoInfo.crop_left || mCropRect.right != videoInfo.crop_right ||
160 mCropRect.top != videoInfo.crop_top || mCropRect.bottom != videoInfo.crop_bottom) {
161 mCropRect = {videoInfo.crop_left, videoInfo.crop_right,
162 videoInfo.crop_top, videoInfo.crop_bottom};
163 mCoordsChanged = true;
164 }
165
166 lineSize = frame->getLineSize();
167 if (lineSize != nullptr && lineSize[0] != mLineSize[0]) {
168
169 mLineSize[0] = lineSize[0];
170 mLineSize[1] = lineSize[1];
171 mLineSize[2] = lineSize[2];
172
173 mCoordsChanged = true;
174 }
175
176 if(mColorSpace != videoInfo.colorSpace){
177 updateColorSpace();
178 mColorSpace = videoInfo.colorSpace;
179 }
180
181 if(mColorRange != videoInfo.colorRange){
182 updateColorRange();
183 mColorRange = videoInfo.colorRange;
184 }
185 }
186
187 if(frame == nullptr && !mProjectionChanged && !mRegionChanged && !mCoordsChanged && !mBackgroundColorChanged){
188 //frame is null and nothing changed , don`t need redraw. such as paused.
189 return -1;
190 }
191
192 bool rendered = false;
193 if (mRenderingCb) {
194 CicadaJSONItem params{};
195 rendered = mRenderingCb(mRenderingCbUserData, frame.get(), params);
196 }
197
198 if (rendered) {

Callers 1

renderActuallyMethod · 0.45

Calls 7

convertToGLColorFunction · 0.85
needProcessMethod · 0.80
getLineSizeMethod · 0.45
getMethod · 0.45
getDataMethod · 0.45
pushMethod · 0.45
pullMethod · 0.45

Tested by

no test coverage detected