Skip to content

Commit

Permalink
Add MJPEG support to HomeKit client
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Sep 2, 2023
1 parent 1c569e6 commit 6288c2a
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions pkg/homekit/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@ func (c *Client) GetMedias() []*core.Media {
c.SDP = fmt.Sprintf("%+v\n%+v", c.videoConfig, c.audioConfig)

c.Medias = []*core.Media{
{
Kind: core.KindVideo,
Direction: core.DirectionRecvonly,
Codecs: []*core.Codec{
{
Name: core.CodecJPEG,
ClockRate: 90000,
PayloadType: core.PayloadTypeRAW,
},
},
},
videoToMedia(c.videoConfig.Codecs),
audioToMedia(c.audioConfig.Codecs),
}
Expand Down Expand Up @@ -164,8 +175,12 @@ func (c *Client) Start() error {
func (c *Client) Stop() error {
_ = c.SuperProducer.Close()

c.srtp.DelSession(c.videoSession)
c.srtp.DelSession(c.audioSession)
if c.videoSession != nil {
c.srtp.DelSession(c.videoSession)
}
if c.audioSession != nil {
c.srtp.DelSession(c.audioSession)
}

return c.hap.Close()
}
Expand Down

0 comments on commit 6288c2a

Please sign in to comment.