Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
df34b700
Commit
df34b700
authored
Mar 17, 2016
by
Lukasz Marek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffplay: remove redundant silence buffer
Signed-off-by:
Lukasz Marek
<
lukasz.m.luki2@gmail.com
>
parent
6e65b9bb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
ffplay.c
ffplay.c
+6
-7
No files found.
ffplay.c
View file @
df34b700
...
@@ -243,7 +243,6 @@ typedef struct VideoState {
...
@@ -243,7 +243,6 @@ typedef struct VideoState {
AVStream
*
audio_st
;
AVStream
*
audio_st
;
PacketQueue
audioq
;
PacketQueue
audioq
;
int
audio_hw_buf_size
;
int
audio_hw_buf_size
;
uint8_t
silence_buf
[
SDL_AUDIO_MIN_BUFFER_SIZE
];
uint8_t
*
audio_buf
;
uint8_t
*
audio_buf
;
uint8_t
*
audio_buf1
;
uint8_t
*
audio_buf1
;
unsigned
int
audio_buf_size
;
/* in bytes */
unsigned
int
audio_buf_size
;
/* in bytes */
...
@@ -2532,7 +2531,7 @@ static int audio_decode_frame(VideoState *is)
...
@@ -2532,7 +2531,7 @@ static int audio_decode_frame(VideoState *is)
static
void
sdl_audio_callback
(
void
*
opaque
,
Uint8
*
stream
,
int
len
)
static
void
sdl_audio_callback
(
void
*
opaque
,
Uint8
*
stream
,
int
len
)
{
{
VideoState
*
is
=
opaque
;
VideoState
*
is
=
opaque
;
int
audio_size
,
len1
;
int
audio_size
,
len1
,
silence
=
0
;
audio_callback_time
=
av_gettime_relative
();
audio_callback_time
=
av_gettime_relative
();
...
@@ -2541,8 +2540,8 @@ static void sdl_audio_callback(void *opaque, Uint8 *stream, int len)
...
@@ -2541,8 +2540,8 @@ static void sdl_audio_callback(void *opaque, Uint8 *stream, int len)
audio_size
=
audio_decode_frame
(
is
);
audio_size
=
audio_decode_frame
(
is
);
if
(
audio_size
<
0
)
{
if
(
audio_size
<
0
)
{
/* if error, just output silence */
/* if error, just output silence */
is
->
audio_buf
=
is
->
silence_buf
;
silence
=
1
;
is
->
audio_buf_size
=
sizeof
(
is
->
silence_buf
)
/
is
->
audio_tgt
.
frame_size
*
is
->
audio_tgt
.
frame_size
;
is
->
audio_buf_size
=
SDL_AUDIO_MIN_BUFFER_SIZE
/
is
->
audio_tgt
.
frame_size
*
is
->
audio_tgt
.
frame_size
;
}
else
{
}
else
{
if
(
is
->
show_mode
!=
SHOW_MODE_VIDEO
)
if
(
is
->
show_mode
!=
SHOW_MODE_VIDEO
)
update_sample_display
(
is
,
(
int16_t
*
)
is
->
audio_buf
,
audio_size
);
update_sample_display
(
is
,
(
int16_t
*
)
is
->
audio_buf
,
audio_size
);
...
@@ -2553,11 +2552,11 @@ static void sdl_audio_callback(void *opaque, Uint8 *stream, int len)
...
@@ -2553,11 +2552,11 @@ static void sdl_audio_callback(void *opaque, Uint8 *stream, int len)
len1
=
is
->
audio_buf_size
-
is
->
audio_buf_index
;
len1
=
is
->
audio_buf_size
-
is
->
audio_buf_index
;
if
(
len1
>
len
)
if
(
len1
>
len
)
len1
=
len
;
len1
=
len
;
if
(
!
is
->
muted
&&
is
->
audio_volume
==
SDL_MIX_MAXVOLUME
)
if
(
!
is
->
muted
&&
!
silence
&&
is
->
audio_volume
==
SDL_MIX_MAXVOLUME
)
memcpy
(
stream
,
(
uint8_t
*
)
is
->
audio_buf
+
is
->
audio_buf_index
,
len1
);
memcpy
(
stream
,
(
uint8_t
*
)
is
->
audio_buf
+
is
->
audio_buf_index
,
len1
);
else
{
else
{
memset
(
stream
,
is
->
silence_buf
[
0
]
,
len1
);
memset
(
stream
,
0
,
len1
);
if
(
!
is
->
muted
)
if
(
!
is
->
muted
&&
!
silence
)
SDL_MixAudio
(
stream
,
(
uint8_t
*
)
is
->
audio_buf
+
is
->
audio_buf_index
,
len1
,
is
->
audio_volume
);
SDL_MixAudio
(
stream
,
(
uint8_t
*
)
is
->
audio_buf
+
is
->
audio_buf_index
,
len1
,
is
->
audio_volume
);
}
}
len
-=
len1
;
len
-=
len1
;
...
...
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