Need to debug on my puter, so updating remote

This commit is contained in:
Jack Richardson 2018-01-17 11:58:08 +10:30
parent 309de69964
commit 72de1758ed
4 changed files with 11 additions and 9 deletions

View File

@ -60,7 +60,6 @@ func (p* H264Parser)Parse() {
p.isParsing = true p.isParsing = true
outputBuffer := make([]byte, 0, 10000) outputBuffer := make([]byte, 0, 10000)
searchingForEnd := false searchingForEnd := false
p.InputByteChan = make(chan byte, 10000)
for p.isParsing { for p.isParsing {
aByte := <-p.InputByteChan aByte := <-p.InputByteChan
outputBuffer = append(outputBuffer, aByte) outputBuffer = append(outputBuffer, aByte)
@ -77,8 +76,6 @@ func (p* H264Parser)Parse() {
aByte = <-p.InputByteChan aByte = <-p.InputByteChan
outputBuffer = append(outputBuffer, aByte) outputBuffer = append(outputBuffer, aByte)
if nalType := aByte & 0x1F; nalType == 1 || nalType == 5 { if nalType := aByte & 0x1F; nalType == 1 || nalType == 5 {
if firstRunThrough {
spsPpsSei = append(spsPpsSei,
searchingForEnd = true searchingForEnd = true
} }
} }

View File

@ -31,7 +31,6 @@ package mpegts
import ( import (
"bitbucket.org/ausocean/av/tools" "bitbucket.org/ausocean/av/tools"
"errors" "errors"
_"fmt"
) )
const ( const (
@ -135,9 +134,13 @@ func (p *MpegTsPacket) FillPayload(channel chan byte){
p.Payload = make([]byte,0,mpegtsPayloadSize) p.Payload = make([]byte,0,mpegtsPayloadSize)
currentPktLength := 6 + int(tools.BoolToByte(p.PCRF))*6+int(tools.BoolToByte(p.OPCRF))*6+ currentPktLength := 6 + int(tools.BoolToByte(p.PCRF))*6+int(tools.BoolToByte(p.OPCRF))*6+
int(tools.BoolToByte(p.SPF))*1+int(tools.BoolToByte(p.TPDF))*1+len(p.TPD) int(tools.BoolToByte(p.SPF))*1+int(tools.BoolToByte(p.TPDF))*1+len(p.TPD)
for len(channel) > 0 && (currentPktLength+len(p.Payload)) < 188 { for (currentPktLength+len(p.Payload)) < 188 {
nextByte := <-channel select {
case nextByte := <-channel:
p.Payload = append(p.Payload,nextByte) p.Payload = append(p.Payload,nextByte)
default:
return
}
} }
} }

View File

@ -143,6 +143,7 @@ func NewRevidInstance(config Config) (r *revidInst, err error) {
} }
r.generator = tsgenerator.NewTsGenerator(framesPerSec) r.generator = tsgenerator.NewTsGenerator(framesPerSec)
r.h264Parser = h264.H264Parser{OutputChan: r.generator.GetNalInputChan()} r.h264Parser = h264.H264Parser{OutputChan: r.generator.GetNalInputChan()}
r.h264Parser.InputByteChan = make(chan byte, 10000)
// TODO: Need to create constructor for parser otherwise I'm going to break // TODO: Need to create constructor for parser otherwise I'm going to break
// something eventuallyl // something eventuallyl
go r.h264Parser.Parse() go r.h264Parser.Parse()
@ -162,7 +163,7 @@ func (r *revidInst) Start() {
switch r.config.Input { switch r.config.Input {
case Raspivid: case Raspivid:
cmd = exec.Command("raspivid", "-o", "-", "-n", "-t", "0", "-b", cmd = exec.Command("raspivid", "-o", "-", "-n", "-t", "0", "-b",
r.config.Bitrate, "-w", r.config.Width, "-h", r.config.Height, "-fps", r.config.FrameRate) r.config.Bitrate, "-w", r.config.Width, "-h", r.config.Height, "-fps", r.config.FrameRate, "-ih", "-g", "100")
stdout, _ := cmd.StdoutPipe() stdout, _ := cmd.StdoutPipe()
err := cmd.Start() err := cmd.Start()
inputReader = bufio.NewReader(stdout) inputReader = bufio.NewReader(stdout)

View File

@ -29,7 +29,7 @@ LICENSE
package tsgenerator package tsgenerator
import ( import (
_ "fmt" "fmt"
_"os" _"os"
"bitbucket.org/ausocean/av/mpegts" "bitbucket.org/ausocean/av/mpegts"
"bitbucket.org/ausocean/av/pes" "bitbucket.org/ausocean/av/pes"
@ -270,6 +270,7 @@ func (g *tsGenerator) Generate() {
} }
} }
} }
fmt.Println("\n\n\nGetting out of generate!\n\n\n")
} }
func (g *tsGenerator) getCC(pid int) int { func (g *tsGenerator) getCC(pid int) int {