[FFmpeg-cvslog] Remove a memory allocation and the associated memcpy.
Sven C. Dack
git at videolan.org
Wed Mar 30 17:03:12 CEST 2011
ffmpeg | branch: master | Sven C. Dack <sven.c.dack at virginmedia.com> | Wed Mar 30 17:02:29 2011 +0200| [39530272c5ab218407e5d7bcca80fd7f608a6eca] | committer: Carl Eugen Hoyos
Remove a memory allocation and the associated memcpy.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=39530272c5ab218407e5d7bcca80fd7f608a6eca
---
libavdevice/x11grab.c | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c
index be0586a..6a674ee 100644
--- a/libavdevice/x11grab.c
+++ b/libavdevice/x11grab.c
@@ -386,10 +386,9 @@ x11grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
nanosleep(&ts, NULL);
}
- if (av_new_packet(pkt, s->frame_size) < 0) {
- return AVERROR(EIO);
- }
-
+ av_init_packet(pkt);
+ pkt->data = image->data;
+ pkt->size = s->frame_size;
pkt->pts = curtime;
if(s->use_shm) {
@@ -406,9 +405,6 @@ x11grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
paint_mouse_pointer(image, s);
}
-
- /* XXX: avoid memcpy */
- memcpy(pkt->data, image->data, s->frame_size);
return s->frame_size;
}
More information about the ffmpeg-cvslog
mailing list