xpra icon
Bug tracker and wiki

Ticket #981: sync-paint-with-video-v5.patch

File sync-paint-with-video-v5.patch, 6.4 KB (added by Antoine Martin, 4 years ago)

patch update to r12780

  • xpra/client/ui_client_base.py

     
    29082908                decode_time = int(end*1000*1000-start*1000*1000)
    29092909                self.pixel_counter.append((start, end, width*height))
    29102910                dms = "%sms" % (int(decode_time/100)/10.0)
    2911                 paintlog("record_decode_time(%s, %s) wid=%s, %s: %sx%s, %s", success, message, wid, coding, width, height, dms)
     2911                paintlog.info("record_decode_time(%s, %s) wid=%s, %s: %sx%s, %s", success, message, wid, coding, width, height, dms)
    29122912            elif success==0:
    29132913                decode_time = -1
    29142914                paintlog("record_decode_time(%s, %s) decoding error on wid=%s, %s: %sx%s", success, message, wid, coding, width, height)
  • xpra/server/window/window_source.py

     
    12141214        if not self.is_cancelled():
    12151215            self.do_send_delayed_regions(damage_time, window, regions, coding, options)
    12161216
    1217     def do_send_delayed_regions(self, damage_time, window, regions, coding, options, exclude_region=None, get_best_encoding=None):
     1217    def do_send_delayed_regions(self, damage_time, window, regions, coding, options, exclude_region=None, get_best_encoding=None, flush_offset=0):
    12181218        ww,wh = window.get_dimensions()
    12191219        speed = options.get("speed") or self._current_speed
    12201220        quality = options.get("quality") or self._current_quality
     
    12821282                log("send_delayed_regions: %s regions with %s pixels (encoding=%s, actual=%s)", len(regions), pixel_count, coding, actual_encoding)
    12831283                if pixel_count>=ww*wh or self.must_encode_full_frame(window, actual_encoding):
    12841284                    #use full screen dimensions:
    1285                     self.process_damage_region(damage_time, window, 0, 0, ww, wh, actual_encoding, options)
     1285                    self.process_damage_region(damage_time, window, 0, 0, ww, wh, actual_encoding, options, flush=flush_offset)
    12861286                    return
    12871287
    12881288        #we're processing a number of regions separately,
     
    13021302                self.process_damage_region(damage_time, window, 0, 0, ww, wh, actual_encoding, options)
    13031303                #we can stop here (full screen update will include the other regions)
    13041304                return
    1305             i_reg_enc.append((i, region, actual_encoding))
     1305            i_reg_enc.append((flush_offset+i, region, actual_encoding))
    13061306
    13071307        #reversed so that i=0 is last for flushing
    13081308        for i, region, actual_encoding in reversed(i_reg_enc):
  • xpra/server/window/window_video_source.py

     
    449449    def must_batch(self, delay):
    450450        #force batching when using video region
    451451        #because the video region code is in the send_delayed path
     452        #and because we want to flush all the paints with the video
    452453        return self.video_subregion.rectangle is not None or WindowSource.must_batch(self, delay)
    453454
    454455
     
    534535        """
    535536        #overrides the default method for finding the encoding of a region
    536537        #so we can ensure we don't use the video encoder when we don't want to:
    537         def send_nonvideo(regions=regions, encoding=coding, exclude_region=None, get_best_encoding=self.get_best_nonvideo_encoding):
    538             WindowSource.do_send_delayed_regions(self, damage_time, window, regions, encoding, options, exclude_region=exclude_region, get_best_encoding=get_best_encoding)
     538        def send_nonvideo(regions=regions, encoding=coding, exclude_region=None, get_best_encoding=self.get_best_nonvideo_encoding, flush_offset=0):
     539            WindowSource.do_send_delayed_regions(self, damage_time, window, regions, encoding, options, exclude_region=exclude_region, get_best_encoding=get_best_encoding, flush_offset=flush_offset)
    539540
    540541        if self.is_tray:
    541542            sublog("BUG? video for tray - don't use video region!")
     
    589590                    if len(same_c)==1:
    590591                        actual_vr = same_c[0]
    591592
    592         if actual_vr is None:
    593             sublog("send_delayed_regions: video region %s not found in: %s", vr, regions)
    594         else:
    595             #found the video region:
     593        def send_vr():
     594            if not actual_vr:
     595                return
    596596            #send this using the video encoder:
    597597            video_options = options.copy()
    598598            video_options["av-sync"] = True
    599599            self.process_damage_region(damage_time, window, actual_vr.x, actual_vr.y, actual_vr.width, actual_vr.height, coding, video_options, 0)
    600600
    601             #now substract this region from the rest:
     601        if actual_vr is None:
     602            sublog("send_delayed_regions: video region %s not found in: %s", vr, regions)
     603        else:
     604            #found the video region, substract it from the rest:
    602605            trimmed = []
    603606            for r in regions:
    604607                trimmed += r.substract_rect(actual_vr)
     608            sublog("send_delayed_regions: substracted %s from %s gives us %s", actual_vr, regions, trimmed)
    605609            if not trimmed:
    606                 sublog("send_delayed_regions: nothing left after removing video region %s", actual_vr)
     610                #nothing else to send:
     611                send_vr()
    607612                return
    608             sublog("send_delayed_regions: substracted %s from %s gives us %s", actual_vr, regions, trimmed)
    609613            regions = trimmed
    610614
    611615        #merge existing damage delayed region if there is one:
     
    627631            delay = max(self.batch_config.delay*4, 50)
    628632            delay = min(delay, self.video_subregion.non_max_wait-elapsed)
    629633        if delay<=25:
    630             send_nonvideo(regions=regions, encoding=None)
     634            send_nonvideo(regions=regions, encoding=None, flush_offset=int(actual_vr is not None))
     635            send_vr()
    631636        else:
    632637            self._damage_delayed = damage_time, window, regions, coding, options or {}
    633638            sublog("send_delayed_regions: delaying non video regions %s some more by %ims", regions, delay)