Skip to content

Commit

Permalink
H264Packetizer now adds NALU type 7 and 8 in the stream.
Browse files Browse the repository at this point in the history
  • Loading branch information
fyhertz committed Oct 6, 2013
1 parent c051416 commit 407f9cb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/net/majorkernelpanic/streaming/rtp/H264Packetizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public void run() {
delta2 += duration/1000000;
if (delta2>5000) {
// Every 5 secondes, we send two packets containing NALU type 7 (sps) and 8 (pps)
// Those should allow the H264 stream to be decoded even if no SDP was sent to the decoder.
delta2 = 0;
if (sps != null) {
buffer = socket.requestBuffer();
Expand Down Expand Up @@ -158,6 +159,11 @@ private void send() throws IOException, InterruptedException {

// Parses the NAL unit type
type = header[4]&0x1F;

// The stream already contains NAL unit type 7 or 8, we don't need
// to add them to the stream ourselves
if (type == 7) sps = null;
if (type == 8) pps = null;

// Updates the timestamp
ts += delay;
Expand Down

0 comments on commit 407f9cb

Please sign in to comment.