mirror of https://bitbucket.org/ausocean/av.git
Merged in remove-ffmpeg-sender (pull request #164)
revid: remove ffmpegSender and any code pertaining to it.
This commit is contained in:
commit
ddc7ad4325
|
@ -219,12 +219,6 @@ func (r *Revid) reset(config Config) error {
|
|||
return err
|
||||
}
|
||||
r.destination = append(r.destination, s)
|
||||
case FfmpegRtmp:
|
||||
s, err := newFfmpegSender(config.RtmpUrl, fmt.Sprint(r.config.FrameRate))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
r.destination = append(r.destination, s)
|
||||
case Rtmp:
|
||||
s, err := newRtmpSender(config.RtmpUrl, rtmpConnectionTimeout, rtmpConnectionMaxTries, r.config.Logger.Log)
|
||||
if err != nil {
|
||||
|
|
|
@ -30,10 +30,8 @@ package revid
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
|
||||
"github.com/Comcast/gots/packet"
|
||||
|
@ -308,59 +306,6 @@ func (s *httpSender) release() {
|
|||
|
||||
func (s *httpSender) close() error { return nil }
|
||||
|
||||
// ffmpegSender implements loadSender for an FFMPEG RTMP destination.
|
||||
type ffmpegSender struct {
|
||||
ffmpeg io.WriteCloser
|
||||
|
||||
chunk *ring.Chunk
|
||||
}
|
||||
|
||||
func newFfmpegSender(url, framerate string) (*ffmpegSender, error) {
|
||||
cmd := exec.Command(ffmpegPath,
|
||||
"-f", "h264",
|
||||
"-r", framerate,
|
||||
"-i", "-",
|
||||
"-f", "lavfi",
|
||||
"-i", "aevalsrc=0",
|
||||
"-fflags", "nobuffer",
|
||||
"-vcodec", "copy",
|
||||
"-acodec", "aac",
|
||||
"-map", "0:0",
|
||||
"-map", "1:0",
|
||||
"-strict", "experimental",
|
||||
"-f", "flv",
|
||||
url,
|
||||
)
|
||||
w, err := cmd.StdinPipe()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = cmd.Start()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ffmpegSender{ffmpeg: w}, nil
|
||||
}
|
||||
|
||||
func (s *ffmpegSender) load(c *ring.Chunk) error {
|
||||
s.chunk = c
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *ffmpegSender) send() error {
|
||||
_, err := s.chunk.WriteTo(s.ffmpeg)
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *ffmpegSender) release() {
|
||||
s.chunk.Close()
|
||||
s.chunk = nil
|
||||
}
|
||||
|
||||
func (s *ffmpegSender) close() error {
|
||||
return s.ffmpeg.Close()
|
||||
}
|
||||
|
||||
// rtmpSender implements loadSender for a native RTMP destination.
|
||||
type rtmpSender struct {
|
||||
conn *rtmp.Conn
|
||||
|
|
Loading…
Reference in New Issue