Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to turn off video completely #295

Closed
wants to merge 1 commit into from

Conversation

AndreiNekrasOn
Copy link
Contributor

In #154 you wrote:

Yes, as an experimental option. What I am actually planning is to pause framebuffer updates whenever AVNC is in background. It should reduce battery/bandwidth usage for everybody <...> Turning off video completely will be an extension of this.

However, there's no option to turn off video completely yet. I've made an attempt to achieve this by adding an option "Disable image updates" to the server profile, and with this on the received image stops rendering.

All the control is still available to the user (e.g. using keyboard/virtual keyboard, touchpad or touchscreen).

I understand that the "full remote control" is not the intended feature for this app, but the change seems simple enough to support it, since it's a common request.

@gujjwal00
Copy link
Owner

As I said in the linked issue and you noted in the help, with this option, framebuffer updates will still be received. So network will still be utilized, CPU will still have to decode the updates, and a frame will still be rendered on GPU - even if it is a black screen. Hence, I don't think this will be a power saver with current implementation.

Since the main motivation is to conserve power, you should utilize pausing/resuming of framebuffer updates. It stops AVNC from asking for framebuffer updates, and should result in measurable power savings.

Comment on lines +91 to 98
/**
* Stop rendering frame buffer.
* This can save battery while still allowing control of the remote device.
*/
@ColumnInfo(defaultValue = "0")
var disableImageUpdates: Boolean = false,

/**
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this filed changes database schema, but you haven't increased the database version and added a migration in MainDb. So this will crash the app for existing users on original database schema.

Since this is a simple boolean flag, you should implement it similar to these flags. This will not not change database schema, and will be much simpler.

@@ -34,6 +34,7 @@ class EditorViewModel(app: Application, state: SavedStateHandle, initialProfile:
val useRepeater = state.getLiveData("useRepeater", profile.useRepeater)
val idOnRepeater = state.getLiveData("idOnRepeater", if (profile.useRepeater) profile.idOnRepeater.toString() else "")
val useRawEncoding = state.getLiveData("useRawEncoding", profile.useRawEncoding)
val disableImageUpdates = state.getLiveData("disableImageUpdates", profile.disableImageUpdates)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since disableImageUpdates is a simple flag, you don't have to create LiveData for this. You can directly bind to the profile field like this:

 android:checked="@={viewModel.profile.disableImageUpdates}"                    

@AndreiNekrasOn
Copy link
Contributor Author

So network will still be utilized, CPU will still have to decode the updates, and a frame will still be rendered on GPU - even if it is a black screen. Hence, I don't think this will be a power saver with current implementation.

To confirm this I've ran the profiler in android studio. In both scenarios I've connected to the VNC server with the lowest possible image quality, and the only difference was disableImageUpdates setting. The screen on the host machine was running the profiler in android studio in both cases.
I've found that the graphics memory usage is 30% less with this setting, while all the other resources seem to be the same. I understand that in no way this is a rigorous test, but I do believe it's good enough for demo.

disableImageUpdates=false
avnc-regular
disableImageUpdates=true
avnc-stop

If this seems good enough to include in the app, I would be happy to fix your comments. Otherwise, I understand and the PR can be closed. Either way, I'm grateful for the consideration.

@gujjwal00
Copy link
Owner

I've found that the graphics memory usage is 30% less with this setting,

That is expected. Since render function quits early, it doesn't allocate the texture in GPU memory to hold framebuffer data.

Just for comparison, here is the result from a similar test with framebuffer updates paused:

image

Notice how the CPU usage of AVNC drops to zero because its not doing anything.

If this seems good enough to include in the app, I would be happy to fix your comments. Otherwise, I understand and the PR can be closed. Either way, I'm grateful for the consideration.

As it stands, this is just a simple checkbox which, IMHO, doesn't serve the intended purpose of saving power. So sorry, but I am not going to merge this.

@gujjwal00 gujjwal00 closed this Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants