Skip to content

Commit

Permalink
remove PREFERED_SERVER_ENCODING_ORDER and just use PREFERED_ENCODING_…
Browse files Browse the repository at this point in the history
…ORDER as before, rely on the problematic encoding list to ensure we don't use vp9 when we should not

git-svn-id: https://xpra.org/svn/Xpra/trunk@9276 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed May 6, 2015
1 parent 5923012 commit fffcee0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
6 changes: 2 additions & 4 deletions src/xpra/codecs/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,8 @@ def has_codec(name):

#note: this is just for defining the order of encodings,
#so we have both core encodings (rgb24/rgb32) and regular encodings (rgb) in here:
PREFERED_ENCODING_ORDER = ["h264", "vp8", "png", "png/P", "png/L", "webp", "rgb", "rgb24", "rgb32", "jpeg", "h265", "vp9"]
#now that vp9 is usable, move it up the list, but only on the server,
#(don't make the clients request vp9 since they could be connecting to an old server..)
PREFERED_SERVER_ENCODING_ORDER = ["h264", "vp9", "vp8", "png", "png/P", "png/L", "webp", "rgb", "rgb24", "rgb32", "jpeg", "h265"]
PREFERED_ENCODING_ORDER = ["h264", "vp9", "vp8", "png", "png/P", "png/L", "webp", "rgb", "rgb24", "rgb32", "jpeg", "h265"]


from xpra.net import compression
RGB_COMP_OPTIONS = ["Raw RGB"]
Expand Down
4 changes: 2 additions & 2 deletions src/xpra/server/server_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from xpra.child_reaper import reaper_cleanup
from xpra.scripts.config import python_platform, parse_bool_or_int
from xpra.scripts.main import sound_option
from xpra.codecs.loader import PREFERED_SERVER_ENCODING_ORDER, PROBLEMATIC_ENCODINGS, load_codecs, codec_versions, has_codec, get_codec
from xpra.codecs.loader import PREFERED_ENCODING_ORDER, PROBLEMATIC_ENCODINGS, load_codecs, codec_versions, has_codec, get_codec
from xpra.codecs.codec_constants import get_PIL_encodings
from xpra.codecs.video_helper import getVideoHelper, ALL_VIDEO_ENCODER_OPTIONS, ALL_CSC_MODULE_OPTIONS
if sys.version > '3':
Expand Down Expand Up @@ -289,7 +289,7 @@ def add_encodings(encodings):
self.encodings = encs
self.core_encodings = core_encs
self.lossless_encodings = [x for x in self.core_encodings if (x.startswith("png") or x.startswith("rgb") or x=="webp")]
pref = [x for x in PREFERED_SERVER_ENCODING_ORDER if x in self.encodings]
pref = [x for x in PREFERED_ENCODING_ORDER if x in self.encodings]
if pref:
self.default_encoding = pref[0]
else:
Expand Down
4 changes: 2 additions & 2 deletions src/xpra/server/window_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
from xpra.server.region import rectangle, add_rectangle, remove_rectangle #@UnresolvedImport
from xpra.codecs.xor.cyxor import xor_str #@UnresolvedImport
from xpra.server.picture_encode import webp_encode, rgb_encode, PIL_encode, mmap_encode, mmap_send
from xpra.codecs.loader import PREFERED_SERVER_ENCODING_ORDER, get_codec
from xpra.codecs.loader import PREFERED_ENCODING_ORDER, get_codec
from xpra.codecs.codec_constants import LOSSY_PIXEL_FORMATS, get_PIL_encodings
from xpra.net import compression

Expand Down Expand Up @@ -553,7 +553,7 @@ def update_encoding_selection(self, encoding=None):
common_encodings.append("rgb")
if self.webp_leaks and "webp" in common_encodings:
common_encodings.remove("webp")
self.common_encodings = [x for x in PREFERED_SERVER_ENCODING_ORDER if x in common_encodings]
self.common_encodings = [x for x in PREFERED_ENCODING_ORDER if x in common_encodings]
if not self.common_encodings:
raise Exception("no common encodings found (server: %s vs client: %s)" % (", ".join(self._encoders.keys()), ", ".join(self.core_encodings)))
#ensure the encoding chosen is supported by this source:
Expand Down
8 changes: 4 additions & 4 deletions src/xpra/server/window_video_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
TransientCodecException, RGB_FORMATS, PIXEL_SUBSAMPLING, LOSSY_PIXEL_FORMATS
from xpra.server.window_source import WindowSource, STRICT_MODE, AUTO_REFRESH_SPEED, AUTO_REFRESH_QUALITY
from xpra.server.video_subregion import VideoSubregion
from xpra.codecs.loader import PREFERED_SERVER_ENCODING_ORDER
from xpra.codecs.loader import PREFERED_ENCODING_ORDER
from xpra.util import updict
from xpra.log import Logger

Expand Down Expand Up @@ -87,7 +87,7 @@ def init_encoders(self):
#these are used for non-video areas, ensure "jpeg" is used if available
#as we may be dealing with large areas still, and we want speed:
nv_common = (set(self.server_core_encodings) & set(self.core_encodings)) - set(self.video_encodings)
self.non_video_encodings = [x for x in PREFERED_SERVER_ENCODING_ORDER if x in nv_common]
self.non_video_encodings = [x for x in PREFERED_ENCODING_ORDER if x in nv_common]

#those two instances should only ever be modified or accessed from the encode thread:
self._csc_encoder = None
Expand Down Expand Up @@ -285,7 +285,7 @@ def do_set_client_properties(self, properties):
WindowSource.do_set_client_properties(self, properties)
#encodings may have changed, so redo this:
nv_common = (set(self.server_core_encodings) & set(self.core_encodings)) - set(self.video_encodings)
self.non_video_encodings = [x for x in PREFERED_SERVER_ENCODING_ORDER if x in nv_common]
self.non_video_encodings = [x for x in PREFERED_ENCODING_ORDER if x in nv_common]
log("do_set_client_properties(%s) csc_modes=%s, full_csc_modes=%s, video_scaling=%s, video_subregion=%s, uses_swscale=%s, non_video_encodings=%s, scaling_control=%s", properties, self.csc_modes, self.full_csc_modes, self.supports_video_scaling, self.supports_video_subregion, self.uses_swscale, self.non_video_encodings, self.scaling_control)

def get_best_encoding_impl_default(self):
Expand Down Expand Up @@ -1234,7 +1234,7 @@ def video_encode(self, encoding, image, options):
fallback_encodings = set(self._encoders.keys()) - set(self.video_encodings) - set(["mmap"])
log.error("BUG: failed to setup a video pipeline for %s encoding with source format %s, will fallback to: %s", encoding, src_format, ", ".join(list(fallback_encodings)))
assert len(fallback_encodings)>0
fallback_encoding = [x for x in PREFERED_SERVER_ENCODING_ORDER if x in fallback_encodings][0]
fallback_encoding = [x for x in PREFERED_ENCODING_ORDER if x in fallback_encodings][0]
return self._encoders[fallback_encoding](fallback_encoding, image, options)
assert self._video_encoder

Expand Down

0 comments on commit fffcee0

Please sign in to comment.