Wait for keyframe on switching streams (#28)

* stream sink add keyframe lobby.

* change streamsink keyframe identifier.

* add h264.

* use gstreamers is delta unit for sample.

* use delta unit.
This commit is contained in:
Miroslav Šedivý
2023-02-14 21:19:02 +01:00
committed by GitHub
parent f8b128e1e9
commit 124c5ae117
8 changed files with 80 additions and 28 deletions

View File

@ -6,17 +6,21 @@ import (
"fmt"
"math"
"strings"
"time"
"github.com/PaesslerAG/gval"
"github.com/demodesk/neko/pkg/types/codec"
"github.com/pion/webrtc/v3/pkg/media"
)
var (
ErrCapturePipelineAlreadyExists = errors.New("capture pipeline already exists")
)
type Sample media.Sample
type Sample struct {
Data []byte
Duration time.Duration
DeltaUnit bool // this unit cannot be decoded independently.
}
type Receiver interface {
SetStream(stream StreamSinkManager) (changed bool, err error)

View File

@ -63,6 +63,18 @@ func (codec *RTPCodec) Register(engine *webrtc.MediaEngine) error {
}, codec.Type)
}
func (codec *RTPCodec) IsVideo() bool {
return codec.Type == webrtc.RTPCodecTypeVideo
}
func (codec *RTPCodec) IsAudio() bool {
return codec.Type == webrtc.RTPCodecTypeAudio
}
func (codec *RTPCodec) String() string {
return codec.Type.String() + "/" + codec.Name
}
func VP8() RTPCodec {
return RTPCodec{
Name: "vp8",