Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jannik Hellenkamp
website
Commits
91ed667b
Commit
91ed667b
authored
7 years ago
by
Julian Rother
Browse files
Options
Downloads
Patches
Plain Diff
Extended legacy livestream api to support job-based encoding
parent
6b930170
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
db_schema.sql
+2
-1
2 additions, 1 deletion
db_schema.sql
livestreams.py
+18
-2
18 additions, 2 deletions
livestreams.py
with
20 additions
and
3 deletions
db_schema.sql
+
2
−
1
View file @
91ed667b
...
...
@@ -176,7 +176,8 @@ CREATE TABLE IF NOT EXISTS `streams` (
`visible`
INTEGER
NOT
NULL
,
`lecture_id`
INTEGER
NOT
NULL
,
`description`
text
NOT
NULL
,
`poster`
text
NOT
NULL
`poster`
text
NOT
NULL
,
`job_id`
INTEGER
);
CREATE
TABLE
IF
NOT
EXISTS
`stream_stats`
(
`id`
INTEGER
NOT
NULL
PRIMARY
KEY
AUTOINCREMENT
,
...
...
This diff is collapsed.
Click to expand it.
livestreams.py
+
18
−
2
View file @
91ed667b
...
...
@@ -7,7 +7,8 @@ def livestream_thumbnail():
schedule_job
(
'
thumbnail
'
,
{
'
lectureid
'
:
str
(
v
[
'
lecture_id
'
]),
'
path
'
:
v
[
'
path
'
]})
@app.route
(
'
/internal/streaming/legacy_auth
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
def
streamauth
():
@app.route
(
'
/internal/streaming/legacy_auth/<server>
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
def
streamauth
(
server
=
None
):
internal
=
False
for
net
in
config
.
get
(
'
FSMPI_IP_RANGES
'
,
[]):
if
ip_address
(
request
.
headers
[
'
X-Real-IP
'
])
in
ip_network
(
net
):
...
...
@@ -33,10 +34,25 @@ def streamauth():
modify
(
"
INSERT INTO streams (handle, active, visible, lecture_id, description, poster) VALUES (?, 0, 1, -1,
""
,
""
)
"
,
request
.
values
[
'
name
'
])
except
:
pass
modify
(
"
UPDATE streams SET active = 1, lecture_id = ? WHERE handle = ?
"
,
match
[
'
id
'
],
request
.
values
[
'
name
'
])
if
server
:
data
=
{
'
src
'
:
'
rtmp://%s/live/%s
'
%
(
server
,
request
.
values
[
'
name
'
]),
'
destbase
'
:
'
rtmp://%s/hls/%s
'
%
(
server
,
request
.
values
[
'
name
'
])}
job_id
=
schedule_job
(
'
simple_live_transcode
'
,
data
,
priority
=
10
)
modify
(
"
UPDATE streams SET active = 1, lecture_id = ?, job_id = ? WHERE handle = ?
"
,
match
[
'
id
'
],
job_id
,
request
.
values
[
'
name
'
])
else
:
modify
(
"
UPDATE streams SET active = 1, lecture_id = ? WHERE handle = ?
"
,
match
[
'
id
'
],
request
.
values
[
'
name
'
])
elif
request
.
values
[
'
call
'
]
==
'
publish_done
'
:
job_id
=
query
(
'
SELECT job_id FROM streams WHERE handle = ?
'
,
request
.
values
[
'
name
'
])[
0
][
'
job_id
'
]
modify
(
"
UPDATE streams SET active = 0 WHERE handle = ?
"
,
request
.
values
[
'
name
'
])
if
job_id
:
cancel_job
(
job_id
)
else
:
return
'
Bad request
'
,
400
return
'
OK
'
,
200
@job_handler
(
'
simple_live_transcode
'
,
state
=
'
failed
'
)
def
restart_failed_live_transcode
(
id
,
type
,
data
,
state
,
status
):
restart_job
(
id
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment