mirror of
https://github.com/aler9/gortsplib
synced 2025-10-19 05:24:44 +08:00
h264: fix FPS computation when NUmUnitsInTick != 1
This commit is contained in:
@@ -714,5 +714,5 @@ func (s SPS) FPS() float64 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
return float64(s.VUI.TimeScale) / 2 * float64(s.VUI.NumUnitsInTick)
|
return float64(s.VUI.TimeScale) / (2 * float64(s.VUI.NumUnitsInTick))
|
||||||
}
|
}
|
||||||
|
@@ -198,6 +198,31 @@ func TestSPSUnmarshal(t *testing.T) {
|
|||||||
1084,
|
1084,
|
||||||
25,
|
25,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"hikvision",
|
||||||
|
[]byte{103, 100, 0, 32, 172, 23, 42, 1, 64, 30, 104, 64, 0, 1, 194, 0, 0, 87, 228, 33},
|
||||||
|
SPS{
|
||||||
|
ProfileIdc: 100,
|
||||||
|
LevelIdc: 32,
|
||||||
|
ChromeFormatIdc: 1,
|
||||||
|
Log2MaxPicOrderCntLsbMinus4: 4,
|
||||||
|
MaxNumRefFrames: 1,
|
||||||
|
PicWidthInMbsMinus1: 79,
|
||||||
|
PicHeightInMbsMinus1: 59,
|
||||||
|
FrameMbsOnlyFlag: true,
|
||||||
|
Direct8x8InferenceFlag: true,
|
||||||
|
Log2MaxFrameNumMinus4: 10,
|
||||||
|
VUI: &VUI{
|
||||||
|
TimingInfoPresentFlag: true,
|
||||||
|
NumUnitsInTick: 1800,
|
||||||
|
TimeScale: 90000,
|
||||||
|
FixedFrameRateFlag: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
1280,
|
||||||
|
960,
|
||||||
|
25,
|
||||||
|
},
|
||||||
} {
|
} {
|
||||||
t.Run(ca.name, func(t *testing.T) {
|
t.Run(ca.name, func(t *testing.T) {
|
||||||
var sps SPS
|
var sps SPS
|
||||||
|
Reference in New Issue
Block a user