Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add video/mpegts to the list of supported url pull media types #144

Merged
merged 2 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/livekit/ingress

go 1.18
go 1.20

replace github.com/tinyzimmer/go-glib => github.com/livekit/go-glib v0.0.0-20230811224737-7bfaa4e57420

Expand Down
6 changes: 5 additions & 1 deletion pkg/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var (
ErrInvalidAudioPreset = psrpc.NewErrorf(psrpc.InvalidArgument, "invalid audio encoding preset")
ErrInvalidVideoPreset = psrpc.NewErrorf(psrpc.InvalidArgument, "invalid video encoding preset")
ErrSourceNotReady = psrpc.NewErrorf(psrpc.FailedPrecondition, "source encoder not ready")
ErrUnsupportedDecodeFormat = psrpc.NewErrorf(psrpc.NotAcceptable, "unsupported mime type for the source media")
ErrUnsupportedDecodeFormat = psrpc.NewErrorf(psrpc.NotAcceptable, "unsupported format for the source media")
ErrUnsupportedEncodeFormat = psrpc.NewErrorf(psrpc.InvalidArgument, "unsupported mime type for encoder")
ErrDuplicateTrack = psrpc.NewErrorf(psrpc.NotAcceptable, "more than 1 track with given media kind")
ErrUnableToAddPad = psrpc.NewErrorf(psrpc.Internal, "could not add pads to bin")
Expand Down Expand Up @@ -68,6 +68,10 @@ func ErrHttpRelayFailure(statusCode int) psrpc.Error {
return psrpc.NewErrorf(psrpc.Internal, "HTTP request failed with code %d", statusCode)
}

func ErrUnsupportedDecodeMimeType(mimeType string) psrpc.Error {
return psrpc.NewErrorf(psrpc.NotAcceptable, "unsupported mime type (%s) for the source media", mimeType)
}

func ErrorToGstFlowReturn(err error) gst.FlowReturn {
switch {
case err == nil:
Expand Down
3 changes: 2 additions & 1 deletion pkg/media/urlpull/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var (
"video/quicktime",
"video/x-matroska",
"video/webm",
"video/mpegts",
"audio/ogg",
"application/x-id3",
"audio/mpeg",
Expand Down Expand Up @@ -114,7 +115,7 @@ func (s *URLSource) ValidateCaps(caps *gst.Caps) error {
}
}

return errors.ErrUnsupportedDecodeFormat
return errors.ErrUnsupportedDecodeMimeType(str.Name())
}

func (u *URLSource) Start(ctx context.Context) error {
Expand Down
2 changes: 1 addition & 1 deletion pkg/media/whip/appsrc.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,5 +165,5 @@ func getCapsForCodec(mimeType string) (*gst.Caps, error) {
return gst.NewCapsFromString("audio/x-opus,channel-mapping-family=0"), nil
}

return nil, errors.ErrUnsupportedDecodeFormat
return nil, errors.ErrUnsupportedDecodeMimeType(mimeType)
}
2 changes: 1 addition & 1 deletion pkg/whip/sdk_media_sink.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func getVideoParams(mimeType string, s *media.Sample) (uint, uint, error) {
case strings.ToLower(webrtc.MimeTypeVP8):
return getVP8VideoParams(s)
default:
return 0, 0, errors.ErrUnsupportedDecodeFormat
return 0, 0, errors.ErrUnsupportedDecodeMimeType(mimeType)
}
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/whip/whip_track_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ func (t *whipTrackHandler) createDepacketizer() (rtp.Depacketizer, error) {
depacketizer = &codecs.OpusPacket{}

default:
return nil, errors.ErrUnsupportedDecodeFormat
return nil, errors.ErrUnsupportedDecodeMimeType(t.remoteTrack.Codec().MimeType)
}

return depacketizer, nil
Expand Down Expand Up @@ -354,7 +354,7 @@ func (t *whipTrackHandler) createJitterBuffer() (*jitter.Buffer, error) {
// No PLI for audio

default:
return nil, errors.ErrUnsupportedDecodeFormat
return nil, errors.ErrUnsupportedDecodeMimeType(t.remoteTrack.Codec().MimeType)
}

clockRate := t.remoteTrack.Codec().ClockRate
Expand Down