xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.


Ticket #2022: fix_nodetect.patch

File fix_nodetect.patch, 4.2 KB (added by Nathan Hallquist, 2 years ago)
  • xpra/server/window/video_scoring.py

     
    7575                       target_quality, min_quality,
    7676                       target_speed, min_speed,
    7777                       current_csce, current_ve,
    78                        score_delta, ffps):
     78                       score_delta, ffps, detection):
    7979    """
    8080        Given an optional csc step (csc_format and csc_spec), and
    8181        and a required encoding step (encoder_spec and width/height),
     
    9696
    9797    #multiplier for setup_cost:
    9898    #(lose points if we have less than N fps)
    99     setup_cost_mult = 1+max(0, MIN_FPS_COST-ffps)
     99    if(detection):
     100        setup_cost_mult = 1+max(0, MIN_FPS_COST-ffps)
     101    else:
     102        setup_cost_mult = 0
    100103
    101104    #how well the codec deals with larger screen sizes:
    102105    sizescore = 100
  • xpra/server/window/video_subregion.py

     
    288288            self.novideoregion("disabled")
    289289            return
    290290        if not self.detection:
     291            if not self.rectangle:
     292                return
     293            from_time = max(starting_at, monotonic_time()-MAX_TIME, self.min_time)
     294            self.time = monotonic_time()
     295            lde = [x for x in tuple(last_damage_events) if x[0]>=from_time]
     296            incount = 0;
     297            for _,x,y,w,h in lde:
     298                r = rectangle(x,y,w,h)
     299                inregion = r.intersection_rect(self.rectangle)
     300                if inregion:
     301                    incount += inregion.width*inregion.height
     302            elapsed = monotonic_time()-from_time
     303            if elapsed<=0:
     304                self.fps = 0
     305            else:
     306                self.fps = int(incount/(self.rectangle.width*self.rectangle.height) / elapsed)
    291307            return
    292308        sslog("%s.identify_video_subregion(..)", self)
    293309        sslog("identify_video_subregion(%s, %s, %s, %s)", ww, wh, damage_events_count, last_damage_events)
  • xpra/server/window/window_video_source.py

     
    564564        WindowSource.full_quality_refresh(self, damage_options)
    565565
    566566
     567    def quality_changed(self, window, *args):
     568        WindowSource.quality_changed(self, window, args)
     569        self.video_context_clean()
     570
     571
     572    def get_detection(self):
     573        detection = False
     574        vs = self.video_subregion
     575        if vs and vs.rectangle:
     576            if vs.detection:
     577                detection = True
     578        return detection
     579
     580
    567581    def must_batch(self, delay):
    568582        #force batching when using video region
    569583        #because the video region code is in the send_delayed path
     
    12281242                        #avoid subsampling with shadow servers:
    12291243                        score_delta -= 40
    12301244                    ffps = self.get_video_fps(width, height)
     1245                    detection = self.get_detection()
    12311246                    score_data = get_pipeline_score(enc_in_format, csc_spec, encoder_spec, width, height, scaling,
    12321247                                                    target_q, min_q, target_s, min_s,
    12331248                                                    self._csc_encoder, self._video_encoder,
    1234                                                     score_delta, ffps)
     1249                                                    score_delta, ffps, detection)
    12351250                    if score_data:
    12361251                        scores.append(score_data)
    12371252            if not FORCE_CSC or src_format==FORCE_CSC_MODE:
     
    21162131    def video_encoder_timeout(self):
    21172132        videolog("video_encoder_timeout() will close video encoder=%s", self._video_encoder)
    21182133        self.video_encoder_timer = None
    2119         self.video_context_clean()
     2134        if self.get_detection():
     2135            self.video_context_clean()
    21202136
    21212137
    21222138    def csc_image(self, image, width, height):