fix: 修复直播端到端识别时间戳错误

This commit is contained in:
余泓铮
2024-07-02 21:22:41 +08:00
parent 55d111256a
commit 4473edf393
+2 -7
View File
@@ -62,11 +62,11 @@ func (ete *EndToEndDelay) getCurrentLiveTime(utcTime time.Time) error {
// filter ocr texts with time format // filter ocr texts with time format
var liveTimeTexts []string var liveTimeTexts []string
for _, ocrText := range ocrTexts { for _, ocrText := range ocrTexts {
if len(ocrText.Text) < 10 || strings.Contains(ocrText.Text, ":") { if len(ocrText.Text) < 13 || strings.Contains(ocrText.Text, ":") {
continue continue
} }
// exclude digit(s) recognized as letter(s) // exclude digit(s) recognized as letter(s)
_, errParseInt := strconv.ParseInt(ocrText.Text[:10], 10, 64) _, errParseInt := strconv.ParseInt(ocrText.Text[:13], 10, 64)
if errParseInt != nil { if errParseInt != nil {
continue continue
} }
@@ -81,11 +81,6 @@ func (ete *EndToEndDelay) getCurrentLiveTime(utcTime time.Time) error {
return nil return nil
} }
if len(liveTimeText) < 13 {
for (13 - len(liveTimeText)) > 0 {
liveTimeText += "0"
}
}
liveTimeInt, err := strconv.Atoi(liveTimeText) liveTimeInt, err := strconv.Atoi(liveTimeText)
if err != nil { if err != nil {
liveTimeInt = 0 liveTimeInt = 0