mirror of https://bitbucket.org/ausocean/av.git
Propagate errors from handleInvoke().
This commit is contained in:
parent
058cc41356
commit
f635be6712
40
rtmp/rtmp.go
40
rtmp/rtmp.go
|
@ -121,6 +121,7 @@ var (
|
||||||
errUnknownScheme = errors.New("rtmp: unknown scheme")
|
errUnknownScheme = errors.New("rtmp: unknown scheme")
|
||||||
errConnected = errors.New("rtmp: already connected")
|
errConnected = errors.New("rtmp: already connected")
|
||||||
errNotConnected = errors.New("rtmp: not connected")
|
errNotConnected = errors.New("rtmp: not connected")
|
||||||
|
errNotWritable = errors.New("rtmp: connection not writable")
|
||||||
errHandshake = errors.New("rtmp: handshake failed")
|
errHandshake = errors.New("rtmp: handshake failed")
|
||||||
errConnSend = errors.New("rtmp: connection send error")
|
errConnSend = errors.New("rtmp: connection send error")
|
||||||
errConnStream = errors.New("rtmp: connection stream error")
|
errConnStream = errors.New("rtmp: connection stream error")
|
||||||
|
@ -675,27 +676,31 @@ func handleInvoke(s *Session, body []byte) error {
|
||||||
case av_connect:
|
case av_connect:
|
||||||
if s.link.token != "" {
|
if s.link.token != "" {
|
||||||
s.log(FatalLevel, pkg+"no support for link token")
|
s.log(FatalLevel, pkg+"no support for link token")
|
||||||
|
|
||||||
}
|
}
|
||||||
if (s.link.protocol & RTMP_FEATURE_WRITE) != 0 {
|
|
||||||
sendReleaseStream(s)
|
|
||||||
sendFCPublish(s)
|
|
||||||
} else {
|
|
||||||
s.log(FatalLevel, pkg+"link protocol has no RTMP_FEATURE_WRITE")
|
|
||||||
}
|
|
||||||
|
|
||||||
sendCreateStream(s)
|
|
||||||
if (s.link.protocol & RTMP_FEATURE_WRITE) == 0 {
|
if (s.link.protocol & RTMP_FEATURE_WRITE) == 0 {
|
||||||
s.log(FatalLevel, pkg+"link protocol has no RTMP_FEATURE_WRITE")
|
return errNotWritable
|
||||||
|
}
|
||||||
|
err := sendReleaseStream(s)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = sendFCPublish(s)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = sendCreateStream(s)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
case av_createStream:
|
case av_createStream:
|
||||||
s.streamID = int32(C_AMFProp_GetNumber(C_AMF_GetProp(&obj, "", 3)))
|
s.streamID = int32(C_AMFProp_GetNumber(C_AMF_GetProp(&obj, "", 3)))
|
||||||
|
if s.link.protocol&RTMP_FEATURE_WRITE == 0 {
|
||||||
if s.link.protocol&RTMP_FEATURE_WRITE != 0 {
|
return errNotWritable
|
||||||
sendPublish(s)
|
}
|
||||||
} else {
|
err := sendPublish(s)
|
||||||
s.log(FatalLevel, pkg+"link protocol has no RTMP_FEATURE_WRITE")
|
if err != nil {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
case av_play, av_publish:
|
case av_play, av_publish:
|
||||||
|
@ -704,7 +709,10 @@ func handleInvoke(s *Session, body []byte) error {
|
||||||
|
|
||||||
case av_onBWDone:
|
case av_onBWDone:
|
||||||
if s.checkCounter == 0 { // ToDo: why is this always zero?
|
if s.checkCounter == 0 { // ToDo: why is this always zero?
|
||||||
sendCheckBW(s)
|
err := sendCheckBW(s)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case av_onFCUnsubscribe, av_onFCSubscribe:
|
case av_onFCUnsubscribe, av_onFCSubscribe:
|
||||||
|
|
Loading…
Reference in New Issue