Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
gstreamer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
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
luzpaz
gstreamer
Commits
6e0024e7
Commit
6e0024e7
authored
Jan 05, 2012
by
Wim Taymans
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
memory: take offset into account
Take the offset into account whem mapping and unmapping the buffer.
parent
cff9b371
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
3 deletions
+13
-3
docs/design/part-memory.txt
docs/design/part-memory.txt
+1
-1
gst/gstmemory.c
gst/gstmemory.c
+2
-2
tests/check/gst/gstmemory.c
tests/check/gst/gstmemory.c
+10
-0
No files found.
docs/design/part-memory.txt
View file @
6e0024e7
...
...
@@ -127,7 +127,7 @@ Data Access
When the final reference on a memory object is dropped, all outstanding
mappings are automatically unmapped.
Resizing a GstMemory does not influence any current mappings.
Resizing a GstMemory does not influence any current mappings
an any way
.
Copy
...
...
gst/gstmemory.c
View file @
6e0024e7
...
...
@@ -206,7 +206,7 @@ _default_mem_map (GstMemoryDefault * mem, gsize * size, gsize * maxsize,
if
(
size
)
*
size
=
mem
->
size
;
if
(
maxsize
)
*
maxsize
=
mem
->
maxsize
;
*
maxsize
=
mem
->
maxsize
-
mem
->
offset
;
return
mem
->
data
+
mem
->
offset
;
}
...
...
@@ -215,7 +215,7 @@ static gboolean
_default_mem_unmap
(
GstMemoryDefault
*
mem
,
gpointer
data
,
gsize
size
)
{
if
(
size
!=
-
1
)
{
g_return_val_if_fail
(
size
<=
mem
->
maxsize
,
FALSE
);
g_return_val_if_fail
(
mem
->
offset
+
size
<=
mem
->
maxsize
,
FALSE
);
mem
->
size
=
size
;
}
return
TRUE
;
...
...
tests/check/gst/gstmemory.c
View file @
6e0024e7
...
...
@@ -421,6 +421,16 @@ GST_START_TEST (test_map)
ASSERT_CRITICAL
(
gst_memory_unmap
(
mem
,
data
,
maxsize
+
1
));
gst_memory_unmap
(
mem
,
data
,
maxsize
);
/* add offset, maxsize should be smaller now */
gst_memory_resize
(
mem
,
1
,
99
);
data
=
gst_memory_map
(
mem
,
&
size
,
&
maxsize
,
GST_MAP_READ
);
fail_unless
(
data
!=
NULL
);
fail_unless
(
size
==
99
);
fail_unless
(
maxsize
==
maxalloc
-
1
);
ASSERT_CRITICAL
(
gst_memory_unmap
(
mem
,
data
,
maxsize
+
1
));
gst_memory_unmap
(
mem
,
data
,
maxsize
);
gst_memory_unref
(
mem
);
}
...
...
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