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
39d8cf72
Commit
39d8cf72
authored
Jul 11, 2021
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Define a type maybeUint32 and use it in diskwriter.
parent
eec6c8a5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
5 deletions
+20
-5
diskwriter/diskwriter.go
diskwriter/diskwriter.go
+20
-5
No files found.
diskwriter/diskwriter.go
View file @
39d8cf72
...
@@ -250,6 +250,22 @@ func openDiskFile(directory, username string) (*os.File, error) {
...
@@ -250,6 +250,22 @@ func openDiskFile(directory, username string) (*os.File, error) {
return
nil
,
errors
.
New
(
"couldn't create file"
)
return
nil
,
errors
.
New
(
"couldn't create file"
)
}
}
type
maybeUint32
uint64
const
none
maybeUint32
=
0
func
some
(
value
uint32
)
maybeUint32
{
return
maybeUint32
(
uint64
(
1
<<
32
)
|
uint64
(
value
))
}
func
valid
(
m
maybeUint32
)
bool
{
return
(
m
&
(
1
<<
32
))
!=
0
}
func
value
(
m
maybeUint32
)
uint32
{
return
uint32
(
m
)
}
type
diskTrack
struct
{
type
diskTrack
struct
{
remote
conn
.
UpTrack
remote
conn
.
UpTrack
conn
*
diskConn
conn
*
diskConn
...
@@ -257,8 +273,7 @@ type diskTrack struct {
...
@@ -257,8 +273,7 @@ type diskTrack struct {
writer
webm
.
BlockWriteCloser
writer
webm
.
BlockWriteCloser
builder
*
samplebuilder
.
SampleBuilder
builder
*
samplebuilder
.
SampleBuilder
// bit 32 is a boolean indicating that the origin is valid
origin
maybeUint32
origin
uint64
kfRequested
time
.
Time
kfRequested
time
.
Time
lastKf
time
.
Time
lastKf
time
.
Time
...
@@ -546,10 +561,10 @@ func (t *diskTrack) Write(buf []byte) (int, error) {
...
@@ -546,10 +561,10 @@ func (t *diskTrack) Write(buf []byte) (int, error) {
continue
continue
}
}
if
t
.
origin
==
0
{
if
!
valid
(
t
.
origin
)
{
t
.
origin
=
uint64
(
ts
)
|
(
1
<<
32
)
t
.
origin
=
some
(
ts
)
}
}
ts
-=
uint32
(
t
.
origin
)
ts
-=
value
(
t
.
origin
)
tm
:=
ts
/
(
t
.
remote
.
Codec
()
.
ClockRate
/
1000
)
tm
:=
ts
/
(
t
.
remote
.
Codec
()
.
ClockRate
/
1000
)
_
,
err
:=
t
.
writer
.
Write
(
keyframe
,
int64
(
tm
),
sample
.
Data
)
_
,
err
:=
t
.
writer
.
Write
(
keyframe
,
int64
(
tm
),
sample
.
Data
)
...
...
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