Skip to content

Commit

Permalink
#3706 try to avoid copying pixels too many times
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Dec 13, 2022
1 parent a128765 commit 8ba012c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions xpra/codecs/gstreamer/encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from xpra.util import typedict, parse_simple_dict
from xpra.codecs.codec_constants import video_spec
from xpra.gst_common import (
import_gst, make_buffer, normv,
import_gst, normv,
STREAM_TYPE, BUFFER_FORMAT,
)
from xpra.gst_pipeline import Pipeline, GST_FLOW_OK
Expand Down Expand Up @@ -246,12 +246,20 @@ def compress_image(self, image, options=None):
if image.get_planes()==ImageWrapper.PACKED:
data = image.get_pixels()
else:
#merge all planes into a single buffer:
data = b"".join(image.get_pixels())
log(f"compress_image({image}, {options}) state={self.state} pixel buffer size={len(data)}")
if self.state in ("stopped", "error"):
log(f"pipeline is in {self.state} state, dropping buffer")
return None
buf = make_buffer(data)
mf = Gst.MemoryFlags
buf = Gst.Buffer.new_wrapped_full(
mf.PHYSICALLY_CONTIGUOUS | mf.READONLY,
data,
len(data),
0,
None,
None)
#duration = normv(0)
#if duration>0:
# buf.duration = duration
Expand Down

0 comments on commit 8ba012c

Please sign in to comment.