From 0c84a2a5c65a097b3b315c8cf4ebb74f9595e30f Mon Sep 17 00:00:00 2001 From: kim Date: Tue, 5 Nov 2024 14:40:56 +0000 Subject: [PATCH] add code comment --- internal/media/ffmpeg/wasm.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/media/ffmpeg/wasm.go b/internal/media/ffmpeg/wasm.go index 1d3be52c3..8cf5bb333 100644 --- a/internal/media/ffmpeg/wasm.go +++ b/internal/media/ffmpeg/wasm.go @@ -30,11 +30,17 @@ import ( "github.com/tetratelabs/wazero" ) +// ffmpreg is a concurrency-safe pointer +// to our necessary WebAssembly runtime +// and compiled ffmpreg module instance. var ffmpreg atomic.Pointer[struct { run wazero.Runtime mod wazero.CompiledModule }] +// initWASM safely prepares new WebAssembly runtime +// and compiles ffmpreg module instance, if the global +// pointer has not been already. else, is a no-op. func initWASM(ctx context.Context) error { if ffmpreg.Load() != nil { return nil