Skip to content

Commit

Permalink
Improve code quality
Browse files Browse the repository at this point in the history
Signed-off-by: Leo Ma <[email protected]>
  • Loading branch information
begeekmyfriend committed Aug 12, 2017
1 parent 267aac5 commit 57f23a3
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions library/src/main/java/net/ossrs/yasea/SrsFlvMuxer.java
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,6 @@ public SrsFlvFrameBytes demuxAnnexb(ByteBuffer bb, MediaCodec.BufferInfo bi, boo
tbb.data = bb.slice();
tbb.size = bi.size - bb.position();
}

return tbb;
}
}
Expand Down Expand Up @@ -854,15 +853,10 @@ public void writeVideoSample(final ByteBuffer bb, MediaCodec.BufferInfo bi) {
int dts = pts;
int type = SrsCodecVideoAVCFrame.InterFrame;
SrsFlvFrameBytes frame = avc.demuxAnnexb(bb, bi, true);
int nal_unit_type = (int)(frame.data.get(0) & 0x1f);
if (nal_unit_type == SrsAvcNaluType.NonIDR)
{

} else if (nal_unit_type == SrsAvcNaluType.IDR)
{
int nal_unit_type = frame.data.get(0) & 0x1f;
if (nal_unit_type == SrsAvcNaluType.IDR) {
type = SrsCodecVideoAVCFrame.KeyFrame;
} else if (nal_unit_type == SrsAvcNaluType.SPS || nal_unit_type == SrsAvcNaluType.PPS)
{
} else if (nal_unit_type == SrsAvcNaluType.SPS || nal_unit_type == SrsAvcNaluType.PPS) {
if (!frame.data.equals(h264_sps)) {
byte[] sps = new byte[frame.size];
frame.data.get(sps);
Expand All @@ -879,8 +873,9 @@ public void writeVideoSample(final ByteBuffer bb, MediaCodec.BufferInfo bi) {
writeH264SpsPps(dts, pts);
}
return;
} else
} else if (nal_unit_type != SrsAvcNaluType.NonIDR) {
return;
}

ipbs.add(avc.muxNaluHeader(frame));
ipbs.add(frame);
Expand Down

0 comments on commit 57f23a3

Please sign in to comment.