Include pkg name in fatal log messages.

This commit is contained in:
scruzin 2019-01-09 16:08:02 +10:30
parent cbe6149c8f
commit 88e1415b10
1 changed files with 24 additions and 24 deletions

View File

@ -236,7 +236,7 @@ func handlePacket(s *Session, pkt *packet) int32 {
s.serverBW = int32(C_AMF_DecodeInt32(pkt.body[:4]))
case RTMP_PACKET_TYPE_CONTROL:
s.log(FatalLevel, "unsupported packet type RTMP_PACKET_TYPE_CONTROL")
s.log(FatalLevel, pkg+"unsupported packet type RTMP_PACKET_TYPE_CONTROL")
case RTMP_PACKET_TYPE_SERVER_BW:
s.serverBW = int32(C_AMF_DecodeInt32(pkt.body[:4]))
@ -250,16 +250,16 @@ func handlePacket(s *Session, pkt *packet) int32 {
}
case RTMP_PACKET_TYPE_AUDIO:
s.log(FatalLevel, "unsupported packet type RTMP_PACKET_TYPE_AUDIO")
s.log(FatalLevel, pkg+"unsupported packet type RTMP_PACKET_TYPE_AUDIO")
case RTMP_PACKET_TYPE_VIDEO:
s.log(FatalLevel, "unsupported packet type RTMP_PACKET_TYPE_VIDEO")
s.log(FatalLevel, pkg+"unsupported packet type RTMP_PACKET_TYPE_VIDEO")
case RTMP_PACKET_TYPE_FLEX_MESSAGE:
s.log(FatalLevel, "unsupported packet type RTMP_PACKET_TYPE_FLEX_MESSAGE")
s.log(FatalLevel, pkg+"unsupported packet type RTMP_PACKET_TYPE_FLEX_MESSAGE")
case RTMP_PACKET_TYPE_INFO:
s.log(FatalLevel, "unsupported packet type RTMP_PACKET_TYPE_INFO")
s.log(FatalLevel, pkg+"unsupported packet type RTMP_PACKET_TYPE_INFO")
case RTMP_PACKET_TYPE_INVOKE:
err := handleInvoke(s, pkt.body[:pkt.bodySize])
@ -270,7 +270,7 @@ func handlePacket(s *Session, pkt *packet) int32 {
}
case RTMP_PACKET_TYPE_FLASH_VIDEO:
s.log(FatalLevel, "unsupported packet type RTMP_PACKET_TYPE_FLASH_VIDEO")
s.log(FatalLevel, pkg+"unsupported packet type RTMP_PACKET_TYPE_FLASH_VIDEO")
default:
s.log(WarnLevel, pkg+"unknown packet type", "type", pkt.packetType)
@ -693,7 +693,7 @@ func handleInvoke(s *Session, body []byte) error {
}
meth := C_AMFProp_GetString(C_AMF_GetProp(&obj, "", 0))
s.log(DebugLevel, pkg+"invoking", "method", meth)
s.log(DebugLevel, pkg+"invoking method "+meth)
txn := C_AMFProp_GetNumber(C_AMF_GetProp(&obj, "", 1))
switch meth {
@ -715,19 +715,19 @@ func handleInvoke(s *Session, body []byte) error {
switch methodInvoked {
case av_connect:
if s.link.token != "" {
s.log(FatalLevel, "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, "link protocol has no RTMP_FEATURE_WRITE")
s.log(FatalLevel, pkg+"link protocol has no RTMP_FEATURE_WRITE")
}
sendCreateStream(s)
if (s.link.protocol & RTMP_FEATURE_WRITE) == 0 {
s.log(FatalLevel, "link protocol has no RTMP_FEATURE_WRITE")
s.log(FatalLevel, pkg+"link protocol has no RTMP_FEATURE_WRITE")
}
case av_createStream:
@ -736,11 +736,11 @@ func handleInvoke(s *Session, body []byte) error {
if s.link.protocol&RTMP_FEATURE_WRITE != 0 {
sendPublish(s)
} else {
s.log(FatalLevel, "link protocol has no RTMP_FEATURE_WRITE")
s.log(FatalLevel, pkg+"link protocol has no RTMP_FEATURE_WRITE")
}
case av_play, av_publish:
s.log(FatalLevel, "unsupported method av_play/av_publish")
s.log(FatalLevel, pkg+"unsupported method av_play/av_publish")
}
case av_onBWDone:
@ -749,19 +749,19 @@ func handleInvoke(s *Session, body []byte) error {
}
case av_onFCUnsubscribe, av_onFCSubscribe:
s.log(FatalLevel, "unsupported method av_onFCUnsubscribe/av_onFCSubscribe")
s.log(FatalLevel, pkg+"unsupported method av_onFCUnsubscribe/av_onFCSubscribe")
case av_ping:
s.log(FatalLevel, "unsupported method av_ping")
s.log(FatalLevel, pkg+"unsupported method av_ping")
case av__onbwcheck:
s.log(FatalLevel, "unsupported method av_onbwcheck")
s.log(FatalLevel, pkg+"unsupported method av_onbwcheck")
case av__onbwdone:
s.log(FatalLevel, "unsupported method av_onbwdone")
s.log(FatalLevel, pkg+"unsupported method av_onbwdone")
case av_close:
s.log(FatalLevel, "unsupported method av_close")
s.log(FatalLevel, pkg+"unsupported method av_close")
case av_onStatus:
var obj2 C_AMFObject
@ -773,10 +773,10 @@ func handleInvoke(s *Session, body []byte) error {
switch code {
case av_NetStream_Failed, av_NetStream_Play_Failed,
av_NetStream_Play_StreamNotFound, av_NetConnection_Connect_InvalidApp:
s.log(FatalLevel, "unsupported method av_NetStream/av_NetStream_Play_Failed/av_netSTream_Play_StreamNotFound/av_netConnection_Connect_invalidApp")
s.log(FatalLevel, pkg+"unsupported method av_NetStream/av_NetStream_Play_Failed/av_netSTream_Play_StreamNotFound/av_netConnection_Connect_invalidApp")
case av_NetStream_Play_Start, av_NetStream_Play_PublishNotify:
s.log(FatalLevel, "unsupported method av_NetStream_Play_Start/av_NetStream_Play_PublishNotify")
s.log(FatalLevel, pkg+"unsupported method av_NetStream_Play_Start/av_NetStream_Play_PublishNotify")
case av_NetStream_Publish_Start:
s.isPlaying = true
@ -788,20 +788,20 @@ func handleInvoke(s *Session, body []byte) error {
}
case av_NetStream_Play_Complete, av_NetStream_Play_Stop, av_NetStream_Play_UnpublishNotify:
s.log(FatalLevel, "unsupported method av_NetStream_Play_Complete/av_NetStream_Play_Stop/av_NetStream_Play_UnpublishNotify")
s.log(FatalLevel, pkg+"unsupported method av_NetStream_Play_Complete/av_NetStream_Play_Stop/av_NetStream_Play_UnpublishNotify")
case av_NetStream_Seek_Notify:
s.log(FatalLevel, "unsupported method av_netStream_Seek_Notify")
s.log(FatalLevel, pkg+"unsupported method av_netStream_Seek_Notify")
case av_NetStream_Pause_Notify:
s.log(FatalLevel, "unsupported method av_NetStream_Pause_Notify")
s.log(FatalLevel, pkg+"unsupported method av_NetStream_Pause_Notify")
}
case av_playlist_ready:
s.log(FatalLevel, "unsupported method av_playlist_ready")
s.log(FatalLevel, pkg+"unsupported method av_playlist_ready")
default:
s.log(FatalLevel, "unknown method", "method", meth)
s.log(FatalLevel, pkg+"unknown method "+meth)
}
leave:
C_AMF_Reset(&obj)