Add device server#4
Merged
Merged
Conversation
Closed
mat-hek
approved these changes
Dec 22, 2025
Comment on lines
+4
to
+7
|
|
||
| @impl true | ||
| def start(_start_type, _start_args) do | ||
| GenServer.start_link(Membrane.VKVideo.DeviceServer, nil, name: DeviceServer) |
Member
There was a problem hiding this comment.
Suggested change
| @impl true | |
| def start(_start_type, _start_args) do | |
| GenServer.start_link(Membrane.VKVideo.DeviceServer, nil, name: DeviceServer) | |
| alias Membrane.VKVideo.DeviceServer | |
| @impl true | |
| def start(_start_type, _start_args) do | |
| GenServer.start_link(DeviceServer, [], name: DeviceServer) |
|
|
||
| @spec get_device() :: {:ok, Native.t()} | no_return() | ||
| def get_device() do | ||
| GenServer.call(DeviceServer, :get_device) |
Member
There was a problem hiding this comment.
Suggested change
| GenServer.call(DeviceServer, :get_device) | |
| GenServer.call(__MODULE__, :get_device) |
mat-hek
reviewed
Dec 22, 2025
| .map_err(|err| Error::RaiseTerm(Box::new(err.to_string())))?; | ||
|
|
||
| let device_resource = ResourceArc::new(Resource::Device(DeviceResource { device })); | ||
| Ok((ok(), device_resource)) |
Member
There was a problem hiding this comment.
What's the point of wrapping the device in the ok tuple?
Collaborator
Author
There was a problem hiding this comment.
it's just for the sake of convention, all the resources are returned in an ok tuple
varsill
added a commit
that referenced
this pull request
Dec 23, 2025
* Puts encoder and decoder into a single NIF * Make Resource an Enum * Fix function names * Add device server (#4) * Add create_device * Fix the resource * Add Device server and destroy function --- Co-authored-by: Jerzy Wilczek <jerzy.wilczek@swmansion.com>
varsill
added a commit
that referenced
this pull request
Jan 9, 2026
* Return error message from all vk-video errors. Update typespecs. Add handling of tune in the encoder * Add RateControl option * Add test checking different configuration of the encoder. Raise errors instead of returning the error tuple * Use DirtyIo scheduler for all NIF functions. Adjust tests to new filename * Add :requires_gpu tag to encoder tests * Add encoder element * Update typespecs. Add tests for encoder. Add support for RateControl * Add more tests for encoder * Add docs for rate control structs * Put encoder and decoder into a single NIF. (#3) * Make Resource an Enum * Add device server (#4) * Add create_device * Add Device server and destroy function * Fallback to 30 and warn if the framerate is needed but not provided via stream format nor options --------- Co-authored-by: Jerzy Wilczek <jerzy.wilczek@swmansion.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR:
destroyfunction so that NIF resource can be explicitly freed before GC decides to free it (a workaround to solve a problem with too many encoders spawned at once in test)