修改了某些地址拉不到流的问题

pull/132/head
macbookpro 2018-12-08 16:47:30 +08:00
parent 2b79eec814
commit e02b12bb68
1 changed files with 6 additions and 0 deletions

View File

@ -151,6 +151,7 @@ func (client *RTSPClient) Start(timeout time.Duration) error {
}
client.Sdp = sess
client.SDPRaw = resp.Body
Session := ""
for _, media := range sess.Media {
switch media.Type {
case "video":
@ -168,6 +169,7 @@ func (client *RTSPClient) Start(timeout time.Duration) error {
if err != nil {
return err
}
Session = resp.Header["Session"]
case "audio":
client.AControl = media.Attributes.Get("control")
client.VCodec = media.Formats[0].Name
@ -183,9 +185,13 @@ func (client *RTSPClient) Start(timeout time.Duration) error {
if err != nil {
return err
}
Session = resp.Header["Session"]
}
}
headers = make(map[string]string)
if Session != "" {
headers["Session"] = Session
}
resp, err = client.Request("PLAY", headers)
if err != nil {
return err