Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
galene
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
galene
Commits
bcd62f19
Commit
bcd62f19
authored
Jul 11, 2021
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Flush buffered packets in diskwriter at shutdown.
parent
b0c39fca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletion
+19
-1
diskwriter/diskwriter.go
diskwriter/diskwriter.go
+19
-1
No files found.
diskwriter/diskwriter.go
View file @
bcd62f19
...
...
@@ -16,6 +16,7 @@ import (
"github.com/at-wat/ebml-go/webm"
"github.com/pion/rtp"
"github.com/pion/rtp/codecs"
"github.com/pion/webrtc/v3/pkg/media"
"github.com/jech/samplebuilder"
...
...
@@ -184,6 +185,7 @@ func (conn *diskConn) warn(message string) {
func
(
conn
*
diskConn
)
reopen
()
error
{
for
_
,
t
:=
range
conn
.
tracks
{
if
t
.
writer
!=
nil
{
t
.
writeBuffered
(
true
)
t
.
writer
.
Close
()
t
.
writer
=
nil
}
...
...
@@ -206,6 +208,7 @@ func (conn *diskConn) Close() error {
tracks
:=
make
([]
*
diskTrack
,
0
,
len
(
conn
.
tracks
))
for
_
,
t
:=
range
conn
.
tracks
{
if
t
.
writer
!=
nil
{
t
.
writeBuffered
(
true
)
t
.
writer
.
Close
()
t
.
writer
=
nil
}
...
...
@@ -545,8 +548,23 @@ func (t *diskTrack) writeRTP(p *rtp.Packet) error {
t
.
builder
.
Push
(
p
)
return
t
.
writeBuffered
(
false
)
}
// writeBuffered writes any buffered samples to disk. If force is true,
// then samples will be flushed even if they are preceded by incomplete
// samples.
func
(
t
*
diskTrack
)
writeBuffered
(
force
bool
)
error
{
codec
:=
t
.
remote
.
Codec
()
for
{
sample
,
ts
:=
t
.
builder
.
PopWithTimestamp
()
var
sample
*
media
.
Sample
var
ts
uint32
if
!
force
{
sample
,
ts
=
t
.
builder
.
PopWithTimestamp
()
}
else
{
sample
,
ts
=
t
.
builder
.
ForcePopWithTimestamp
()
}
if
sample
==
nil
{
return
nil
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment