diff options
| author | 2024-07-12 09:39:47 +0000 | |
|---|---|---|
| committer | 2024-07-12 09:39:47 +0000 | |
| commit | cde2fb6244a791b3c5b746112e3a8be3a79f39a4 (patch) | |
| tree | 6079d6fb66d90ffbe8c1623525bb86829c162459 /testrig | |
| parent | [chore] Add interaction policy gtsmodels (#3075) (diff) | |
| download | gotosocial-cde2fb6244a791b3c5b746112e3a8be3a79f39a4.tar.xz | |
[feature] support processing of (many) more media types (#3090)
* initial work replacing our media decoding / encoding pipeline with ffprobe + ffmpeg
* specify the video codec to use when generating static image from emoji
* update go-storage library (fixes incompatibility after updating go-iotools)
* maintain image aspect ratio when generating a thumbnail for it
* update readme to show go-ffmpreg
* fix a bunch of media tests, move filesize checking to callers of media manager for more flexibility
* remove extra debug from error message
* fix up incorrect function signatures
* update PutFile to just use regular file copy, as changes are file is on separate partition
* fix remaining tests, remove some unneeded tests now we're working with ffmpeg/ffprobe
* update more tests, add more code comments
* add utilities to generate processed emoji / media outputs
* fix remaining tests
* add test for opus media file, add license header to utility cmds
* limit the number of concurrently available ffmpeg / ffprobe instances
* reduce number of instances
* further reduce number of instances
* fix envparsing test with configuration variables
* update docs and configuration with new media-{local,remote}-max-size variables
Diffstat (limited to 'testrig')
| -rw-r--r-- | testrig/config.go | 20 | ||||
| -rw-r--r-- | testrig/media/cowlick-small.jpeg | bin | 5272 -> 6922 bytes | |||
| -rw-r--r-- | testrig/media/kip-static.png | bin | 802 -> 1056 bytes | |||
| -rw-r--r--[-rwxr-xr-x] | testrig/media/ohyou-small.jpg | bin | 6177 -> 7647 bytes | |||
| -rw-r--r--[-rwxr-xr-x] | testrig/media/rainbow-static.png | bin | 10413 -> 6092 bytes | |||
| -rw-r--r-- | testrig/media/sloth-small.jpg | bin | 50820 -> 36046 bytes | |||
| -rw-r--r-- | testrig/media/team-fortress-small.jpg | bin | 42308 -> 9921 bytes | |||
| -rw-r--r-- | testrig/media/thoughtsofdog-small.jpg | bin | 19312 -> 11751 bytes | |||
| -rw-r--r--[-rwxr-xr-x] | testrig/media/trent-small.jpg | bin | 8803 -> 9764 bytes | |||
| -rw-r--r--[-rwxr-xr-x] | testrig/media/welcome-small.jpg | bin | 6872 -> 7587 bytes | |||
| -rw-r--r-- | testrig/media/yell-static.png | bin | 10808 -> 8965 bytes | |||
| -rw-r--r-- | testrig/media/zork-small.jpg | bin | 15374 -> 29812 bytes | |||
| -rw-r--r-- | testrig/testmodels.go | 6 | 
13 files changed, 21 insertions, 5 deletions
| diff --git a/testrig/config.go b/testrig/config.go index 30beaa910..ed98798d6 100644 --- a/testrig/config.go +++ b/testrig/config.go @@ -18,6 +18,7 @@  package testrig  import ( +	"context"  	"os"  	"strconv"  	"time" @@ -26,8 +27,23 @@ import (  	"github.com/coreos/go-oidc/v3/oidc"  	"github.com/superseriousbusiness/gotosocial/internal/config"  	"github.com/superseriousbusiness/gotosocial/internal/language" +	"github.com/superseriousbusiness/gotosocial/internal/media/ffmpeg"  ) +func init() { +	ctx := context.Background() + +	// Ensure global ffmpeg WASM pool initialized. +	if err := ffmpeg.InitFfmpeg(ctx, 1); err != nil { +		panic(err) +	} + +	// Ensure global ffmpeg WASM pool initialized. +	if err := ffmpeg.InitFfprobe(ctx, 1); err != nil { +		panic(err) +	} +} +  // InitTestConfig initializes viper  // configuration with test defaults.  func InitTestConfig() { @@ -86,11 +102,11 @@ func testDefaults() config.Configuration {  		AccountsAllowCustomCSS:   true,  		AccountsCustomCSSLength:  10000, -		MediaImageMaxSize:        10485760, // 10MiB -		MediaVideoMaxSize:        41943040, // 40MiB  		MediaDescriptionMinChars: 0,  		MediaDescriptionMaxChars: 500,  		MediaRemoteCacheDays:     7, +		MediaLocalMaxSize:        40 * bytesize.MiB, +		MediaRemoteMaxSize:       40 * bytesize.MiB,  		MediaEmojiLocalMaxSize:   51200,          // 50KiB  		MediaEmojiRemoteMaxSize:  102400,         // 100KiB  		MediaCleanupFrom:         "00:00",        // midnight. diff --git a/testrig/media/cowlick-small.jpeg b/testrig/media/cowlick-small.jpegBinary files differ index b3cd2f647..4061653ab 100644 --- a/testrig/media/cowlick-small.jpeg +++ b/testrig/media/cowlick-small.jpeg diff --git a/testrig/media/kip-static.png b/testrig/media/kip-static.pngBinary files differ index 1ba296687..c60b94c5c 100644 --- a/testrig/media/kip-static.png +++ b/testrig/media/kip-static.png diff --git a/testrig/media/ohyou-small.jpg b/testrig/media/ohyou-small.jpgBinary files differ index f561884d1..c862be1ff 100755..100644 --- a/testrig/media/ohyou-small.jpg +++ b/testrig/media/ohyou-small.jpg diff --git a/testrig/media/rainbow-static.png b/testrig/media/rainbow-static.pngBinary files differ index 79ed5c03a..f762a0470 100755..100644 --- a/testrig/media/rainbow-static.png +++ b/testrig/media/rainbow-static.png diff --git a/testrig/media/sloth-small.jpg b/testrig/media/sloth-small.jpgBinary files differ index 2787d535c..60f64a2fd 100644 --- a/testrig/media/sloth-small.jpg +++ b/testrig/media/sloth-small.jpg diff --git a/testrig/media/team-fortress-small.jpg b/testrig/media/team-fortress-small.jpgBinary files differ index f6773b9a0..8615834b6 100644 --- a/testrig/media/team-fortress-small.jpg +++ b/testrig/media/team-fortress-small.jpg diff --git a/testrig/media/thoughtsofdog-small.jpg b/testrig/media/thoughtsofdog-small.jpgBinary files differ index 98801d235..5f303f939 100644 --- a/testrig/media/thoughtsofdog-small.jpg +++ b/testrig/media/thoughtsofdog-small.jpg diff --git a/testrig/media/trent-small.jpg b/testrig/media/trent-small.jpgBinary files differ index 726c1aed0..4e9ac26b6 100755..100644 --- a/testrig/media/trent-small.jpg +++ b/testrig/media/trent-small.jpg diff --git a/testrig/media/welcome-small.jpg b/testrig/media/welcome-small.jpgBinary files differ index b1a585169..04179ccc9 100755..100644 --- a/testrig/media/welcome-small.jpg +++ b/testrig/media/welcome-small.jpg diff --git a/testrig/media/yell-static.png b/testrig/media/yell-static.pngBinary files differ index 9b5d2837e..b60b9f62b 100644 --- a/testrig/media/yell-static.png +++ b/testrig/media/yell-static.png diff --git a/testrig/media/zork-small.jpg b/testrig/media/zork-small.jpgBinary files differ index 60be12564..e8fffe9cb 100644 --- a/testrig/media/zork-small.jpg +++ b/testrig/media/zork-small.jpg diff --git a/testrig/testmodels.go b/testrig/testmodels.go index 90c200585..5f41ed190 100644 --- a/testrig/testmodels.go +++ b/testrig/testmodels.go @@ -1028,7 +1028,7 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment {  			Thumbnail: gtsmodel.Thumbnail{  				Path:        "01F8MH5ZK5VRH73AKHQM6Y9VNX/attachment/small/01FVW7RXPQ8YJHTEXYPE7Q8ZY0.jpg",  				ContentType: "image/jpeg", -				FileSize:    19312, +				FileSize:    11751,  				URL:         "http://localhost:8080/fileserver/01F8MH5ZK5VRH73AKHQM6Y9VNX/attachment/small/01FVW7RXPQ8YJHTEXYPE7Q8ZY0.jpg",  				RemoteURL:   "http://fossbros-anonymous.io/attachments/small/a499f55b-2d1e-4acd-98d2-1ac2ba6d79b9.jpg",  			}, @@ -1205,7 +1205,7 @@ func NewTestEmojis() map[string]*gtsmodel.Emoji {  			ImageContentType:       "image/png",  			ImageStaticContentType: "image/png",  			ImageFileSize:          36702, -			ImageStaticFileSize:    10413, +			ImageStaticFileSize:    6092,  			Disabled:               util.Ptr(false),  			URI:                    "http://localhost:8080/emoji/01F8MH9H8E4VG3KDYJR9EGPXCQ",  			VisibleInPicker:        util.Ptr(true), @@ -1227,7 +1227,7 @@ func NewTestEmojis() map[string]*gtsmodel.Emoji {  			ImageContentType:       "image/png",  			ImageStaticContentType: "image/png",  			ImageFileSize:          10889, -			ImageStaticFileSize:    10808, +			ImageStaticFileSize:    8965,  			Disabled:               util.Ptr(false),  			URI:                    "http://fossbros-anonymous.io/emoji/01GD5KP5CQEE1R3X43Y1EHS2CW",  			VisibleInPicker:        util.Ptr(false), | 
