Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
videolan
vlc-2-2
Commits
5c15aa3d
Commit
5c15aa3d
authored
Oct 16, 2013
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: ogg: don't use arbitrary granule as lower search bound
Should fix seeking case on time 0
parent
51cff6ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
15 deletions
+16
-15
modules/demux/oggseek.c
modules/demux/oggseek.c
+16
-15
No files found.
modules/demux/oggseek.c
View file @
5c15aa3d
...
...
@@ -1154,7 +1154,7 @@ static int64_t OggBisectSearchByTime( demux_t *p_demux, logical_stream_t *p_stre
int64_t
i_pos
;
int64_t
i_timestamp
;
int64_t
i_granule
;
}
bestlower
=
{
p_stream
->
i_data_start
,
0
,
p_stream
->
i_keyframe_offset
},
}
bestlower
=
{
p_stream
->
i_data_start
,
-
1
,
-
1
},
current
=
{
-
1
,
-
1
,
-
1
};
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
...
...
@@ -1233,8 +1233,9 @@ static int64_t OggBisectSearchByTime( demux_t *p_demux, logical_stream_t *p_stre
i_segsize
=
(
i_end_pos
-
i_start_pos
+
1
)
>>
1
;
i_start_pos
+=
i_segsize
;
}
while
(
i_segsize
>
64
&&
current
.
i_granule
!=
-
1
);
}
while
(
i_segsize
>
64
);
if
(
bestlower
.
i_granule
==
-
1
)
return
-
1
;
if
(
p_stream
->
b_oggds
)
{
...
...
@@ -1253,7 +1254,7 @@ static int64_t OggBisectSearchByTime( demux_t *p_demux, logical_stream_t *p_stre
i_keyframegranule
>>
p_stream
->
i_granule_shift
,
bestlower
.
i_granule
,
i_pos_upper
,
Oggseek_GranuleToAbsTimestamp
(
p_stream
,
i_keyframegranule
,
tru
e
)
)
);
Oggseek_GranuleToAbsTimestamp
(
p_stream
,
i_keyframegranule
,
fals
e
)
)
);
OggDebug
(
msg_Dbg
(
p_demux
,
"Seeking back to %"
PRId64
,
__MAX
(
bestlower
.
i_pos
-
OGGSEEK_BYTES_TO_READ
,
p_stream
->
i_data_start
)
)
);
...
...
@@ -1275,16 +1276,16 @@ int Oggseek_BlindSeektoAbsoluteTime( demux_t *p_demux, logical_stream_t *p_strea
int64_t
i_time
,
bool
b_fastseek
)
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
int64_t
i_pos
=
-
1
;
int64_t
i_u
nused
pos
=
-
1
;
int64_t
i_
lower
pos
=
-
1
;
int64_t
i_u
pper
pos
=
-
1
;
bool
b_found
=
false
;
/* Search in skeleton */
Ogg_GetBoundsUsingSkeletonIndex
(
p_stream
,
i_time
,
&
i_
pos
,
&
i_unused
pos
);
if
(
i_pos
!=
-
1
)
b_found
=
true
;
Ogg_GetBoundsUsingSkeletonIndex
(
p_stream
,
i_time
,
&
i_
lowerpos
,
&
i_upper
pos
);
if
(
i_
lower
pos
!=
-
1
)
b_found
=
true
;
/* And also search in our own index */
if
(
!
b_found
&&
OggSeekIndexFind
(
p_stream
,
i_time
,
&
i_
pos
,
&
i_unused
pos
)
)
if
(
!
b_found
&&
OggSeekIndexFind
(
p_stream
,
i_time
,
&
i_
lowerpos
,
&
i_upper
pos
)
)
{
b_found
=
true
;
}
...
...
@@ -1295,29 +1296,29 @@ int Oggseek_BlindSeektoAbsoluteTime( demux_t *p_demux, logical_stream_t *p_strea
{
/* But only if there's no keyframe/preload requirements */
/* FIXME: add function to get preload time by codec, ex: opus */
i_pos
=
i_time
*
p_sys
->
i_bitrate
/
INT64_C
(
8000000
);
i_
lower
pos
=
i_time
*
p_sys
->
i_bitrate
/
INT64_C
(
8000000
);
b_found
=
true
;
}
/* or search */
if
(
!
b_found
&&
b_fastseek
)
{
i_pos
=
OggBisectSearchByTime
(
p_demux
,
p_stream
,
i_time
,
p_stream
->
i_data_start
,
p_sys
->
i_total_length
);
b_found
=
(
i_pos
!=
-
1
);
i_
lower
pos
=
OggBisectSearchByTime
(
p_demux
,
p_stream
,
i_time
,
p_stream
->
i_data_start
,
p_sys
->
i_total_length
);
b_found
=
(
i_
lower
pos
!=
-
1
);
}
if
(
!
b_found
)
return
-
1
;
if
(
i_
pos
<
p_stream
->
i_data_start
||
i_unused
pos
>
p_sys
->
i_total_length
)
if
(
i_
lowerpos
<
p_stream
->
i_data_start
||
i_upper
pos
>
p_sys
->
i_total_length
)
return
-
1
;
/* And really do seek */
p_sys
->
i_input_position
=
i_pos
;
p_sys
->
i_input_position
=
i_
lower
pos
;
seek_byte
(
p_demux
,
p_sys
->
i_input_position
);
ogg_stream_reset
(
&
p_stream
->
os
);
return
i_pos
;
return
i_
lower
pos
;
}
int
Oggseek_BlindSeektoPosition
(
demux_t
*
p_demux
,
logical_stream_t
*
p_stream
,
...
...
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