directdrawsink: Fix crash when exposing in GST_STATE_READY

Fixes bug #541962.
This commit is contained in:
Julien Isorce 2009-08-09 12:25:01 +02:00 committed by Sebastian Dröge
parent 6115e0cb0e
commit 182dad5c66

View file

@ -961,10 +961,12 @@ gst_directdraw_sink_show_frame (GstBaseSink * bsink, GstBuffer * buf)
/* Write each line respecting the destination surface pitch */
data = surf_desc.lpSurface;
src_pitch = GST_BUFFER_SIZE (buf) / ddrawsink->video_height;
for (line = 0; line < surf_desc.dwHeight; line++) {
memcpy (data, GST_BUFFER_DATA (buf) + (line * src_pitch), src_pitch);
data += surf_desc.lPitch;
if (ddrawsink->video_height) {
src_pitch = GST_BUFFER_SIZE (buf) / ddrawsink->video_height;
for (line = 0; line < surf_desc.dwHeight; line++) {
memcpy (data, GST_BUFFER_DATA (buf) + (line * src_pitch), src_pitch);
data += surf_desc.lPitch;
}
}
/* Unlock the surface */