grigory-lobkov / rtsp-camera-view

View IP-camera RTSP in grid, auto bandwidth, full-screen, command line support
Apache License 2.0
201 stars 46 forks source link

Why Not Always Expected Switching Behavior? #36

Closed ghost closed 4 years ago

ghost commented 4 years ago

Hi and thanks for this project!

I added a couple of cameras to the grid. Double-clicked on one of them to expand to full screen. The camera switched to a stream of good quality. Then double-clicked again. And I noticed that the camera is still in good quality and does not return to the secondary stream even on a grid

Is it possible to get the expected behavior always: good quality of one camera if it is full screen. And the secondary (bad quality) stream for ALL cameras when they are not full screen grid?

fragtion commented 4 years ago

It seems there is a loop which compares the rtsp video feed Width & Height to the Width & Height of the viewer/player dimensions, and if the viewer dimensions are larger than the video stream dimensions, then it switches to HQ stream.

But sometimes the feed dimensions are larger than viewer dimensions for that video even if you are not in full screen mode but matrix mode, so the feed switches to (or remains on) HQ feed.

There also seems to be a conflict with the global stop/start timers which makes the switching less reliable..

For now I am using this workaround: Presenter\Presenters\SourcePresenter.cs (Replace function CheckNeedSwitch() (line #382)):

        private void CheckNeedSwitch()
        {
            if (log) View.Log("CheckNeedSwitch");
            if (_badH <= 0) { return; }
            if (View.Maximized)
            {
                if (_shownPlayer != _goodPlayer && _goodString != "" && _goodPlayer != null)
                {
                    if (_goodPlayer.IsPlaying) GoodPlaying();
                    else SwitchToGood();
                }
            }
            else
            {
                if (_shownPlayer != _badPlayer)
                {
                    if (_badPlayer.IsPlaying) BadPlaying();
                    else SwitchToBad();
                }
            }
        }

If you need compiled binary, let me know :)

ghost commented 4 years ago

@fragtion I'm not in a hurry. Let's hope the author accepts your corrections. Thanks for participating

grigory-lobkov commented 4 years ago

added in 1.0.3

fragtion commented 4 years ago

Greetings @grigory-lobkov I understand you are very busy! Thanks for the new release and bugfix 👍 Please note that git repo source was not updated to reflect the changes yet, and also source zip for v1.0.3 on the Releases page seems to be the source code for v1.0.2 (no changes?). Please will you push source changes to git when you have a moment:) Many thanks & Regards

grigory-lobkov commented 4 years ago

Sorry. Updated. Should I re-release it ? You can pull your requests - no problem) I thought a lot about this new function, how to do it: in camera or in program options. I have no such options window for now, and there is no other options to add there.

Of cause, this option will make user to think, that's why it's better to move it somewhere. Maybe it would be better to leave it only in config file...