feat(db): add migration to migrate old vaapi codec to new legacy vaapi codec name

This commit is contained in:
Gabe Kangas 2023-12-17 14:27:51 -08:00
parent d76b2b79b7
commit 4f7d25f6dd
No known key found for this signature in database
GPG Key ID: 4345B2060657F330

View File

@ -8,7 +8,7 @@ import (
) )
const ( const (
datastoreValuesVersion = 3 datastoreValuesVersion = 4
datastoreValueVersionKey = "DATA_STORE_VERSION" datastoreValueVersionKey = "DATA_STORE_VERSION"
) )
@ -27,6 +27,8 @@ func migrateDatastoreValues(datastore *Datastore) {
migrateToDatastoreValues2(datastore) migrateToDatastoreValues2(datastore)
case 2: case 2:
migrateToDatastoreValues3ServingEndpoint3(datastore) migrateToDatastoreValues3ServingEndpoint3(datastore)
case 3:
migrateToDatastoreVaapiCodecSettingValue4(datastore)
default: default:
log.Fatalln("missing datastore values migration step") log.Fatalln("missing datastore values migration step")
} }
@ -73,3 +75,19 @@ func migrateToDatastoreValues3ServingEndpoint3(_ *Datastore) {
_ = SetVideoServingEndpoint(s3Config.ServingEndpoint) _ = SetVideoServingEndpoint(s3Config.ServingEndpoint)
} }
func migrateToDatastoreVaapiCodecSettingValue4(_ *Datastore) {
// If the currently selected codec is "vaapi" then we need
// to migrate the name to the updated name.
currentCodec := GetVideoCodec()
if currentCodec != "vaapi" {
return
}
// The updated name for the old vaapi codec is "h264_vaapi_legacy"
// so we update it. This is assuming existing users will be using older
// versions of ffmpeg.
_ = SetVideoCodec("h264_vaapi_legacy")
log.Println("An update to the vaapi video codec has been made. It will now be selected as vaapi (Legacy) in your video settings. However, if you are running a version of ffmpeg greater than 5.0 you should update your video codec settings to use the 5.0+ codec setting instead.")
}