mirror of
https://github.com/langhuihui/monibuca.git
synced 2025-09-26 16:41:10 +08:00
fix: hls no body read
This commit is contained in:
101
.github/workflows/iflow.yml
vendored
101
.github/workflows/iflow.yml
vendored
@@ -1,101 +0,0 @@
|
||||
name: '🏷️ iFLOW CLI Automated Issue Triage'
|
||||
|
||||
on:
|
||||
issues:
|
||||
types:
|
||||
- 'opened'
|
||||
- 'reopened'
|
||||
issue_comment:
|
||||
types:
|
||||
- 'created'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
issue_number:
|
||||
description: 'issue number to triage'
|
||||
required: true
|
||||
type: 'number'
|
||||
|
||||
concurrency:
|
||||
group: '${{ github.workflow }}-${{ github.event.issue.number }}'
|
||||
cancel-in-progress: true
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: 'bash'
|
||||
|
||||
permissions:
|
||||
contents: 'read'
|
||||
issues: 'write'
|
||||
statuses: 'write'
|
||||
|
||||
jobs:
|
||||
triage-issue:
|
||||
if: |-
|
||||
github.event_name == 'issues' ||
|
||||
github.event_name == 'workflow_dispatch' ||
|
||||
(
|
||||
github.event_name == 'issue_comment' &&
|
||||
contains(github.event.comment.body, '@iflow-cli /triage') &&
|
||||
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)
|
||||
)
|
||||
timeout-minutes: 5
|
||||
runs-on: 'ubuntu-latest'
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 'Run iFlow CLI Issue Triage'
|
||||
uses: vibe-ideas/iflow-cli-action@main
|
||||
id: 'iflow_cli_issue_triage'
|
||||
env:
|
||||
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
||||
ISSUE_TITLE: '${{ github.event.issue.title }}'
|
||||
ISSUE_BODY: '${{ github.event.issue.body }}'
|
||||
ISSUE_NUMBER: '${{ github.event.issue.number }}'
|
||||
REPOSITORY: '${{ github.repository }}'
|
||||
with:
|
||||
api_key: ${{ secrets.IFLOW_API_KEY }}
|
||||
timeout: "3600"
|
||||
extra_args: "--debug"
|
||||
prompt: |
|
||||
## Role
|
||||
|
||||
You are an issue triage assistant. Analyze the current GitHub issue
|
||||
and apply the most appropriate existing labels. Use the available
|
||||
tools to gather information; do not ask for information to be
|
||||
provided.
|
||||
|
||||
## Steps
|
||||
|
||||
1. Run: `gh label list` to get all available labels.
|
||||
2. Review the issue title and body provided in the environment
|
||||
variables: "${ISSUE_TITLE}" and "${ISSUE_BODY}".
|
||||
3. Classify issues by their kind (bug, enhancement, documentation,
|
||||
cleanup, etc) and their priority (p0, p1, p2, p3). Set the
|
||||
labels according to the format `kind/*` and `priority/*` patterns.
|
||||
4. Apply the selected labels to this issue using:
|
||||
`gh issue edit "${ISSUE_NUMBER}" --add-label "label1,label2"`
|
||||
5. If the "status/needs-triage" label is present, remove it using:
|
||||
`gh issue edit "${ISSUE_NUMBER}" --remove-label "status/needs-triage"`
|
||||
|
||||
## Guidelines
|
||||
|
||||
- Only use labels that already exist in the repository
|
||||
- Do not add comments or modify the issue content
|
||||
- Triage only the current issue
|
||||
- Assign all applicable labels based on the issue content
|
||||
- Reference all shell variables as "${VAR}" (with quotes and braces)
|
||||
|
||||
- name: 'Post Issue Triage Failure Comment'
|
||||
if: |-
|
||||
${{ failure() && steps.iflow_cli_issue_triage.outcome == 'failure' }}
|
||||
uses: 'actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea'
|
||||
with:
|
||||
github-token: '${{ secrets.GITHUB_TOKEN }}'
|
||||
script: |-
|
||||
github.rest.issues.createComment({
|
||||
owner: '${{ github.repository }}'.split('/')[0],
|
||||
repo: '${{ github.repository }}'.split('/')[1],
|
||||
issue_number: '${{ github.event.issue.number }}',
|
||||
body: 'There is a problem with the iFlow CLI issue triaging. Please check the [action logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.'
|
||||
})
|
@@ -92,7 +92,8 @@ func (config *HLSPlugin) vod(w http.ResponseWriter, r *http.Request) {
|
||||
if !startTime.IsZero() {
|
||||
if config.DB != nil {
|
||||
var records []m7s.RecordStream
|
||||
if recordType == "fmp4" {
|
||||
switch recordType {
|
||||
case "fmp4":
|
||||
query := `stream_path = ? AND type = ? AND start_time IS NOT NULL AND end_time IS NOT NULL AND ? <= end_time AND ? >= start_time`
|
||||
config.DB.Where(query, streamPath, "mp4", startTime, endTime).Find(&records)
|
||||
if len(records) == 0 {
|
||||
@@ -117,7 +118,7 @@ func (config *HLSPlugin) vod(w http.ResponseWriter, r *http.Request) {
|
||||
plBuffer.WriteString("#EXT-X-ENDLIST\n")
|
||||
w.Write(plBuffer)
|
||||
return
|
||||
} else if recordType == "ts" {
|
||||
case "ts":
|
||||
playlist := hls.Playlist{
|
||||
Version: 3,
|
||||
Sequence: 0,
|
||||
|
@@ -2,6 +2,7 @@ package hls
|
||||
|
||||
import (
|
||||
"container/ring"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"strconv"
|
||||
@@ -24,6 +25,8 @@ func NewTransform() m7s.ITransformer {
|
||||
return ret
|
||||
}
|
||||
|
||||
var ErrNoBodyRead = errors.New("no body read")
|
||||
|
||||
type HLSWriter struct {
|
||||
m7s.DefaultTransformer
|
||||
Window int
|
||||
@@ -49,6 +52,10 @@ func (w *HLSWriter) GetTs(key string) (any, bool) {
|
||||
return w.memoryTs.Load(key)
|
||||
}
|
||||
|
||||
func (w *HLSWriter) checkNoBodyRead() bool {
|
||||
return time.Since(w.lastReadTime) > time.Second*15
|
||||
}
|
||||
|
||||
func (w *HLSWriter) Run() (err error) {
|
||||
if conf, ok := w.TransformJob.Config.Input.(string); ok {
|
||||
ss := strings.Split(conf, "x")
|
||||
@@ -86,8 +93,14 @@ func (w *HLSWriter) Run() (err error) {
|
||||
w.ts.WritePMTPacket(audioCodec, videoCodec)
|
||||
return m7s.PlayBlock(subscriber, func(audio *format.Mpeg2Audio) error {
|
||||
pesAudio.Pts = uint64(subscriber.AudioReader.AbsTime) * 90
|
||||
if w.checkNoBodyRead() {
|
||||
return ErrNoBodyRead
|
||||
}
|
||||
return pesAudio.WritePESPacket(audio.Memory, &w.ts.RecyclableMemory)
|
||||
}, func(video *mpegts.VideoFrame) (err error) {
|
||||
if w.checkNoBodyRead() {
|
||||
return ErrNoBodyRead
|
||||
}
|
||||
vr := w.TransformJob.Subscriber.VideoReader
|
||||
if vr.Value.IDR {
|
||||
if err = w.checkFragment(video.Timestamp); err != nil {
|
||||
|
Reference in New Issue
Block a user