-
Notifications
You must be signed in to change notification settings - Fork 1
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
RSDK-8647 - Add save do_command #6
Conversation
Should we review POC first? |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to be a giant model, I like how you're broken out the file into concater and segmented, can I request that we break out the setup functionality (registration, validation, creator and close) into it's own file too?
I would like to add tests at this point to lock in some of your utils and Validation functionality.
I will look at cam.go
in a separate review.
@@ -19,37 +19,43 @@ import ( | |||
) | |||
|
|||
// Model is the model for the video storage camera component. | |||
// TODO(seanp): Personal module for now, should be movied to viam module in prod. | |||
// TODO(seanp): Personal module for now, should be moved to viam module in prod. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's in viam-modules now.
uploadPath string | ||
name resource.Name | ||
conf *Config | ||
logger logging.Logger | ||
|
||
cam camera.Camera | ||
stream gostream.VideoStream | ||
|
||
workers rdkutils.StoppableWorkers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you bump rdk, which I suggest you do you'll hae to get this from goutils goutils.NewBackgroudnWorkers
is the creator function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched to latest NewBackgroundWorkes in goutils.
"storage": { | ||
"clip_seconds": 30, | ||
"segment_seconds": 30, | ||
"size_gb": 100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the save
DoCommand have an optional directory for video storage and sync upload?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not in do_command, those are optional attrs in the module - will include it in the README example.
"additional_sync_paths": [ | ||
"/home/viam/.viam/video-upload/" | ||
], | ||
"additional_sync_paths": [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call out that this is custom, as stated in the scope, right now there's no clue as to why this is int he example config.
defaultStoragePath = ".viam/video-storage" | ||
|
||
defaultLogLevel = "info" | ||
deleterInterval = 60 // seconds | ||
) | ||
|
||
type videostore struct { | ||
resource.AlwaysRebuild | ||
resource.TriviallyCloseable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have a Close
implemented, which is what I expect since we're going on and on on a loop saving video. You can delete this line, which just returns nil when you call close.
resource.TriviallyCloseable |
ffmppegLogLevel(logLevel) | ||
|
||
// Create encoder to handle encoding of frames. | ||
// TODO(seanp): Forcing h264 for now until h265 is supported. | ||
if newConf.Video.Codec != "h264" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's premptively factor this into an enum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, added enum+handlers for codec type.
@@ -138,7 +144,6 @@ func newvideostore( | |||
if newConf.Video.Format == "" { | |||
newConf.Video.Format = defaultVideoFormat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the pattern of
s.thingy = defaultThingy
if newConf.Thingy != nil/empty{
s.thingy = newConf.Thingy
}
But it might be messy here unless you make a new encoder with the logger first. You can also move this logic to the newSegmenter
and newEncoder
functions since you're passing in the config variables anyway.
@@ -19,37 +19,43 @@ import ( | |||
) | |||
|
|||
// Model is the model for the video storage camera component. | |||
// TODO(seanp): Personal module for now, should be movied to viam module in prod. | |||
// TODO(seanp): Personal module for now, should be moved to viam module in prod. | |||
var Model = resource.ModelNamespace("seanavery").WithFamily("video").WithModel("storage") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's okay to use the viam namespace, it's also okay to transfer a release later, just try to only upload release candidates to the registry for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, moved to viam namespace
} | ||
return matchedFiles | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add some test coverage for correctly formatting these filenames at this point. That's a good thing to check on and will test your utils, which are all helper functions that should not change much. It will also allow you to test out some weird user config silliness.
vs.seg.Close() | ||
vs.enc.close() | ||
vs.seg.close() | ||
vs.conc.close() | ||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see validation logic for the data manager being present in the configuration anywhere unless I missed it; that is part of the scope. However, I think that should be a separate ticket, I don't seeit mentioned in the epic's current tasks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call - still need to add this. May need to amend the scope doc to include the data manager service as a mandatory dependency in the config.
I don't need to review this right? Looks like a lot of iterations have been made since this in the other PR |
@seanavery please close this. |
Description
concat.txt
file used for demuxer configuration.Refs
Test
Tests were run with a webcam source and the following config:
Example save command:
Response: