mirror of https://github.com/q191201771/lal.git
commit messages:
* rtmp.ServerSession 使用channel发送数据,增加Dispose方法 * rtmp.Group 缓存avc header,aac headerpull/200/head
parent
3630b7568d
commit
79ebdbe8c8
@ -0,0 +1,45 @@
|
||||
package avc
|
||||
|
||||
// H.264-AVC-ISO_IEC_14496-15.pdf
|
||||
// 5.2.4 Decoder configuration information
|
||||
|
||||
// <buf> body of tag
|
||||
//func parseAVCSeqHeader(buf []byte) (sps, pps []byte, err error) {
|
||||
// // TODO chef: check if read out of <buf> range
|
||||
//
|
||||
// if buf[0] != AVCKey || buf[1] != isAVCKeySeqHeader || buf[2] != 0 || buf[3] != 0 || buf[4] != 0 {
|
||||
// log.Error("parse avc seq header failed.")
|
||||
// err = httpFlvErr
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// //configurationVersion := buf[5]
|
||||
// //avcProfileIndication := buf[6]
|
||||
// //profileCompatibility := buf[7]
|
||||
// //avcLevelIndication := buf[8]
|
||||
// //lengthSizeMinusOne := buf[9] & 0x03
|
||||
//
|
||||
// index := 10
|
||||
//
|
||||
// numOfSPS := int(buf[index] & 0x1F)
|
||||
// index++
|
||||
// // TODO chef: if the situation of multi sps exist?
|
||||
// // only take the last one.
|
||||
// for i := 0; i < numOfSPS; i++ {
|
||||
// lenOfSPS := int(bele.BEUint16(buf[index:]))
|
||||
// index += 2
|
||||
// sps = append(sps, buf[index:index+lenOfSPS]...)
|
||||
// index += lenOfSPS
|
||||
// }
|
||||
//
|
||||
// numOfPPS := int(buf[index] & 0x1F)
|
||||
// index++
|
||||
// for i := 0; i < numOfPPS; i++ {
|
||||
// lenOfPPS := int(bele.BEUint16(buf[index:]))
|
||||
// index += 2
|
||||
// pps = append(pps, buf[index:index+lenOfPPS]...)
|
||||
// index += lenOfPPS
|
||||
// }
|
||||
//
|
||||
// return
|
||||
//}
|
@ -1,52 +0,0 @@
|
||||
package httpflv
|
||||
|
||||
import (
|
||||
"github.com/q191201771/lal/pkg/util/bele"
|
||||
"github.com/q191201771/lal/pkg/util/log"
|
||||
)
|
||||
|
||||
// TODO chef: move me to other packet
|
||||
|
||||
// H.264-AVC-ISO_IEC_14496-15.pdf
|
||||
// 5.2.4 Decoder configuration information
|
||||
|
||||
// <buf> body of tag
|
||||
func parseAVCSeqHeader(buf []byte) (sps, pps []byte, err error) {
|
||||
// TODO chef: check if read out of <buf> range
|
||||
|
||||
if buf[0] != AVCKey || buf[1] != isAVCKeySeqHeader || buf[2] != 0 || buf[3] != 0 || buf[4] != 0 {
|
||||
log.Error("parse avc seq header failed.")
|
||||
err = httpFlvErr
|
||||
return
|
||||
}
|
||||
|
||||
//configurationVersion := buf[5]
|
||||
//avcProfileIndication := buf[6]
|
||||
//profileCompatibility := buf[7]
|
||||
//avcLevelIndication := buf[8]
|
||||
//lengthSizeMinusOne := buf[9] & 0x03
|
||||
|
||||
index := 10
|
||||
|
||||
numOfSPS := int(buf[index] & 0x1F)
|
||||
index++
|
||||
// TODO chef: if the situation of multi sps exist?
|
||||
// only take the last one.
|
||||
for i := 0; i < numOfSPS; i++ {
|
||||
lenOfSPS := int(bele.BEUint16(buf[index:]))
|
||||
index += 2
|
||||
sps = append(sps, buf[index:index+lenOfSPS]...)
|
||||
index += lenOfSPS
|
||||
}
|
||||
|
||||
numOfPPS := int(buf[index] & 0x1F)
|
||||
index++
|
||||
for i := 0; i < numOfPPS; i++ {
|
||||
lenOfPPS := int(bele.BEUint16(buf[index:]))
|
||||
index += 2
|
||||
pps = append(pps, buf[index:index+lenOfPPS]...)
|
||||
index += lenOfPPS
|
||||
}
|
||||
|
||||
return
|
||||
}
|
@ -1,24 +1,29 @@
|
||||
package bininfo
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
// 编译时通过如下方式传入编译时信息
|
||||
// go build -ldflags " \
|
||||
// -X 'github.com/q191201771/lal/pkg/bininfo.BuildTime=`date +'%Y.%m.%d.%H%M%S'`' \
|
||||
// -X 'github.com/q191201771/lal/pkg/bininfo.GitCommitID=`git log --pretty=format:'%h' -n 1`' \
|
||||
// -X 'github.com/q191201771/lal/pkg/bininfo.GoVersion=`go version`' \
|
||||
// -X 'github.com/q191201771/lal/pkg/util/bininfo.GitCommitID=`git log --pretty=format:'%h' -n 1`' \
|
||||
// -X 'github.com/q191201771/lal/pkg/util/bininfo.BuildTime=`date +'%Y.%m.%d.%H%M%S'`' \
|
||||
// -X 'github.com/q191201771/lal/pkg/util/bininfo.BuildGoVersion=`go version`' \
|
||||
// "
|
||||
|
||||
var (
|
||||
BuildTime string
|
||||
GitCommitID string
|
||||
GoVersion string
|
||||
BuildTime string
|
||||
BuildGoVersion string
|
||||
)
|
||||
|
||||
func StringifySingleLine() string {
|
||||
return fmt.Sprintf("BuildTime: %s. GitCommitID: %s. GoVersion: %s.", BuildTime, GitCommitID, GoVersion)
|
||||
return fmt.Sprintf("GitCommitID: %s. BuildTime: %s. GoVersion: %s. runtime: %s/%s",
|
||||
GitCommitID, BuildTime, BuildGoVersion, runtime.GOOS, runtime.GOARCH)
|
||||
}
|
||||
|
||||
func StringifyMultiLine() string {
|
||||
return fmt.Sprintf("BuildTime: %s\nGitCommitID: %s\nGoVersion: %s\n", BuildTime, GitCommitID, GoVersion)
|
||||
return fmt.Sprintf("GitCommitID: %s\nBuildTime: %s\nGoVersion: %s\nruntime: %s/%s",
|
||||
GitCommitID, BuildTime, BuildGoVersion, runtime.GOOS, runtime.GOARCH)
|
||||
}
|
||||
|
Loading…
Reference in New Issue