Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/guide/advanced/video-codecs.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ PeerConnectionFactory factory = PeerConnectionFactory.builder()
| Platform | Hardware encoding |
|---|---|
| Windows | H.264 with NVENC on NVIDIA GPUs, otherwise through the Media Foundation encoder of the GPU driver (AMD, Intel) |
| Linux | H.264 with NVENC on NVIDIA GPUs; other GPUs encode in software |
| Linux | H.264 with NVENC on NVIDIA GPUs, otherwise through the VA-API encoder of the GPU driver (Intel, AMD) |
| macOS | H.264 through VideoToolbox, as with `DefaultVideoEncoderFactory` |

NVENC needs an NVIDIA driver of version 522 or newer on Windows, 520 or newer on Linux; it is loaded at run time, so nothing needs to be installed on machines without one.
NVENC needs an NVIDIA driver of version 522 or newer on Windows, 520 or newer on Linux. VA-API needs libva 2 and a driver that encodes H.264, such as Intel's `intel-media-va-driver` (iHD) or Mesa's `mesa-va-drivers` for AMD, and access to a render node in `/dev/dri`. All of them are loaded at run time, so nothing needs to be installed on machines without them.

The hardware encoders take over H.264 Constrained Baseline and Baseline with packetization mode 1, formats the software encoder offers too, so encoding in hardware never changes what is negotiated. When a hardware encoder fails to start, for example because the GPU has no encoder sessions left, or fails while encoding, the stream switches to the next encoder in line (on Windows, from NVENC to Media Foundation), and finally to the software encoder, and continues with a key frame. On a machine without a hardware encoder, the factory encodes like `DefaultVideoEncoderFactory`.
The hardware encoders take over H.264 Constrained Baseline and Baseline with packetization mode 1, formats the software encoder offers too, so encoding in hardware never changes what is negotiated. When a hardware encoder fails to start, for example because the GPU has no encoder sessions left, or fails while encoding, the stream switches to the next encoder in line (e.g. from NVENC to Media Foundation on Windows), and finally to the software encoder, and continues with a key frame. On a machine without a hardware encoder, the factory encodes like `DefaultVideoEncoderFactory`.

Which encoder a stream uses shows in the `encoderImplementation` statistic of its `outbound-rtp` stats, e.g. `NVENC (NVIDIA GeForce RTX 4070)`, `MediaFoundation (AMDh264Encoder)` or `OpenH264`.
Which encoder a stream uses shows in the `encoderImplementation` statistic of its `outbound-rtp` stats, e.g. `NVENC (NVIDIA GeForce RTX 4070)`, `MediaFoundation (AMDh264Encoder)`, `VA-API (Intel iHD driver ...)` or `OpenH264`.

### Native Codecs

Expand Down
11 changes: 11 additions & 0 deletions webrtc-jni/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ target_include_directories(${PROJECT_NAME}
if(WIN32 OR LINUX)
target_include_directories(${PROJECT_NAME} PRIVATE dependencies/nvenc/include)
endif()
if(LINUX)
# libva is loaded at run time, so building needs its headers only.
target_include_directories(${PROJECT_NAME} PRIVATE dependencies/libva/include)
endif()

set_target_properties(${PROJECT_NAME} PROPERTIES
OUTPUT_NAME "${PROJECT_NAME}-${OUTPUT_NAME_SUFFIX}"
Expand Down Expand Up @@ -170,3 +174,10 @@ if(WIN32 OR LINUX)
COMPONENT Runtime
)
endif()
if(LINUX)
install(FILES
"${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libva/COPYING"
DESTINATION "${CMAKE_INSTALL_PREFIX}/META-INF/licenses/libva"
COMPONENT Runtime
)
endif()
19 changes: 19 additions & 0 deletions webrtc-jni/src/main/cpp/dependencies/libva/COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12 changes: 12 additions & 0 deletions webrtc-jni/src/main/cpp/dependencies/libva/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# libva headers

`include/va/` holds the public headers of libva 2.17.0 (VA-API 1.17), taken
unchanged from https://github.com/intel/libva/tree/2.17.0/va, except:

- `va_drm.h` comes from `va/drm/va_drm.h`;
- `va_version.h` is generated from `va/va_version.h.in` with version 1.17.0,
as the libva build does.

The library loads `libva.so.2` and `libva-drm.so.2` at run time, so the
headers are all the build needs, including for the cross-compiled targets.
libva is licensed under the MIT license in `COPYING`.
Loading
Loading