Yalir / sfeMovie

sfeMovie is a simple C++ library that lets you play movies in SFML based applications. It relies on FFmpeg to read medias and remains consistent with SFML's naming conventions.
http://sfemovie.yalir.org/
GNU Lesser General Public License v2.1
114 stars 37 forks source link

faster check for empty status #93

Closed firefly2442 closed 9 years ago

firefly2442 commented 9 years ago

cppcheck found these. Basically, .empty() is a constant access speed whereas .size() is linear. Probably not a huge deal but I think it's also easier to read. As always, please double check this doesn't break anything. :)

Ceylo commented 9 years ago

Thanks for pointing out and the for the fix :) Just checked and it looks all good to me

Ceylo commented 9 years ago

In Stream.cpp line 201, the check you removed should have been kept: requestMoreData() updates the packet list. Hopefully it had visible consequences (big lag in video when seeking) so it could be fixed :)

firefly2442 commented 9 years ago

Ahh darn, sorry about that. It was the same conditional check so I was unsure why they were split like that.

Ceylo commented 9 years ago

Don't worry, I think the code is badly designed at the moment because it relies on "side effect", so easy to get fooled.