Documentation
¶
Overview ¶
Package serve answers proto requests with go-avkit: the worker's side of the protocol. It links go-avkit's container reader (MP4, WebM / Matroska) and go-avkit/decode's H.264 decoder, and nothing of a host: no syscall/js, so it is tested natively and run in a Web Worker by cmd/avkit-worker.
A file is untrusted. Whatever the client said of it (its key, its size, its limits), it is checked against the clamped limits (proto.Clamp) before the container reader is asked anything, and again, against the limits of the request at hand, each time a held file is read.
Index ¶
Constants ¶
const Keep = 2
Keep is how many files a Server holds: the project's videos that the renders of a page ask about, the most recent ones. Two 64 MiB files at most.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server holds the files it was sent and answers requests about them. Its methods are safe for concurrent use; they run one at a time.
func (*Server) Handle ¶
Handle answers one request. payload is the file when req.HasData, and the picture of a poster's answer is the second result. The limits are proto.Clamp(req.Limits): a request lowers them, never raises them.
A panic in the container reader or the decoder, on a file nobody foresaw, is answered as a video.syntax refusal and the worker keeps serving.