ITADN

Add audio, RTMP, FFmpeg/LibAV and more

#31Pull Requestleandromoreira 创建于 2024-03-05已合并
L
leandromoreiracommented
# Changes - Replace MpegTS/SRT Go bindings for FFmpeg/LibAV binding - Add support for RTMP - Add initial suport for opus audio <img width="1296" alt="image" src="https://github.com/flavioribeiro/donut/assets/55913/9a4541ba-cf9c-4c85-ac3a-c84419bce9d4"> <img width="1512" alt="image" src="https://github.com/flavioribeiro/donut/assets/55913/1d27d6d6-ec63-457d-95ab-df9d66ba8046"> ## How to test Get this branch and run: ```bash make run # make sure to have Docker running ``` Open the chrome browser and go to `http://localhost:8080/demo/`, click on `connect`. You should see an old TV pattern and a noisy audio. # Donut Engine API I used terms `Ingredients`, `Recipe`, and `Serve` to resemble cooking 🧑‍🍳 analogies 😆 , but I'm unsure if they're more confusing than fun. ```golang // build the proper donut engine donutEngine := h.donut.EngineFor(reqParams) // fetches the server-side stream info (codec, ...) serverStreamInfo := donutEngine.ServerIngredients(reqParams) // gets the client side media support (codec, ...) clientStreamInfo := donutEngine.ClientIngredients(reqParams) // mount the necessary task (bypass, transcoding from A to B, etc) donutRecipe := donutEngine.RecipeFor(reqParams, serverStreamInfo, clientStreamInfo) // serve the stream go donutEngine.Serve(&entities.DonutParameters{ Cancel: cancel, Ctx: ctx, Recipe: *donutRecipe, OnStream: func(st *entities.Stream) error { return h.webRTCController.SendMetadata(webRTCResponse.Data, st) }, OnVideoFrame: func(data []byte, c entities.MediaFrameContext) error { return h.webRTCController.SendMediaSample(webRTCResponse.Video, data, c) }, OnAudioFrame: func(data []byte, c entities.MediaFrameContext) error { return h.webRTCController.SendMediaSample(webRTCResponse.Audio, data, c) }, }) ```
合并状态:已合并 合并于 2024-06-05 关闭于 2024-06-05 0 条评论