You have to explain what happens here: m_videoFrame = frame;
Imagine that the video surface does not copy VideoFrame(so no increased count usage, he directly use it, and render its content)
m_videoSurface->present( newFrame );
the present method take it as const reference
Take a look at the following code, maybe then you see my problem:
Code: Select all
void render(const std::shared_ptr<int>& foo)
{
std::cout << foo.use_count(); // this would be zero, when called at the same time, although the ptr goes in with use count 1
}
int main() {
std::shared_ptr<int> p1( new int( 0 ) );
p1.reset(new int( 1 )); // the same like m_videoFrame = frame;
render(p1); // imagine that this is called at the same time like the statement above
return 0;
}