Skip to content

Commit

Permalink
#3964 ensure NV12 encoded streams are decoded the same as YUV420P
Browse files Browse the repository at this point in the history
since the subsampling is the same
  • Loading branch information
totaam committed Mar 27, 2024
1 parent 38ff693 commit 029f7b5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions xpra/codecs/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
"YUV422P" : 1.5,
}

CSC_ALIAS = {"NV12": "YUV420P"}


def get_plane_name(pixel_format: str = "YUV420P", index: int = 0) -> str:
return {
Expand Down
4 changes: 2 additions & 2 deletions xpra/codecs/gstreamer/capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
)
from xpra.gtk.gobject import n_arg_signal
from xpra.gstreamer.pipeline import Pipeline
from xpra.codecs.constants import get_profile
from xpra.codecs.constants import get_profile, CSC_ALIAS
from xpra.codecs.gstreamer.common import (
get_version, get_type, get_info,
init_module, cleanup_module,
Expand Down Expand Up @@ -238,7 +238,7 @@ def on_new_sample(self, _bus) -> int:
self.frames += 1
client_info = self.extra_client_info
client_info["frame"] = self.frames
client_info["csc"] = self.csc_mode
client_info["csc"] = CSC_ALIAS.get(self.csc_mode, self.csc_mode)
self.extra_client_info = {}
self.emit("new-image", self.pixel_format, data, client_info)
if SAVE_TO_FILE:
Expand Down
4 changes: 2 additions & 2 deletions xpra/codecs/nvidia/nvenc/encoder.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ from xpra.codecs.nvidia.cuda.context import (
cuda_device_context, load_device,
)
from xpra.codecs.nvidia.cuda.errors import get_error_name
from xpra.codecs.constants import VideoSpec, TransientCodecException
from xpra.codecs.constants import VideoSpec, TransientCodecException, CSC_ALIAS
from xpra.codecs.image import ImageWrapper
from xpra.codecs.nvidia.util import (
get_nvidia_module_version, get_license_keys,
Expand Down Expand Up @@ -2709,7 +2709,7 @@ cdef class Encoder:
self.free_memory, self.total_memory = driver.mem_get_info()

client_options = {
"csc" : self.src_format,
"csc" : CSC_ALIAS.get(self.src_format, self.src_format),
"frame" : int(self.frames),
"pts" : int(timestamp-self.first_frame_timestamp),
}
Expand Down

0 comments on commit 029f7b5

Please sign in to comment.