Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
ce18c36e
Commit
ce18c36e
authored
Mar 18, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/ffmpeg: handle unknown stream start time
parent
8e39cf62
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
2 deletions
+26
-2
NEWS
NEWS
+1
-0
FfmpegDecoderPlugin.cxx
src/decoder/FfmpegDecoderPlugin.cxx
+25
-2
No files found.
NEWS
View file @
ce18c36e
ver 0.18.10 (not yet released)
* decoder
- ffmpeg: fix seeking bug
- ffmpeg: handle unknown stream start time
- gme: fix memory leak
ver 0.18.9 (2014/03/02)
...
...
src/decoder/FfmpegDecoderPlugin.cxx
View file @
ce18c36e
...
...
@@ -197,6 +197,29 @@ time_to_ffmpeg(double t, const AVRational time_base)
time_base
);
}
/**
* Replace #AV_NOPTS_VALUE with the given fallback.
*/
static
constexpr
int64_t
timestamp_fallback
(
int64_t
t
,
int64_t
fallback
)
{
return
gcc_likely
(
t
!=
int64_t
(
AV_NOPTS_VALUE
))
?
t
:
fallback
;
}
/**
* Accessor for AVStream::start_time that replaces AV_NOPTS_VALUE with
* zero. We can't use AV_NOPTS_VALUE in calculations, and we simply
* assume that the stream's start time is zero, which appears to be
* the best way out of that situation.
*/
static
int64_t
start_time_fallback
(
const
AVStream
&
stream
)
{
return
timestamp_fallback
(
stream
.
start_time
,
0
);
}
static
void
copy_interleave_frame2
(
uint8_t
*
dest
,
uint8_t
**
src
,
unsigned
nframes
,
unsigned
nchannels
,
...
...
@@ -263,7 +286,7 @@ ffmpeg_send_packet(Decoder &decoder, InputStream &is,
{
if
(
packet
->
pts
>=
0
&&
packet
->
pts
!=
(
int64_t
)
AV_NOPTS_VALUE
)
decoder_timestamp
(
decoder
,
time_from_ffmpeg
(
packet
->
pts
-
st
ream
->
start_time
,
time_from_ffmpeg
(
packet
->
pts
-
st
art_time_fallback
(
*
stream
)
,
stream
->
time_base
));
AVPacket
packet2
=
*
packet
;
...
...
@@ -493,7 +516,7 @@ ffmpeg_decode(Decoder &decoder, InputStream &input)
int64_t
where
=
time_to_ffmpeg
(
decoder_seek_where
(
decoder
),
av_stream
->
time_base
)
+
av_stream
->
start_time
;
start_time_fallback
(
*
av_stream
)
;
if
(
av_seek_frame
(
format_context
,
audio_stream
,
where
,
AVSEEK_FLAG_ANY
)
<
0
)
...
...
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