Skip to content

Commit

Permalink
Clean up HTML and some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nickorzha committed Jan 2, 2017
1 parent 952f486 commit 0d16876
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
9 changes: 3 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Now playing</title>

<title>videostreamer</title>
<meta name="viewport" content="width=device-width, user-scalable=no">

<style>
Expand All @@ -10,12 +9,10 @@
}
</style>

<h1>Now playing</h1>
<h1>videostreamer</h1>

<!--src="http://127.0.0.1:8081/stream" -->
<!-- src="out.mp4" -->
<video
src="http://127.0.0.1:8081/stream"
src="http://127.0.0.1:8080/stream"
autoplay
controls
></video>
6 changes: 3 additions & 3 deletions videostreamer.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// This library provides remuxing from a video stream (such as an RTSP
// URL) to an MP4 container. It writes a fragmented MP4 so that it can be
// streamed to a pipe.
// This library provides remuxing from a video stream (such as an RTSP URL) to
// an MP4 container. It writes a fragmented MP4 so that it can be streamed to a
// pipe.
//
// There is no re-encoding. The stream is copied as is.
//
Expand Down
23 changes: 12 additions & 11 deletions videostreamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ type HTTPHandler struct {

// Client is servicing one HTTP client.
type Client struct {
// packetWriter goroutine writes out video packets to this pipe. HTTP goroutine
// reads from the read side.
// packetWriter goroutine writes out video packets to this pipe. HTTP
// goroutine reads from the read side.
OutPipe *os.File

// Reference to a media output context. Through this, the packetWriter
Expand Down Expand Up @@ -234,8 +234,8 @@ func cleanupClient(client *Client) {
// Note one may think that draining both here and in the packetWriter could
// lead to the unfortunate likelihood that the client will receive some
// 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
// be reaching the client.
// write side of the pipe above, this will not happen. No further packets
// will be reaching the client.
for pkt := range client.PacketChan {
C.av_packet_free(&pkt)
}
Expand Down Expand Up @@ -266,8 +266,8 @@ func openInput(inputFormat, inputURL string, verbose bool) *C.struct_VSInput {
func writePacketToClients(input *C.struct_VSInput, pkt *C.AVPacket,
clients []*Client, verbose bool) []*Client {
// 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
// further.
// failed for some reason we clean up the client and no longer send it
// anything further.
clients2 := []*Client{}

for _, client := range clients {
Expand All @@ -282,11 +282,12 @@ func writePacketToClients(input *C.struct_VSInput, pkt *C.AVPacket,
continue
}

// We pass packets to the client via this channel. We give each client its
// own goroutine for the purposes of receiving these packets and writing them
// to the write side of the pipe. We do it this way rather than directly here
// because we do not want the encoder to block waiting on a write to the
// write side of the pipe because there is a slow HTTP client.
// We pass packets to the client via this channel. We give each client
// its own goroutine for the purposes of receiving these packets and
// writing them to the write side of the pipe. We do it this way rather
// than directly here because we do not want the encoder to block waiting
// on a write to the write side of the pipe because there is a slow HTTP
// client.
client.PacketChan = make(chan *C.AVPacket, 32)

go packetWriter(client, input, verbose)
Expand Down

0 comments on commit 0d16876

Please sign in to comment.