simplify readme

This commit is contained in:
Leandro Moreira
2024-06-04 22:06:48 -03:00
parent c613a891fa
commit 51bed46113
2 changed files with 13 additions and 37 deletions

View File

@@ -1,26 +1,26 @@
# INTRODUCTION
```golang
// build the a donut engine for user's input (ie: srt://server)
donutEngine := h.donut.EngineFor(reqParams)
// fetches the server-side stream info (codec, ...)
// It builds an engine based on user inputs
// {url: url, id: id, sdp: webRTCOffer}
donutEngine := donut.EngineFor(reqParams)
// It fetches the server-side (streaming server) stream info (codec, ...)
serverStreamInfo := donutEngine.ServerIngredients(reqParams)
// gets the client side media support (codec, ...)
// It gets the client side (browser) media support (codec, ...)
clientStreamInfo := donutEngine.ClientIngredients(reqParams)
// creates the necessary recipe (by pass, transcoding from A to B, etc)
// Given the client's restrictions and the server's availability, it builds the right recipe.
donutRecipe := donutEngine.RecipeFor(reqParams, serverStreamInfo, clientStreamInfo)
// serve asynchronously the server stream to the client web rtc
go donutEngine.Serve(&entities.DonutParameters{
Recipe: *donutRecipe,
OnVideoFrame: func(data []byte, c entities.MediaFrameContext) error {
return webRTC.SendMediaSample(VIDEO_CHANNEL, data, c)
// It streams the media from the backend server to the client while there's data.
go donutEngine.Serve(DonutParameters{
Recipe: donutRecipe,
OnVideoFrame: func(data []byte, c MediaFrameContext) error {
return SendMediaSample(VIDEO_TYPE, data, c)
},
OnAudioFrame: func(data []byte, c entities.MediaFrameContext) error {
return webRTC.SendMediaSample(AUDIO_CHANNEL, data, c)
OnAudioFrame: func(data []byte, c MediaFrameContext) error {
return SendMediaSample(AUDIO_TYPE, data, c)
},
})
```
# DATA FLOW DIAGRAM

View File

@@ -5,30 +5,6 @@
# HOW IT WORKS
```go
// It builds an engine based on user inputs
// {url: url, id: id, sdp: webRTCOffer}
donutEngine := donut.EngineFor(reqParams)
// It fetches the server-side (streaming server) stream info (codec, ...)
serverStreamInfo := donutEngine.ServerIngredients(reqParams)
// It gets the client side (browser) media support (codec, ...)
clientStreamInfo := donutEngine.ClientIngredients(reqParams)
// Given the client's restrictions and the server's availability, it builds the right recipe.
donutRecipe := donutEngine.RecipeFor(reqParams, serverStreamInfo, clientStreamInfo)
// It streams the media from the backend server to the client while there's data.
go donutEngine.Serve(DonutParameters{
Recipe: donutRecipe,
OnVideoFrame: func(data []byte, c MediaFrameContext) error {
return SendMediaSample(VIDEO_TYPE, data, c)
},
OnAudioFrame: func(data []byte, c MediaFrameContext) error {
return SendMediaSample(AUDIO_TYPE, data, c)
},
})
```
```mermaid
sequenceDiagram
actor User