Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
3ac52259
Commit
3ac52259
authored
Aug 30, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
preserve meta data when reallocating a block (fix previous commit)
parent
31d2760a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
src/misc/block.c
src/misc/block.c
+15
-7
No files found.
src/misc/block.c
View file @
3ac52259
...
@@ -76,6 +76,16 @@ static void BlockRelease( block_t *p_block )
...
@@ -76,6 +76,16 @@ static void BlockRelease( block_t *p_block )
free
(
p_block
);
free
(
p_block
);
}
}
static
void
BlockMetaCopy
(
block_t
*
restrict
out
,
const
block_t
*
in
)
{
out
->
i_dts
=
in
->
i_dts
;
out
->
i_pts
=
in
->
i_pts
;
out
->
i_flags
=
in
->
i_flags
;
out
->
i_length
=
in
->
i_length
;
out
->
i_rate
=
in
->
i_rate
;
out
->
i_samples
=
in
->
i_samples
;
}
/* Memory alignment */
/* Memory alignment */
#define BLOCK_ALIGN 16
#define BLOCK_ALIGN 16
/* Initial size of reserved header and footer */
/* Initial size of reserved header and footer */
...
@@ -156,8 +166,11 @@ block_t *block_Realloc( block_t *p_block, ssize_t i_prebody, size_t i_body )
...
@@ -156,8 +166,11 @@ block_t *block_Realloc( block_t *p_block, ssize_t i_prebody, size_t i_body )
return
p_block
;
return
p_block
;
}
}
/* Not enough room: allocate a new buffer */
/* Not enough room: allocate a new buffer */
block_t
*
p_rea
=
block_Alloc
(
requested
);
if
(
p_rea
)
BlockMetaCopy
(
p_rea
,
p_block
);
block_Release
(
p_block
);
block_Release
(
p_block
);
return
block_Alloc
(
requested
)
;
return
p_rea
;
}
}
/* First, shrink payload */
/* First, shrink payload */
...
@@ -186,12 +199,7 @@ block_t *block_Realloc( block_t *p_block, ssize_t i_prebody, size_t i_body )
...
@@ -186,12 +199,7 @@ block_t *block_Realloc( block_t *p_block, ssize_t i_prebody, size_t i_body )
block_t
*
p_rea
=
block_Alloc
(
requested
);
block_t
*
p_rea
=
block_Alloc
(
requested
);
if
(
p_rea
)
if
(
p_rea
)
{
{
p_rea
->
i_dts
=
p_block
->
i_dts
;
BlockMetaCopy
(
p_rea
,
p_block
);
p_rea
->
i_pts
=
p_block
->
i_pts
;
p_rea
->
i_flags
=
p_block
->
i_flags
;
p_rea
->
i_length
=
p_block
->
i_length
;
p_rea
->
i_rate
=
p_block
->
i_rate
;
p_rea
->
i_samples
=
p_block
->
i_samples
;
p_rea
->
p_buffer
+=
i_prebody
;
p_rea
->
p_buffer
+=
i_prebody
;
p_rea
->
i_buffer
-=
i_prebody
;
p_rea
->
i_buffer
-=
i_prebody
;
memcpy
(
p_rea
->
p_buffer
,
p_block
->
p_buffer
,
p_block
->
i_buffer
);
memcpy
(
p_rea
->
p_buffer
,
p_block
->
p_buffer
,
p_block
->
i_buffer
);
...
...
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