From: Sven C. Dack <[email protected]>

Signed-off-by: Anton Khirnov <[email protected]>
---
 libavdevice/x11grab.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c
index 0e63d09..a4a3625 100644
--- a/libavdevice/x11grab.c
+++ b/libavdevice/x11grab.c
@@ -384,10 +384,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) {
@@ -404,9 +403,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;
 }
 
-- 
1.7.5.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to