Add RTP/MJPEG decoder and encoder (#165)

* rename format.JPEG into format.MJPEG

* add examples/client-publish-format-mjpeg

* add rtp/mjpeg decoder and encoder
This commit is contained in:
Alessandro Ros
2022-12-27 13:43:23 +01:00
committed by GitHub
parent cd8cc2cdb1
commit 91f18ab6d9
53 changed files with 2527 additions and 174 deletions

View File

@@ -1,8 +1,11 @@
package main
import (
"log"
"github.com/aler9/gortsplib/v2"
"github.com/aler9/gortsplib/v2/pkg/format"
"github.com/aler9/gortsplib/v2/pkg/formatdecenc/rtph264"
"github.com/aler9/gortsplib/v2/pkg/url"
"github.com/pion/rtp"
)
@@ -61,6 +64,9 @@ func main() {
// convert RTP packets into NALUs
nalus, pts, err := rtpDec.Decode(pkt)
if err != nil {
if err != rtph264.ErrNonStartingPacketAndNoPrevious && err != rtph264.ErrMorePacketsNeeded {
log.Printf("ERR: %v", err)
}
return
}