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
72483c9d
Commit
72483c9d
authored
Sep 12, 2008
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved bitrate estimation in mpga demuxer.
parent
b1f8dfcb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
modules/demux/mpeg/mpga.c
modules/demux/mpeg/mpga.c
+13
-2
No files found.
modules/demux/mpeg/mpga.c
View file @
72483c9d
...
@@ -71,7 +71,9 @@ struct demux_sys_t
...
@@ -71,7 +71,9 @@ struct demux_sys_t
mtime_t
i_pts
;
mtime_t
i_pts
;
mtime_t
i_time_offset
;
mtime_t
i_time_offset
;
int64_t
i_bytes
;
bool
b_estimate_bitrate
;
int
i_bitrate_avg
;
/* extracted from Xing header */
int
i_bitrate_avg
;
/* extracted from Xing header */
bool
b_initial_sync_failed
;
bool
b_initial_sync_failed
;
...
@@ -113,6 +115,7 @@ static int Open( vlc_object_t * p_this )
...
@@ -113,6 +115,7 @@ static int Open( vlc_object_t * p_this )
p_sys
->
p_es
=
NULL
;
p_sys
->
p_es
=
NULL
;
p_sys
->
b_start
=
true
;
p_sys
->
b_start
=
true
;
p_sys
->
i_stream_offset
=
i_offset
;
p_sys
->
i_stream_offset
=
i_offset
;
p_sys
->
b_estimate_bitrate
=
true
;
p_sys
->
i_bitrate_avg
=
0
;
p_sys
->
i_bitrate_avg
=
0
;
if
(
stream_Seek
(
p_demux
->
s
,
p_sys
->
i_stream_offset
)
)
if
(
stream_Seek
(
p_demux
->
s
,
p_sys
->
i_stream_offset
)
)
...
@@ -172,14 +175,22 @@ static int Demux( demux_t *p_demux )
...
@@ -172,14 +175,22 @@ static int Demux( demux_t *p_demux )
p_sys
->
i_bitrate_avg
=
p_sys
->
xing
.
i_bytes
*
INT64_C
(
8
)
*
p_sys
->
i_bitrate_avg
=
p_sys
->
xing
.
i_bytes
*
INT64_C
(
8
)
*
p_sys
->
p_packetizer
->
fmt_out
.
audio
.
i_rate
/
p_sys
->
p_packetizer
->
fmt_out
.
audio
.
i_rate
/
p_sys
->
xing
.
i_frames
/
p_sys
->
xing
.
i_frame_samples
;
p_sys
->
xing
.
i_frames
/
p_sys
->
xing
.
i_frame_samples
;
if
(
p_sys
->
i_bitrate_avg
>
0
)
p_sys
->
b_estimate_bitrate
=
false
;
}
}
/* Use the bitrate */
/* Use the bitrate
as initual value
*/
if
(
p_sys
->
i_bitrate_avg
<=
0
)
if
(
p_sys
->
b_estimate_bitrate
)
p_sys
->
i_bitrate_avg
=
p_sys
->
p_packetizer
->
fmt_out
.
i_bitrate
;
p_sys
->
i_bitrate_avg
=
p_sys
->
p_packetizer
->
fmt_out
.
i_bitrate
;
}
}
p_sys
->
i_pts
=
p_block_out
->
i_pts
;
p_sys
->
i_pts
=
p_block_out
->
i_pts
;
/* Re-estimate bitrate */
if
(
p_sys
->
b_estimate_bitrate
&&
p_sys
->
i_pts
>
1
+
INT64_C
(
500000
)
)
p_sys
->
i_bitrate_avg
=
8
*
INT64_C
(
1000000
)
*
p_sys
->
i_bytes
/
(
p_sys
->
i_pts
-
1
);
p_sys
->
i_bytes
+=
p_block_out
->
i_buffer
;
/* Correct timestamp */
/* Correct timestamp */
p_block_out
->
i_pts
+=
p_sys
->
i_time_offset
;
p_block_out
->
i_pts
+=
p_sys
->
i_time_offset
;
p_block_out
->
i_dts
+=
p_sys
->
i_time_offset
;
p_block_out
->
i_dts
+=
p_sys
->
i_time_offset
;
...
...
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