mirror of
https://github.com/horgh/videostreamer.git
synced 2025-09-26 20:41:31 +08:00
Clean up HTML and some comments
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Now playing</title>
|
<title>videostreamer</title>
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, user-scalable=no">
|
<meta name="viewport" content="width=device-width, user-scalable=no">
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@@ -10,12 +9,10 @@ video {
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<h1>Now playing</h1>
|
<h1>videostreamer</h1>
|
||||||
|
|
||||||
<!--src="http://127.0.0.1:8081/stream" -->
|
|
||||||
<!-- src="out.mp4" -->
|
|
||||||
<video
|
<video
|
||||||
src="http://127.0.0.1:8081/stream"
|
src="http://127.0.0.1:8080/stream"
|
||||||
autoplay
|
autoplay
|
||||||
controls
|
controls
|
||||||
></video>
|
></video>
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// This library provides remuxing from a video stream (such as an RTSP
|
// This library provides remuxing from a video stream (such as an RTSP URL) to
|
||||||
// URL) to an MP4 container. It writes a fragmented MP4 so that it can be
|
// an MP4 container. It writes a fragmented MP4 so that it can be streamed to a
|
||||||
// streamed to a pipe.
|
// pipe.
|
||||||
//
|
//
|
||||||
// There is no re-encoding. The stream is copied as is.
|
// There is no re-encoding. The stream is copied as is.
|
||||||
//
|
//
|
||||||
|
@@ -37,8 +37,8 @@ type HTTPHandler struct {
|
|||||||
|
|
||||||
// Client is servicing one HTTP client.
|
// Client is servicing one HTTP client.
|
||||||
type Client struct {
|
type Client struct {
|
||||||
// packetWriter goroutine writes out video packets to this pipe. HTTP goroutine
|
// packetWriter goroutine writes out video packets to this pipe. HTTP
|
||||||
// reads from the read side.
|
// goroutine reads from the read side.
|
||||||
OutPipe *os.File
|
OutPipe *os.File
|
||||||
|
|
||||||
// Reference to a media output context. Through this, the packetWriter
|
// Reference to a media output context. Through this, the packetWriter
|
||||||
@@ -234,8 +234,8 @@ func cleanupClient(client *Client) {
|
|||||||
// Note one may think that draining both here and in the packetWriter could
|
// Note one may think that draining both here and in the packetWriter could
|
||||||
// lead to the unfortunate likelihood that the client will receive some
|
// lead to the unfortunate likelihood that the client will receive some
|
||||||
// packets but not others, leading to corruption. But since we closed the
|
// packets but not others, leading to corruption. But since we closed the
|
||||||
// write side of the pipe above, this will not happen. No further packets will
|
// write side of the pipe above, this will not happen. No further packets
|
||||||
// be reaching the client.
|
// will be reaching the client.
|
||||||
for pkt := range client.PacketChan {
|
for pkt := range client.PacketChan {
|
||||||
C.av_packet_free(&pkt)
|
C.av_packet_free(&pkt)
|
||||||
}
|
}
|
||||||
@@ -266,8 +266,8 @@ func openInput(inputFormat, inputURL string, verbose bool) *C.struct_VSInput {
|
|||||||
func writePacketToClients(input *C.struct_VSInput, pkt *C.AVPacket,
|
func writePacketToClients(input *C.struct_VSInput, pkt *C.AVPacket,
|
||||||
clients []*Client, verbose bool) []*Client {
|
clients []*Client, verbose bool) []*Client {
|
||||||
// Rewrite clients slice with only those we succeeded in writing to. If we
|
// Rewrite clients slice with only those we succeeded in writing to. If we
|
||||||
// failed for some reason we clean up the client and no longer send it anything
|
// failed for some reason we clean up the client and no longer send it
|
||||||
// further.
|
// anything further.
|
||||||
clients2 := []*Client{}
|
clients2 := []*Client{}
|
||||||
|
|
||||||
for _, client := range clients {
|
for _, client := range clients {
|
||||||
@@ -282,11 +282,12 @@ func writePacketToClients(input *C.struct_VSInput, pkt *C.AVPacket,
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// We pass packets to the client via this channel. We give each client its
|
// We pass packets to the client via this channel. We give each client
|
||||||
// own goroutine for the purposes of receiving these packets and writing them
|
// its own goroutine for the purposes of receiving these packets and
|
||||||
// to the write side of the pipe. We do it this way rather than directly here
|
// writing them to the write side of the pipe. We do it this way rather
|
||||||
// because we do not want the encoder to block waiting on a write to the
|
// than directly here because we do not want the encoder to block waiting
|
||||||
// write side of the pipe because there is a slow HTTP client.
|
// on a write to the write side of the pipe because there is a slow HTTP
|
||||||
|
// client.
|
||||||
client.PacketChan = make(chan *C.AVPacket, 32)
|
client.PacketChan = make(chan *C.AVPacket, 32)
|
||||||
|
|
||||||
go packetWriter(client, input, verbose)
|
go packetWriter(client, input, verbose)
|
||||||
|
Reference in New Issue
Block a user