Code refactoring for MJPEG source
This commit is contained in:
+8
-4
@@ -3,15 +3,16 @@ package mjpeg
|
||||
import (
|
||||
"bufio"
|
||||
"errors"
|
||||
"github.com/AlexxIT/go2rtc/pkg/core"
|
||||
"github.com/AlexxIT/go2rtc/pkg/tcp"
|
||||
"github.com/pion/rtp"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/textproto"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/AlexxIT/go2rtc/pkg/core"
|
||||
"github.com/AlexxIT/go2rtc/pkg/tcp"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
@@ -112,7 +113,10 @@ func (c *Client) startMJPEG(boundary string) error {
|
||||
}
|
||||
|
||||
if c.receiver != nil {
|
||||
packet := &rtp.Packet{Header: rtp.Header{Timestamp: now()}, Payload: buf}
|
||||
packet := &rtp.Packet{
|
||||
Header: rtp.Header{Timestamp: core.Now90000()},
|
||||
Payload: buf,
|
||||
}
|
||||
c.receiver.WriteRTP(packet)
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,9 @@ package mjpeg
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"github.com/AlexxIT/go2rtc/pkg/core"
|
||||
"strings"
|
||||
|
||||
"github.com/AlexxIT/go2rtc/pkg/core"
|
||||
)
|
||||
|
||||
func (c *Client) GetMedias() []*core.Media {
|
||||
@@ -14,7 +15,9 @@ func (c *Client) GetMedias() []*core.Media {
|
||||
Direction: core.DirectionRecvonly,
|
||||
Codecs: []*core.Codec{
|
||||
{
|
||||
Name: core.CodecJPEG, ClockRate: 90000, PayloadType: core.PayloadTypeRAW,
|
||||
Name: core.CodecJPEG,
|
||||
ClockRate: 90000,
|
||||
PayloadType: core.PayloadTypeRAW,
|
||||
},
|
||||
},
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user