mirror of https://bitbucket.org/ausocean/av.git
Removed continuity check and also checked read error rather than whether or not clip is nil.
This commit is contained in:
parent
0f028b799c
commit
d63b5f6751
|
@ -303,7 +303,7 @@ func output(output string) {
|
|||
now := time.Now()
|
||||
prevTime := now
|
||||
for {
|
||||
if clip, clipSize, _ := ringBuffer.Read(); clip != nil {
|
||||
if clip, clipSize, err := ringBuffer.Read(); err == nil {
|
||||
now := time.Now()
|
||||
err := sendClip(clip[:clipSize], output, conn)
|
||||
for err != nil {
|
||||
|
@ -338,10 +338,6 @@ func sendClipToFile(clip []byte, _ string, _ net.Conn) error {
|
|||
|
||||
// sendClipToHTPP posts a video clip via HTTP, using a new TCP connection each time.
|
||||
func sendClipToHTTP(clip []byte, output string, _ net.Conn) error {
|
||||
if err := checkContinuityCounts(clip); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
timeout := time.Duration(httpTimeOut * time.Second)
|
||||
client := http.Client{
|
||||
Timeout: timeout,
|
||||
|
@ -397,13 +393,12 @@ func sendClipToRTP(clip []byte, _ string, conn net.Conn) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// checkContinuityCounts checks that the continuity of the clip is correct
|
||||
func checkContinuityCounts(clip []byte) error {
|
||||
for offset := 0; offset < len(clip); offset += mp2tPacketSize {
|
||||
dumpCC = -1
|
||||
pkt := clip[offset : offset+mp2tPacketSize]
|
||||
|
||||
cc := int(pkt[3] & 0xf)
|
||||
|
||||
if dumpCC != -1 && cc != dumpCC {
|
||||
return fmt.Errorf("Continuity count out of order. Expected %v, Got: %v.", dumpCC, cc)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue