Browse Source

1.临时去掉flv的单元测试

2.增加组包类型的判断
tags/v1.1.0
SmallChi(Koike) 5 years ago
parent
commit
08f6ebf085
7 changed files with 41 additions and 16 deletions
  1. +0
    -4
      .github/workflows/dotnetcore.yml
  2. +15
    -0
      src/JT1078.Hls/Enums/PackageType.cs
  3. +1
    -1
      src/JT1078.Hls/TSEncoder.cs
  4. +16
    -8
      src/JT1078.Hls/TS_Header.cs
  5. +3
    -1
      src/JT1078.Hls/TS_PAT_Package.cs
  6. +3
    -1
      src/JT1078.Hls/TS_PMT_Package.cs
  7. +3
    -1
      src/JT1078.Hls/TS_Segment_Package.cs

+ 0
- 4
.github/workflows/dotnetcore.yml View File

@@ -17,10 +17,6 @@ jobs:
run: dotnet --info
- name: dotnet restore
run: dotnet restore ./src/JT1078.sln
- name: dotnet JT1078.Protocol.Test build
run: dotnet build ./src/JT1078.Protocol.Test/JT1078.Protocol.Test.csproj
- name: dotnet JT1078.Protocol.Test test
run: dotnet test ./src/JT1078.Protocol.Test/JT1078.Protocol.Test.csproj
- name: dotnet JT808.Protocol.Extensions.JT1078.Test build
run: dotnet build ./src/JT808.Protocol.Extensions.JT1078.Test/JT808.Protocol.Extensions.JT1078.Test.csproj
- name: dotnet JT808.Protocol.Extensions.JT1078.Test test


+ 15
- 0
src/JT1078.Hls/Enums/PackageType.cs View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.Hls.Enums
{
public enum PackageType
{
PAT=1,
PMT=2,
Data_Start=3,
Data_Segment = 4,
Data_End = 5,
}
}

+ 1
- 1
src/JT1078.Hls/TSEncoder.cs View File

@@ -199,7 +199,6 @@ namespace JT1078.Hls
package.Payload.Payload.NALUs.Add(dataReader.Slice(index, remainingLength).ToArray());
index += remainingLength;
package.ToBuffer(ref messagePackReader);

while(index!= jt1078Package.Bodies.Length)
{
if (counter > 0xf)
@@ -240,6 +239,7 @@ namespace JT1078.Hls
//package.Header.Adaptation.FillSize
if (nalu.Length < FiexdSegmentPESLength)
{
package.Header.PackageType = PackageType.Data_End;
package.Header.Adaptation = new TS_AdaptationInfo();
package.Header.Adaptation.PCRIncluded = PCRInclude.不包含;
package.Header.Adaptation.FillSize = (byte)(FiexdSegmentPESLength - nalu.Length);


+ 16
- 8
src/JT1078.Hls/TS_Header.cs View File

@@ -57,6 +57,8 @@ namespace JT1078.Hls
/// </summary>
public TS_AdaptationInfo Adaptation { get; set; }

public PackageType PackageType { get; set; }

public void ToBuffer(ref TSMessagePackWriter writer)
{
writer.WriteByte(SyncByte);
@@ -64,16 +66,22 @@ namespace JT1078.Hls
//0 1 0 0000 0000 0000 0
writer.WriteUInt16((ushort)(0b_0100_0000_0000_0000 | PID));
writer.WriteByte((byte)((byte)AdaptationFieldControl | ContinuityCounter));
if (Adaptation != null)
if(PackageType== PackageType.PAT ||
PackageType == PackageType.PMT ||
PackageType == PackageType.Data_Start ||
PackageType == PackageType.Data_End)
{
writer.Skip(1, out int AdaptationLengthPosition);
Adaptation.ToBuffer(ref writer);
writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - AdaptationLengthPosition - 1), AdaptationLengthPosition);
if (Adaptation != null)
{
writer.Skip(1, out int AdaptationLengthPosition);
Adaptation.ToBuffer(ref writer);
writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - AdaptationLengthPosition - 1), AdaptationLengthPosition);
}
else
{
writer.WriteByte(0);
}
}
else
{
writer.WriteByte(0);
}
}
}
}

+ 3
- 1
src/JT1078.Hls/TS_PAT_Package.cs View File

@@ -1,4 +1,5 @@
using JT1078.Hls.Interfaces;
using JT1078.Hls.Enums;
using JT1078.Hls.Interfaces;
using JT1078.Hls.MessagePack;
using System;
using System.Collections.Generic;
@@ -78,6 +79,7 @@ namespace JT1078.Hls

public void ToBuffer(ref TSMessagePackWriter writer)
{
Header.PackageType = PackageType.PAT;
Header.ToBuffer(ref writer);
writer.WriteByte(TableId);
//SectionSyntaxIndicator Zero Reserved1 SectionLength


+ 3
- 1
src/JT1078.Hls/TS_PMT_Package.cs View File

@@ -1,4 +1,5 @@
using JT1078.Hls.Interfaces;
using JT1078.Hls.Enums;
using JT1078.Hls.Interfaces;
using JT1078.Hls.MessagePack;
using System;
using System.Collections.Generic;
@@ -95,6 +96,7 @@ namespace JT1078.Hls
public uint CRC32 { get; set; }
public void ToBuffer(ref TSMessagePackWriter writer)
{
Header.PackageType = PackageType.PMT;
Header.ToBuffer(ref writer);
writer.WriteByte(TableId);
//SectionSyntaxIndicator Zero Reserved1 SectionLength


+ 3
- 1
src/JT1078.Hls/TS_Segment_Package.cs View File

@@ -1,4 +1,5 @@
using JT1078.Hls.Interfaces;
using JT1078.Hls.Enums;
using JT1078.Hls.Interfaces;
using JT1078.Hls.MessagePack;
using System;
using System.Collections.Generic;
@@ -12,6 +13,7 @@ namespace JT1078.Hls
public byte[] Payload { get; set; }
public void ToBuffer(ref TSMessagePackWriter writer)
{
Header.PackageType = PackageType.Data_Segment;
Header.ToBuffer(ref writer);
writer.WriteArray(Payload);
}


Loading…
Cancel
Save