webrtcsink: encoded streams: address last review comments

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1194>
This commit is contained in:
Mathieu Duponchelle 2023-06-06 15:41:58 +02:00
parent ab1ec12698
commit fda5aed89f
3 changed files with 17 additions and 15 deletions

View file

@ -6094,12 +6094,12 @@
"klass": "Sink/Network/WebRTC",
"pad-templates": {
"audio_%%u": {
"caps": "audio/x-raw:\n",
"caps": "audio/x-raw:\naudio/x-opus:\n",
"direction": "sink",
"presence": "request"
},
"video_%%u": {
"caps": "video/x-raw:\n\nvideo/x-raw(memory:CUDAMemory):\n\nvideo/x-raw(memory:GLMemory):\n\nvideo/x-raw(memory:NVMM):\n",
"caps": "video/x-raw:\n\nvideo/x-raw(memory:CUDAMemory):\n\nvideo/x-raw(memory:GLMemory):\n\nvideo/x-raw(memory:NVMM):\nvideo/x-vp8:\nvideo/x-h264:\nvideo/x-vp9:\nvideo/x-h265:\n",
"direction": "sink",
"presence": "request"
}
@ -6125,12 +6125,12 @@
"klass": "Sink/Network/WebRTC",
"pad-templates": {
"audio_%%u": {
"caps": "audio/x-raw:\n",
"caps": "audio/x-raw:\naudio/x-opus:\n",
"direction": "sink",
"presence": "request"
},
"video_%%u": {
"caps": "video/x-raw:\n\nvideo/x-raw(memory:CUDAMemory):\n\nvideo/x-raw(memory:GLMemory):\n\nvideo/x-raw(memory:NVMM):\n",
"caps": "video/x-raw:\n\nvideo/x-raw(memory:CUDAMemory):\n\nvideo/x-raw(memory:GLMemory):\n\nvideo/x-raw(memory:NVMM):\nvideo/x-vp8:\nvideo/x-h264:\nvideo/x-vp9:\nvideo/x-h265:\n",
"direction": "sink",
"presence": "request"
}
@ -6156,13 +6156,13 @@
"long-name": "WebRTCSrc",
"pad-templates": {
"audio_%%u": {
"caps": "audio/x-raw(ANY):\naudio/x-opus:\napplication/x-rtp:\n",
"caps": "audio/x-raw(ANY):\napplication/x-rtp:\naudio/x-opus:\n",
"direction": "src",
"presence": "sometimes",
"type": "GstWebRTCSrcPad"
},
"video_%%u": {
"caps": "video/x-raw(ANY):\napplication/x-rtp:\n",
"caps": "video/x-raw(ANY):\napplication/x-rtp:\nvideo/x-vp8:\nvideo/x-h264:\nvideo/x-vp9:\nvideo/x-h265:\n",
"direction": "src",
"presence": "sometimes",
"type": "GstWebRTCSrcPad"

View file

@ -314,12 +314,10 @@ impl Codec {
pub fn build_encoder(&self) -> Option<Result<gst::Element, Error>> {
self.encoding_info.as_ref().map(|info| {
info.encoder.create().build().with_context(|| {
format!(
"Creating payloader {}",
self.encoding_info.as_ref().unwrap().encoder.name()
)
})
info.encoder
.create()
.build()
.with_context(|| format!("Creating payloader {}", info.encoder.name()))
})
}
@ -344,7 +342,11 @@ impl Codec {
let mut structure_builder = gst::Structure::builder("video/x-raw")
.field("pixel-aspect-ratio", gst::Fraction::new(1, 1));
if self.encoder_name().map(|e| e.as_str() == "nvh264enc").unwrap_or(false) {
if self
.encoder_name()
.map(|e| e.as_str() == "nvh264enc")
.unwrap_or(false)
{
// Quirk: nvh264enc can perform conversion from RGB formats, but
// doesn't advertise / negotiate colorimetry correctly, leading
// to incorrect color display in Chrome (but interestingly not in

View file

@ -3,7 +3,7 @@
use gst::prelude::*;
use crate::signaller::{prelude::*, Signallable, Signaller};
use crate::utils::*;
use crate::utils::{Codec, Codecs, AUDIO_CAPS, RTP_CAPS, VIDEO_CAPS};
use crate::webrtcsrc::WebRTCSrcPad;
use anyhow::{Context, Error};
use gst::glib;
@ -76,7 +76,7 @@ impl ObjectImpl for WebRTCSrc {
gst::ParamSpecArray::builder("audio-codecs")
.flags(glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY)
.blurb(&format!("Names of audio codecs to be be used during the SDP negotiation. Valid values: [{}]",
Codecs::video_codec_names().into_iter().collect::<Vec<String>>().join(", ")
Codecs::audio_codec_names().into_iter().collect::<Vec<String>>().join(", ")
))
.element_spec(&glib::ParamSpecString::builder("audio-codec-name").build())
.build(),