-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathSpeexPacket.cs
52 lines (34 loc) · 989 Bytes
/
SpeexPacket.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
namespace NSpeex
{
public class SpeexPacket
{
public int FramePerPacket { get; set; }
public int FrameSize { get; private set; }
private byte[] bytes;
public SpeexPacket(int framePerPacket)
{
FramePerPacket = framePerPacket;
FrameSize = 0;
Size = 0;
Data = new byte[SpeexFrame.FRAME_MAX_SIZE * framePerPacket];
}
public void Reset()
{
FrameSize = 0;
Size = 0;
}
public void AddFrame(SpeexFrame frame)
{
if (FrameSize >= FramePerPacket)
{
throw new ArgumentException("out of range");
}
FrameSize = FrameSize + 1;
Array.Copy(frame.Data,0,Data,Size,frame.Size);
Size = Size + frame.Size;
}
public int Size { get; private set; }
public byte[] Data { get; private set; }
}
}