Skip to content
This repository has been archived by the owner on Dec 27, 2020. It is now read-only.

Design of Track interface #10

Closed
at-wat opened this issue Jul 25, 2020 · 3 comments · Fixed by #14
Closed

Design of Track interface #10

at-wat opened this issue Jul 25, 2020 · 3 comments · Fixed by #14
Assignees

Comments

@at-wat
Copy link
Member

at-wat commented Jul 25, 2020

In v2, Track internally handled RTP packets.
However, according to the WebRTC API spec, codec specific processing is done in RTPSender/RTPReceiver. (ref: #9) It means Track handles only raw media data?

@at-wat
Copy link
Member Author

at-wat commented Jul 25, 2020

On pion/webrtc, we don't want to put media encoder/decoder into RTPSender/RTPReceiver unlike JavaScript WebAPI seems doing.
I think we need to define

type LocalRTPTrack interface {
  rtpengine.Reader // #11 
  SetParameters(RTPParameters) // RTPSender.SetParameters() will call this.
}
type RemoteRTPTrack interface {
  rtpengine.Writer // #11 
  Parameters() RTPParameters // It will call RTPReceiver.Parameters().
}
type RTPTrack interface {
  LocalRTPTrack
  RemoteRTPTrack
}

instead of Track to passthrough the RTPSender/RTPReceiver.
Then, mediadevices.Track can receive encoding parameters and also can receive RTCP packet like PLI (and force adding a keyframe).

For SFU usage, we just have to pipe RemoteRTPTrack to LocalRTPTrack.

@at-wat
Copy link
Member Author

at-wat commented Jul 25, 2020

Sample based interface would be like:

package media

import (
	"time"

	"github.com/pion/webrtc-v3-design/rtpengine"
)

// Sample represents raw media data with media duration.
type Sample struct {
	Data     []byte
	Duration time.Duration
}

// ReadSample reads Sample from rtpengine.Reader.
func ReadSample(r rtpengine.Reader) (Sample, error) {
}

// WriteSample writes Sample to rtpengine.Writer.
func WriteSample(r rtpengine.Writer, s Sample) error {
}

@at-wat
Copy link
Member Author

at-wat commented Jul 27, 2020

As reported in pion/rtp#69, roundtrip transformation rtp.Packet -> Sample -> rtp.Packet loose some RTP header flags.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants