jakibaki / In-Home-Switching

Allows you to stream your PC display to your Nintendo Switch!
GNU General Public License v3.0
440 stars 41 forks source link

Possible bug and possible small performance increase #23

Open NightlyFox opened 5 years ago

NightlyFox commented 5 years ago

I was looking at your guys code because it really interested me! Love your work, saw something and I thought I might point it out.

Based on your comment in the error thrown (in the picture below) I don’t think the return in the expect_frame_format function should be all ORs but AND them instead. By current OR logic the expect_frame_format would return true if width is equal and the other two values are not equal. So this would mean !expect_frame_format would return true only if all of the values are different, which I believe you is not the desired result. But instead the desired result is if just one value is different !expect_frame_format should return true. Which would mean the return should AND all values.

Also, in the expect_frame_format function, it seems like this would be called every frame? If so, would you really want to copy the width, height and pixel format onto the stack of the function each frame? That could effect performance some, if you instead directly compare it, it could possibly increase performance since you will no longer have to spend extra clock cycles copying width, height and pixel format each frame.

e8d27dbd-5759-43d4-a460-bff0159c0d3f