mirror of https://bitbucket.org/ausocean/av.git
revid: addressing PR feedback
This commit is contained in:
parent
9ba72fac62
commit
e5f95d1ea0
|
@ -74,7 +74,7 @@ func TestEncodePcm(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clip := (*bytes.Buffer)(&buf).Bytes()
|
clip := buf.Bytes()
|
||||||
|
|
||||||
// Get the first MTS packet to check
|
// Get the first MTS packet to check
|
||||||
var pkt packet.Packet
|
var pkt packet.Packet
|
||||||
|
|
|
@ -53,7 +53,7 @@ func TestMetaEncode1(t *testing.T) {
|
||||||
if err := e.writePSI(); err != nil {
|
if err := e.writePSI(); err != nil {
|
||||||
t.Errorf(errUnexpectedErr, err.Error())
|
t.Errorf(errUnexpectedErr, err.Error())
|
||||||
}
|
}
|
||||||
out := (*bytes.Buffer)(&buf).Bytes()
|
out := buf.Bytes()
|
||||||
got := out[PacketSize+4:]
|
got := out[PacketSize+4:]
|
||||||
|
|
||||||
want := []byte{
|
want := []byte{
|
||||||
|
@ -82,7 +82,7 @@ func TestMetaEncode2(t *testing.T) {
|
||||||
if err := e.writePSI(); err != nil {
|
if err := e.writePSI(); err != nil {
|
||||||
t.Errorf(errUnexpectedErr, err.Error())
|
t.Errorf(errUnexpectedErr, err.Error())
|
||||||
}
|
}
|
||||||
out := (*bytes.Buffer)(&buf).Bytes()
|
out := buf.Bytes()
|
||||||
got := out[PacketSize+4:]
|
got := out[PacketSize+4:]
|
||||||
want := []byte{
|
want := []byte{
|
||||||
0x00, 0x02, 0xb0, 0x36, 0x00, 0x01, 0xc1, 0x00, 0x00, 0xe1, 0x00, 0xf0, 0x24,
|
0x00, 0x02, 0xb0, 0x36, 0x00, 0x01, 0xc1, 0x00, 0x00, 0xe1, 0x00, 0xf0, 0x24,
|
||||||
|
|
|
@ -95,21 +95,33 @@ func (tl *testLogger) Log(level int8, msg string, params ...interface{}) {
|
||||||
|
|
||||||
// tstMtsEncoder emulates the mts.Encoder to the extent of the dst field.
|
// tstMtsEncoder emulates the mts.Encoder to the extent of the dst field.
|
||||||
// This will allow access to the dst to check that it has been set corrctly.
|
// This will allow access to the dst to check that it has been set corrctly.
|
||||||
type tstMtsEncoder struct{ dst io.WriteCloser }
|
type tstMtsEncoder struct {
|
||||||
|
// dst is here soley to detect the type stored in the encoder.
|
||||||
|
// No data is written to dst.
|
||||||
|
dst io.WriteCloser
|
||||||
|
}
|
||||||
|
|
||||||
func (e *tstMtsEncoder) Write(d []byte) (int, error) { return len(d), nil }
|
func (e *tstMtsEncoder) Write(d []byte) (int, error) { return len(d), nil }
|
||||||
func (e *tstMtsEncoder) Close() error { return nil }
|
func (e *tstMtsEncoder) Close() error { return nil }
|
||||||
|
|
||||||
// tstFlvEncoder emulates the flv.Encoder to the extent of the dst field.
|
// tstFlvEncoder emulates the flv.Encoder to the extent of the dst field.
|
||||||
// This will allow access to the dst to check that it has been set corrctly.
|
// This will allow access to the dst to check that it has been set corrctly.
|
||||||
type tstFlvEncoder struct{ dst io.WriteCloser }
|
type tstFlvEncoder struct {
|
||||||
|
// dst is here soley to detect the type stored in the encoder.
|
||||||
|
// No data is written to dst.
|
||||||
|
dst io.WriteCloser
|
||||||
|
}
|
||||||
|
|
||||||
func (e *tstFlvEncoder) Write(d []byte) (int, error) { return len(d), nil }
|
func (e *tstFlvEncoder) Write(d []byte) (int, error) { return len(d), nil }
|
||||||
func (e *tstFlvEncoder) Close() error { return nil }
|
func (e *tstFlvEncoder) Close() error { return nil }
|
||||||
|
|
||||||
// dummyMultiWriter emulates the MultiWriter provided by std lib, so that we
|
// dummyMultiWriter emulates the MultiWriter provided by std lib, so that we
|
||||||
// can access the destinations.
|
// can access the destinations.
|
||||||
type dummyMultiWriter struct{ dst []io.WriteCloser }
|
type dummyMultiWriter struct {
|
||||||
|
// dst is here soley to detect the types stored in the multiWriter.
|
||||||
|
// No data is written to dst.
|
||||||
|
dst []io.WriteCloser
|
||||||
|
}
|
||||||
|
|
||||||
func (w *dummyMultiWriter) Write(d []byte) (int, error) { return len(d), nil }
|
func (w *dummyMultiWriter) Write(d []byte) (int, error) { return len(d), nil }
|
||||||
func (w *dummyMultiWriter) Close() error { return nil }
|
func (w *dummyMultiWriter) Close() error { return nil }
|
||||||
|
@ -259,7 +271,7 @@ func TestResetEncoderSenderSetup(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now check that this encoder has correct number of destinations (senders).
|
// Now check that this encoder has correct number of destinations (senders).
|
||||||
var ms io.Writer
|
var ms io.WriteCloser
|
||||||
switch encoderType {
|
switch encoderType {
|
||||||
case mtsEncoderStr:
|
case mtsEncoderStr:
|
||||||
ms = e.(*tstMtsEncoder).dst
|
ms = e.(*tstMtsEncoder).dst
|
||||||
|
|
Loading…
Reference in New Issue