Replace timer-based SMA with a timer-less implementation

This commit is contained in:
Ingo Oppermann
2024-10-23 11:08:13 +02:00
parent 2dda47b81f
commit df30a6b8e3
17 changed files with 543 additions and 371 deletions

View File

@@ -184,11 +184,11 @@ func TestParserLogHistory(t *testing.T) {
require.Equal(t, Progress{
Started: true,
Frame: 5968,
FPS: 0, // is calculated with averager
FPS: 5968. / 30, // is calculated with averager
Quantizer: 19.4,
Size: 453632,
Time: d.Seconds(),
Bitrate: 0, // is calculated with averager
Bitrate: 443. * 1024 * 8 / 30, // is calculated with averager
Speed: 0.999,
Drop: 3522,
Dup: 87463,
@@ -245,11 +245,11 @@ func TestParserImportLogHistory(t *testing.T) {
require.Equal(t, Progress{
Started: true,
Frame: 42,
FPS: 0, // is calculated with averager
FPS: 5968. / 30, // is calculated with averager
Quantizer: 19.4,
Size: 453632,
Time: d.Seconds(),
Bitrate: 0, // is calculated with averager
Bitrate: 443. * 1024 * 8 / 30, // is calculated with averager
Speed: 0.999,
Drop: 3522,
Dup: 87463,
@@ -312,11 +312,11 @@ func TestParserLogMinimalHistoryLength(t *testing.T) {
require.Equal(t, Progress{
Started: true,
Frame: 5968,
FPS: 0, // is calculated with averager
FPS: 5968. / 30, // is calculated with averager
Quantizer: 19.4,
Size: 453632,
Time: d.Seconds(),
Bitrate: 0, // is calculated with averager
Bitrate: 443. * 1024 * 8 / 30, // is calculated with averager
Speed: 0.999,
Drop: 3522,
Dup: 87463,
@@ -330,11 +330,11 @@ func TestParserLogMinimalHistoryLength(t *testing.T) {
require.Equal(t, Progress{
Started: true,
Frame: 5968,
FPS: 0, // is calculated with averager
FPS: 5968. / 30, // is calculated with averager
Quantizer: 19.4,
Size: 453632,
Time: d.Seconds(),
Bitrate: 0, // is calculated with averager
Bitrate: 443. * 1024 * 8 / 30, // is calculated with averager
Speed: 0.999,
Drop: 3522,
Dup: 87463,
@@ -884,11 +884,11 @@ func TestParserProgressPlayout(t *testing.T) {
Coder: "h264",
Frame: 7,
Keyframe: 1,
FPS: 0,
FPS: 7. / 30,
Packet: 11,
PPS: 0,
PPS: 11. / 30,
Size: 42,
Bitrate: 0,
Bitrate: 42. * 8 / 30,
Pixfmt: "yuvj420p",
Quantizer: 0,
Width: 1280,
@@ -938,11 +938,11 @@ func TestParserProgressPlayout(t *testing.T) {
Coder: "libx264",
Frame: 7,
Keyframe: 1,
FPS: 0,
FPS: 7. / 30,
Packet: 0,
PPS: 0,
Size: 5,
Bitrate: 0,
Bitrate: 5. * 8 / 30,
Extradata: 32,
Pixfmt: "yuvj420p",
Quantizer: 0,
@@ -962,11 +962,11 @@ func TestParserProgressPlayout(t *testing.T) {
Codec: "h264",
Coder: "copy",
Frame: 11,
FPS: 0,
FPS: 11. / 30,
Packet: 11,
PPS: 0,
PPS: 11. / 30,
Size: 231424,
Bitrate: 0,
Bitrate: 231424. * 8 / 30,
Pixfmt: "yuvj420p",
Quantizer: -1,
Width: 1280,
@@ -979,12 +979,12 @@ func TestParserProgressPlayout(t *testing.T) {
},
Frame: 7,
Packet: 0,
FPS: 0,
FPS: 7. / 30,
PPS: 0,
Quantizer: 0,
Size: 231424,
Time: 0.56,
Bitrate: 0,
Bitrate: 231424. * 8 / 30,
Speed: 0.4,
Drop: 0,
Dup: 0,
@@ -1016,11 +1016,11 @@ func TestParserProgressPlayoutVideo(t *testing.T) {
Coder: "h264",
Frame: 7,
Keyframe: 1,
FPS: 0,
FPS: 7. / 30,
Packet: 11,
PPS: 0,
PPS: 11. / 30,
Size: 42,
Bitrate: 0,
Bitrate: 42. * 8 / 30,
Pixfmt: "yuvj420p",
Quantizer: 0,
Width: 1280,
@@ -1076,11 +1076,11 @@ func TestParserProgressPlayoutVideo(t *testing.T) {
Coder: "libx264",
Frame: 7,
Keyframe: 1,
FPS: 0,
FPS: 7. / 30,
Packet: 0,
PPS: 0,
Size: 5,
Bitrate: 0,
Bitrate: 5. * 8 / 30,
Extradata: 32,
Pixfmt: "yuvj420p",
Quantizer: 0,
@@ -1100,11 +1100,11 @@ func TestParserProgressPlayoutVideo(t *testing.T) {
Codec: "h264",
Coder: "copy",
Frame: 11,
FPS: 0,
FPS: 11. / 30,
Packet: 11,
PPS: 0,
PPS: 11. / 30,
Size: 231424,
Bitrate: 0,
Bitrate: 231424. * 8 / 30,
Pixfmt: "yuvj420p",
Quantizer: -1,
Width: 1280,
@@ -1117,12 +1117,12 @@ func TestParserProgressPlayoutVideo(t *testing.T) {
},
Frame: 7,
Packet: 0,
FPS: 0,
FPS: 7. / 30,
PPS: 0,
Quantizer: 0,
Size: 231424,
Time: 0.56,
Bitrate: 0,
Bitrate: 231424. * 8 / 30,
Speed: 0.4,
Drop: 0,
Dup: 0,
@@ -1161,11 +1161,11 @@ func TestParserProgressPlayoutAudioVideo(t *testing.T) {
Max float64
Average float64
}{25, 25, 25},
FPS: 0,
FPS: 101. / 30,
Packet: 101,
PPS: 0,
PPS: 101. / 30,
Size: 530273,
Bitrate: 0,
Bitrate: 530273. * 8 / 30,
Pixfmt: "yuv420p",
Quantizer: 0,
Width: 1280,
@@ -1228,11 +1228,11 @@ func TestParserProgressPlayoutAudioVideo(t *testing.T) {
Max float64
Average float64
}{43.083, 43.083, 43.083},
FPS: 0,
FPS: 174. / 30,
Packet: 174,
PPS: 0,
PPS: 174. / 30,
Size: 713,
Bitrate: 0,
Bitrate: 713. * 8 / 30,
Pixfmt: "",
Quantizer: 0,
Width: 0,
@@ -1301,11 +1301,11 @@ func TestParserProgressPlayoutAudioVideo(t *testing.T) {
Max float64
Average float64
}{25, 25, 25},
FPS: 0,
FPS: 101. / 30,
Packet: 101,
PPS: 0,
PPS: 101. / 30,
Size: 530273,
Bitrate: 0,
Bitrate: 530273. * 8 / 30,
Extradata: 0,
Pixfmt: "yuv420p",
Quantizer: -1,
@@ -1333,11 +1333,11 @@ func TestParserProgressPlayoutAudioVideo(t *testing.T) {
Max float64
Average float64
}{43.083, 43.083, 43.083},
FPS: 0,
FPS: 174. / 30,
Packet: 174,
PPS: 0,
PPS: 174. / 30,
Size: 713,
Bitrate: 0,
Bitrate: 713. * 8 / 30,
Pixfmt: "",
Quantizer: 0,
Width: 0,
@@ -1351,12 +1351,12 @@ func TestParserProgressPlayoutAudioVideo(t *testing.T) {
},
Frame: 101,
Packet: 101,
FPS: 0,
PPS: 0,
FPS: 101. / 30,
PPS: 101. / 30,
Quantizer: -1,
Size: 530986,
Time: 4.3,
Bitrate: 0,
Bitrate: 530986. * 8 / 30,
Speed: 1,
Drop: 0,
Dup: 0,