move protocol-related code into internal/protocols (#2572)
This commit is contained in:
@@ -15,8 +15,8 @@ import (
|
||||
"github.com/google/uuid"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/conf"
|
||||
"github.com/bluenviron/mediamtx/internal/httpserv"
|
||||
"github.com/bluenviron/mediamtx/internal/logger"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/httpserv"
|
||||
)
|
||||
|
||||
var errAPINotFound = errors.New("not found")
|
||||
|
||||
@@ -25,8 +25,8 @@ import (
|
||||
"github.com/pion/rtp"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp"
|
||||
"github.com/bluenviron/mediamtx/internal/webrtc"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/webrtc"
|
||||
)
|
||||
|
||||
var testFormatH264 = &format.H264{
|
||||
|
||||
@@ -12,8 +12,8 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/conf"
|
||||
"github.com/bluenviron/mediamtx/internal/httpserv"
|
||||
"github.com/bluenviron/mediamtx/internal/logger"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/httpserv"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/conf"
|
||||
"github.com/bluenviron/mediamtx/internal/httpserv"
|
||||
"github.com/bluenviron/mediamtx/internal/logger"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/httpserv"
|
||||
)
|
||||
|
||||
func metric(key string, tags string, value int64) string {
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp"
|
||||
)
|
||||
|
||||
func TestMetrics(t *testing.T) {
|
||||
|
||||
@@ -24,8 +24,8 @@ import (
|
||||
"github.com/pion/rtp"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp"
|
||||
"github.com/bluenviron/mediamtx/internal/webrtc"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/webrtc"
|
||||
)
|
||||
|
||||
var runOnDemandSampleScript = `
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
_ "net/http/pprof"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/conf"
|
||||
"github.com/bluenviron/mediamtx/internal/httpserv"
|
||||
"github.com/bluenviron/mediamtx/internal/logger"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/httpserv"
|
||||
)
|
||||
|
||||
type pprofParent interface {
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"github.com/bluenviron/mediamtx/internal/conf"
|
||||
"github.com/bluenviron/mediamtx/internal/externalcmd"
|
||||
"github.com/bluenviron/mediamtx/internal/logger"
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp"
|
||||
"github.com/bluenviron/mediamtx/internal/stream"
|
||||
"github.com/bluenviron/mediamtx/internal/unit"
|
||||
)
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
"github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp"
|
||||
)
|
||||
|
||||
func TestRTMPServer(t *testing.T) {
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/conf"
|
||||
"github.com/bluenviron/mediamtx/internal/logger"
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp"
|
||||
"github.com/bluenviron/mediamtx/internal/stream"
|
||||
"github.com/bluenviron/mediamtx/internal/unit"
|
||||
)
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
"github.com/pion/rtp"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp"
|
||||
)
|
||||
|
||||
func TestRTMPSource(t *testing.T) {
|
||||
|
||||
@@ -16,9 +16,9 @@ import (
|
||||
pwebrtc "github.com/pion/webrtc/v3"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/conf"
|
||||
"github.com/bluenviron/mediamtx/internal/httpserv"
|
||||
"github.com/bluenviron/mediamtx/internal/logger"
|
||||
"github.com/bluenviron/mediamtx/internal/webrtc"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/httpserv"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/webrtc"
|
||||
)
|
||||
|
||||
//go:embed webrtc_publish_index.html
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"github.com/bluenviron/mediamtx/internal/conf"
|
||||
"github.com/bluenviron/mediamtx/internal/externalcmd"
|
||||
"github.com/bluenviron/mediamtx/internal/logger"
|
||||
"github.com/bluenviron/mediamtx/internal/webrtc"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/webrtc"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
pwebrtc "github.com/pion/webrtc/v3"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/webrtc"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/webrtc"
|
||||
)
|
||||
|
||||
func TestWebRTCRead(t *testing.T) {
|
||||
|
||||
@@ -25,9 +25,9 @@ import (
|
||||
"github.com/bluenviron/mediamtx/internal/asyncwriter"
|
||||
"github.com/bluenviron/mediamtx/internal/externalcmd"
|
||||
"github.com/bluenviron/mediamtx/internal/logger"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/webrtc"
|
||||
"github.com/bluenviron/mediamtx/internal/stream"
|
||||
"github.com/bluenviron/mediamtx/internal/unit"
|
||||
"github.com/bluenviron/mediamtx/internal/webrtc"
|
||||
)
|
||||
|
||||
type webrtcTrackWrapper struct {
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/conf"
|
||||
"github.com/bluenviron/mediamtx/internal/logger"
|
||||
"github.com/bluenviron/mediamtx/internal/webrtc"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/webrtc"
|
||||
)
|
||||
|
||||
type webRTCSourceParent interface {
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
"github.com/pion/rtp"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/webrtc"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/webrtc"
|
||||
)
|
||||
|
||||
func TestWebRTCSource(t *testing.T) {
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
|
||||
"github.com/notedit/rtmp/format/flv/flvio"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/bytecounter"
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/handshake"
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/message"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/bytecounter"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/handshake"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/message"
|
||||
)
|
||||
|
||||
func resultIsOK1(res *message.CommandAMF0) bool {
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
"github.com/notedit/rtmp/format/flv/flvio"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/bytecounter"
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/handshake"
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/message"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/bytecounter"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/handshake"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/message"
|
||||
)
|
||||
|
||||
func TestNewClientConn(t *testing.T) {
|
||||
+1
-1
@@ -3,7 +3,7 @@ package message //nolint:dupl
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/rawmessage"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/rawmessage"
|
||||
)
|
||||
|
||||
// Acknowledge is an acknowledgement message.
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/rawmessage"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/rawmessage"
|
||||
)
|
||||
|
||||
const (
|
||||
+1
-1
@@ -5,7 +5,7 @@ import (
|
||||
|
||||
"github.com/notedit/rtmp/format/flv/flvio"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/rawmessage"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/rawmessage"
|
||||
)
|
||||
|
||||
// CommandAMF0 is a AMF0 command message.
|
||||
@@ -3,7 +3,7 @@ package message
|
||||
import (
|
||||
"github.com/notedit/rtmp/format/flv/flvio"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/rawmessage"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/rawmessage"
|
||||
)
|
||||
|
||||
// DataAMF0 is a AMF0 data message.
|
||||
+1
-1
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/rawmessage"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/rawmessage"
|
||||
)
|
||||
|
||||
// ExtendedCodedFrames is a CodedFrames extended message.
|
||||
+1
-1
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/rawmessage"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/rawmessage"
|
||||
)
|
||||
|
||||
// ExtendedFramesX is a FramesX extended message.
|
||||
+1
-1
@@ -3,7 +3,7 @@ package message
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/rawmessage"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/rawmessage"
|
||||
)
|
||||
|
||||
// ExtendedMetadata is a metadata extended message.
|
||||
+1
-1
@@ -3,7 +3,7 @@ package message
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/rawmessage"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/rawmessage"
|
||||
)
|
||||
|
||||
// ExtendedMPEG2TSSequenceStart is a MPEG2-TS sequence start extended message.
|
||||
+1
-1
@@ -3,7 +3,7 @@ package message
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/rawmessage"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/rawmessage"
|
||||
)
|
||||
|
||||
// ExtendedSequenceEnd is a sequence end extended message.
|
||||
+1
-1
@@ -3,7 +3,7 @@ package message
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/rawmessage"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/rawmessage"
|
||||
)
|
||||
|
||||
// ExtendedSequenceStart is a sequence start extended message.
|
||||
@@ -2,7 +2,7 @@
|
||||
package message
|
||||
|
||||
import (
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/rawmessage"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/rawmessage"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/bytecounter"
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/rawmessage"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/bytecounter"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/rawmessage"
|
||||
)
|
||||
|
||||
func allocateMessage(raw *rawmessage.Message) (Message, error) {
|
||||
+1
-1
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/notedit/rtmp/format/flv/flvio"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/bytecounter"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/bytecounter"
|
||||
)
|
||||
|
||||
var readWriterCases = []struct {
|
||||
@@ -3,7 +3,7 @@ package message
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/bytecounter"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/bytecounter"
|
||||
)
|
||||
|
||||
// ReadWriter is a message reader/writer.
|
||||
+1
-1
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/bytecounter"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/bytecounter"
|
||||
)
|
||||
|
||||
type duplexRW struct {
|
||||
+1
-1
@@ -3,7 +3,7 @@ package message //nolint:dupl
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/rawmessage"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/rawmessage"
|
||||
)
|
||||
|
||||
// SetChunkSize is a set chunk size message.
|
||||
+1
-1
@@ -3,7 +3,7 @@ package message //nolint:dupl
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/rawmessage"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/rawmessage"
|
||||
)
|
||||
|
||||
// SetPeerBandwidth is a set peer bandwidth message.
|
||||
+1
-1
@@ -3,7 +3,7 @@ package message //nolint:dupl
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/rawmessage"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/rawmessage"
|
||||
)
|
||||
|
||||
// SetWindowAckSize is a set window acknowledgement message.
|
||||
+1
-1
@@ -3,7 +3,7 @@ package message //nolint:dupl
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/rawmessage"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/rawmessage"
|
||||
)
|
||||
|
||||
// UserControlPingRequest is a user control message.
|
||||
+1
-1
@@ -3,7 +3,7 @@ package message //nolint:dupl
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/rawmessage"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/rawmessage"
|
||||
)
|
||||
|
||||
// UserControlPingResponse is a user control message.
|
||||
+1
-1
@@ -3,7 +3,7 @@ package message //nolint:dupl
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/rawmessage"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/rawmessage"
|
||||
)
|
||||
|
||||
// UserControlSetBufferLength is a user control message.
|
||||
+1
-1
@@ -3,7 +3,7 @@ package message //nolint:dupl
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/rawmessage"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/rawmessage"
|
||||
)
|
||||
|
||||
// UserControlStreamBegin is a user control message.
|
||||
+1
-1
@@ -3,7 +3,7 @@ package message //nolint:dupl
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/rawmessage"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/rawmessage"
|
||||
)
|
||||
|
||||
// UserControlStreamDry is a user control message.
|
||||
+1
-1
@@ -3,7 +3,7 @@ package message //nolint:dupl
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/rawmessage"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/rawmessage"
|
||||
)
|
||||
|
||||
// UserControlStreamEOF is a user control message.
|
||||
+1
-1
@@ -3,7 +3,7 @@ package message //nolint:dupl
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/rawmessage"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/rawmessage"
|
||||
)
|
||||
|
||||
// UserControlStreamIsRecorded is a user control message.
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
|
||||
"github.com/notedit/rtmp/format/flv/flvio"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/rawmessage"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/rawmessage"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -3,8 +3,8 @@ package message
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/bytecounter"
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/rawmessage"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/bytecounter"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/rawmessage"
|
||||
)
|
||||
|
||||
// Writer is a message writer.
|
||||
+1
-1
@@ -6,7 +6,7 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/bytecounter"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/bytecounter"
|
||||
)
|
||||
|
||||
func TestWriter(t *testing.T) {
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/bytecounter"
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/chunk"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/bytecounter"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/chunk"
|
||||
)
|
||||
|
||||
var errMoreChunksNeeded = errors.New("more chunks are needed")
|
||||
+2
-2
@@ -7,8 +7,8 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/bytecounter"
|
||||
"github.com/bluenviron/mediamtx/internal/rtmp/chunk"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/bytecounter"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/rtmp/chunk"
|
||||
)
|
||||
|
||||
var cases = []struct {
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user