mirror of https://bitbucket.org/ausocean/av.git
removed bad free and added better to clean output chan
This commit is contained in:
parent
c56f414229
commit
39e6a785ef
|
@ -64,7 +64,6 @@ const (
|
|||
ringBufferElementSize = 150000
|
||||
httpTimeOut = 5 // s
|
||||
packetsPerFrame = 7
|
||||
h264BufferSize = 1000000
|
||||
bitrateTime = 60 // s
|
||||
mjpegParserInChanLen = 100000
|
||||
ffmpegPath = "/usr/local/bin/ffmpeg"
|
||||
|
@ -298,9 +297,14 @@ func (r *revid) getFramePacketization() []byte {
|
|||
|
||||
// flushDataPacketization removes data from the revid inst's coutput chan
|
||||
func (r *revid) flushData() {
|
||||
for len(r.outputChan) > 0 {
|
||||
<-(r.outputChan)
|
||||
for {
|
||||
select {
|
||||
case <-r.outputChan:
|
||||
default:
|
||||
goto done
|
||||
}
|
||||
}
|
||||
done:
|
||||
}
|
||||
|
||||
// packClips takes data segments; whether that be tsPackets or mjpeg frames and
|
||||
|
|
|
@ -70,17 +70,14 @@ unsigned int RTMP_write_frame(char* data, uint data_length){
|
|||
if (!RTMP_IsConnected(rtmp)) {
|
||||
printf("RTMP is not connected!\n");
|
||||
free(dataForC);
|
||||
free(data);
|
||||
return 0;
|
||||
}
|
||||
if (!RTMP_Write(rtmp, (const char*)data, data_length)) {
|
||||
printf("RTMP write error!\n");
|
||||
free(dataForC);
|
||||
free(data);
|
||||
return 0;
|
||||
}
|
||||
free(dataForC);
|
||||
free(data);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue