Update Rust examples to latest bindings versions

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-examples/-/merge_requests/21>
This commit is contained in:
Sebastian Dröge 2020-07-31 11:51:43 +03:00
parent 61d200a957
commit 3492c81fcf
9 changed files with 1259 additions and 910 deletions

View file

@ -11,15 +11,15 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.31"
version = "1.0.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85bb70cc08ec97ca5450e6eba421deeea5f172c0fc61f78b5357b2a8e8be195f"
checksum = "6b602bfe940d21c130f3895acd65221e8a61270debe89d628b9cb4e3ccb8569b"
[[package]]
name = "async-tungstenite"
version = "0.7.0"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c35882200d230428ae9cf74acb72aaa9c0a912911b4dad8fb890da49608e127"
checksum = "a5c45a0dd44b7e6533ac4e7acc38ead1a3b39885f5bbb738140d30ea528abc7c"
dependencies = [
"futures-io",
"futures-util",
@ -94,18 +94,9 @@ checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
[[package]]
name = "bytes"
version = "0.5.5"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "118cf036fbb97d0816e3c34b2d7a1e8cfc60f68fcf63d550ddbe9bd5f59c213b"
dependencies = [
"loom",
]
[[package]]
name = "cc"
version = "1.0.55"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1be3409f94d7bdceeb5f5fac551039d9b3f00e25da7a74fc4d33400a0d96368"
checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38"
[[package]]
name = "cfg-if"
@ -133,6 +124,12 @@ dependencies = [
"generic-array",
]
[[package]]
name = "either"
version = "1.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3"
[[package]]
name = "env_logger"
version = "0.7.1"
@ -253,19 +250,6 @@ dependencies = [
"slab",
]
[[package]]
name = "generator"
version = "0.6.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "add72f17bb81521258fcc8a7a3245b1e184e916bfbe34f0ea89558f440df5c68"
dependencies = [
"cc",
"libc",
"log",
"rustc_version",
"winapi",
]
[[package]]
name = "generic-array"
version = "0.12.3"
@ -288,11 +272,12 @@ dependencies = [
[[package]]
name = "gio"
version = "0.8.1"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0cd10f9415cce39b53f8024bf39a21f84f8157afa52da53837b102e585a296a5"
checksum = "3c5492e80b45e6c56214894a9a0cbe1340ab5066eb44a2dbe151393b6d7942c0"
dependencies = [
"bitflags",
"futures",
"futures-channel",
"futures-core",
"futures-io",
@ -301,27 +286,28 @@ dependencies = [
"glib",
"glib-sys",
"gobject-sys",
"lazy_static",
"libc",
"once_cell",
"thiserror",
]
[[package]]
name = "gio-sys"
version = "0.9.1"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fad225242b9eae7ec8a063bb86974aca56885014672375e5775dc0ea3533911"
checksum = "35993626299fbcaa73c0a19be8fdd01c950f9f3d3ac9cb4fb5532b924ab1a5d7"
dependencies = [
"glib-sys",
"gobject-sys",
"libc",
"pkg-config",
"system-deps",
]
[[package]]
name = "glib"
version = "0.9.3"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40fb573a09841b6386ddf15fd4bc6655b4f5b106ca962f57ecaecde32a0061c0"
checksum = "a5e0533f48640d86e8e2f3cee778a9f97588d4a0bec8be065ee51ea52346d6c1"
dependencies = [
"bitflags",
"futures-channel",
@ -329,38 +315,55 @@ dependencies = [
"futures-executor",
"futures-task",
"futures-util",
"glib-macros",
"glib-sys",
"gobject-sys",
"lazy_static",
"libc",
"once_cell",
]
[[package]]
name = "glib-macros"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41486a26d1366a8032b160b59065a59fb528530a46a49f627e7048fb8c064039"
dependencies = [
"anyhow",
"heck",
"itertools",
"proc-macro-crate",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "glib-sys"
version = "0.9.1"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95856f3802f446c05feffa5e24859fe6a183a7cb849c8449afc35c86b1e316e2"
checksum = "b6cda4af5c2f4507b7a3535b798dca2135293f4bc3a17f399ce244ef15841c4c"
dependencies = [
"libc",
"pkg-config",
"system-deps",
]
[[package]]
name = "gobject-sys"
version = "0.9.1"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31d1a804f62034eccf370006ccaef3708a71c31d561fee88564abe71177553d9"
checksum = "952133b60c318a62bf82ee75b93acc7e84028a093e06b9e27981c2b6fe68218c"
dependencies = [
"glib-sys",
"libc",
"pkg-config",
"system-deps",
]
[[package]]
name = "gstreamer"
version = "0.15.7"
version = "0.16.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce8664a114cd6ec16bece783d5eee59496919915b1f6884400ba4a953274a163"
checksum = "ce4ce1ba28d3293b8cb8c3d33f50e6da2e5cfeefa59a0d10d922ab8015791609"
dependencies = [
"bitflags",
"cfg-if",
@ -371,18 +374,20 @@ dependencies = [
"glib-sys",
"gobject-sys",
"gstreamer-sys",
"lazy_static",
"libc",
"muldiv",
"num-rational",
"once_cell",
"paste",
"pretty-hex",
"thiserror",
]
[[package]]
name = "gstreamer-sdp"
version = "0.15.6"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "547b3b0eb9e01e13ab5cc066c817e2ab758f83790145f80f62d3c8e43c2966af"
checksum = "6ebbe4fbea4f2c67982c667ba57b64b01d43bc3dc1dc4a8d3512cb33a2adc7c1"
dependencies = [
"glib",
"glib-sys",
@ -394,34 +399,34 @@ dependencies = [
[[package]]
name = "gstreamer-sdp-sys"
version = "0.8.1"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99e88ac4f9f20323ef3409dddcea3bbf58364ff8eea10b14da5303bfcb23347a"
checksum = "289c7f258d3387ae91c6058555922d8cf0704fc2bc870d1a03190bc81b040655"
dependencies = [
"glib-sys",
"gobject-sys",
"gstreamer-sys",
"libc",
"pkg-config",
"system-deps",
]
[[package]]
name = "gstreamer-sys"
version = "0.8.1"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d18da01b97d0ab5896acd5151e4c155acefd0e6c03c3dd24dd133ba054053db"
checksum = "1321f34d53bb5f60ab1aaf581e29b664b8d41601714ee1bb7dbea490b5b9ff60"
dependencies = [
"glib-sys",
"gobject-sys",
"libc",
"pkg-config",
"system-deps",
]
[[package]]
name = "gstreamer-webrtc"
version = "0.15.5"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f433d1294266fb1d65e1dc2d4de365f7f4caf23cb72db3a3bd6904eeec88cf1"
checksum = "380b9ab536c0c208ccc1d2f9f34d9221399fc4b1b498ff0e1f82a283effd2bdb"
dependencies = [
"glib",
"glib-sys",
@ -435,16 +440,16 @@ dependencies = [
[[package]]
name = "gstreamer-webrtc-sys"
version = "0.8.1"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f392bd821b42efecfc21016c8ef20da188b45a45bbb5ddf81758704f93aae615"
checksum = "ca16a3f901e69b6a2f321bf3ec2db9c265469a97daaa27a149102a5a200ddea0"
dependencies = [
"glib-sys",
"gobject-sys",
"gstreamer-sdp-sys",
"gstreamer-sys",
"libc",
"pkg-config",
"system-deps",
]
[[package]]
@ -458,9 +463,9 @@ dependencies = [
[[package]]
name = "hermit-abi"
version = "0.1.14"
version = "0.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9586eedd4ce6b3c498bc3b4dd92fc9f11166aa908a914071953768066c67909"
checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9"
dependencies = [
"libc",
]
@ -511,6 +516,15 @@ dependencies = [
"bytes",
]
[[package]]
name = "itertools"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
dependencies = [
"either",
]
[[package]]
name = "itoa"
version = "0.4.6"
@ -548,30 +562,19 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.71"
version = "0.2.74"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49"
checksum = "a2f02823cf78b754822df5f7f268fb59822e7296276d3e069d8e8cb26a14bd10"
[[package]]
name = "log"
version = "0.4.8"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
dependencies = [
"cfg-if",
]
[[package]]
name = "loom"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ecc775857611e1df29abba5c41355cdf540e7e9d4acfdf0f355eefee82330b7"
dependencies = [
"cfg-if",
"generator",
"scoped-tls",
]
[[package]]
name = "matches"
version = "0.1.8"
@ -602,9 +605,9 @@ dependencies = [
[[package]]
name = "num-rational"
version = "0.2.4"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef"
checksum = "a5b4d7360f362cfb50dde8143501e6940b22f644be75a4cc90b2d81968908138"
dependencies = [
"autocfg",
"num-integer",
@ -659,18 +662,18 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
[[package]]
name = "pin-project"
version = "0.4.22"
version = "0.4.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12e3a6cdbfe94a5e4572812a0201f8c0ed98c1c452c7b8563ce2276988ef9c17"
checksum = "ca4433fff2ae79342e497d9f8ee990d174071408f28f726d6d83af93e58e48aa"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "0.4.22"
version = "0.4.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a0ffd45cf79d88737d7cc85bfd5d2894bee1139b356e616fe85dc389c61aaf7"
checksum = "2c0e815c3ee9a031fdf5af21c10aa17c573c9c6a566328d99e3936c34e36461f"
dependencies = [
"proc-macro2",
"quote",
@ -685,9 +688,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pkg-config"
version = "0.3.17"
version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677"
checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33"
[[package]]
name = "ppv-lite86"
@ -695,6 +698,21 @@ version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea"
[[package]]
name = "pretty-hex"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be91bcc43e73799dc46a6c194a55e7aae1d86cc867c860fd4a436019af21bd8c"
[[package]]
name = "proc-macro-crate"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785"
dependencies = [
"toml",
]
[[package]]
name = "proc-macro-error"
version = "1.0.3"
@ -723,9 +741,9 @@ dependencies = [
[[package]]
name = "proc-macro-hack"
version = "0.5.16"
version = "0.5.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4"
checksum = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598"
[[package]]
name = "proc-macro-nested"
@ -735,9 +753,9 @@ checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a"
[[package]]
name = "proc-macro2"
version = "1.0.18"
version = "1.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa"
checksum = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12"
dependencies = [
"unicode-xid",
]
@ -816,42 +834,12 @@ version = "0.6.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8"
[[package]]
name = "rustc_version"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
dependencies = [
"semver",
]
[[package]]
name = "ryu"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
[[package]]
name = "scoped-tls"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28"
[[package]]
name = "semver"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
dependencies = [
"semver-parser",
]
[[package]]
name = "semver-parser"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "serde"
version = "1.0.114"
@ -871,9 +859,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.55"
version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec2c5d7e739bc07a3e73381a39d61fdb5f671c60c1df26a130690665803d8226"
checksum = "164eacbdb13512ec2745fb09d51fd5b22b0d65ed294a1dcf7285a360c80a675c"
dependencies = [
"itoa",
"ryu",
@ -923,10 +911,28 @@ dependencies = [
]
[[package]]
name = "syn"
version = "1.0.33"
name = "strum"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8d5d96e8cbb005d6959f119f773bfaebb5684296108fb32600c00cde305b2cd"
checksum = "57bd81eb48f4c437cadc685403cad539345bf703d78e63707418431cecd4522b"
[[package]]
name = "strum_macros"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87c85aa3f8ea653bfd3ddf25f7ee357ee4d204731f6aa9ad04002306f6e2774c"
dependencies = [
"heck",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "syn"
version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cdb98bcb1f9d81d07b536179c269ea15999b5d14ea958196413869445bb5250"
dependencies = [
"proc-macro2",
"quote",
@ -944,6 +950,21 @@ dependencies = [
"syn",
]
[[package]]
name = "system-deps"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f3ecc17269a19353b3558b313bba738b25d82993e30d62a18406a24aba4649b"
dependencies = [
"heck",
"pkg-config",
"strum",
"strum_macros",
"thiserror",
"toml",
"version-compare",
]
[[package]]
name = "termcolor"
version = "1.1.0"
@ -962,6 +983,26 @@ dependencies = [
"unicode-width",
]
[[package]]
name = "thiserror"
version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7dfdd070ccd8ccb78f4ad66bf1982dc37f620ef696c6b5028fe2ed83dd3d0d08"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "thread_local"
version = "1.0.1"
@ -977,6 +1018,15 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53953d2d3a5ad81d9f844a32f14ebb121f50b650cd59d0ee2a07cf13c617efed"
[[package]]
name = "toml"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a"
dependencies = [
"serde",
]
[[package]]
name = "tungstenite"
version = "0.11.0"
@ -1028,9 +1078,9 @@ checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0"
[[package]]
name = "unicode-width"
version = "0.1.7"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479"
checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
[[package]]
name = "unicode-xid"
@ -1055,6 +1105,12 @@ version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05e42f7c18b8f902290b009cde6d651262f956c98bc51bca4cd1d511c9cd85c7"
[[package]]
name = "version-compare"
version = "0.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d63556a25bae6ea31b52e640d7c41d1ab27faba4ccb600013837a3d0b3994ca1"
[[package]]
name = "version_check"
version = "0.9.2"

View file

@ -11,15 +11,15 @@ structopt = { version = "0.3", default-features = false }
anyhow = "1"
url = "2"
rand = "0.7"
async-tungstenite = { version = "0.7", features = ["gio-runtime"] }
gst = { package = "gstreamer", version = "0.15", features = ["v1_14"] }
gst-webrtc = { package = "gstreamer-webrtc", version = "0.15" }
gst-sdp = { package = "gstreamer-sdp", version = "0.15", features = ["v1_14"] }
async-tungstenite = { version = "0.8", features = ["gio-runtime"] }
gst = { package = "gstreamer", version = "0.16", features = ["v1_14"] }
gst-webrtc = { package = "gstreamer-webrtc", version = "0.16" }
gst-sdp = { package = "gstreamer-sdp", version = "0.16", features = ["v1_14"] }
serde = "1"
serde_derive = "1"
serde_json = "1.0.53"
http = "0.2"
glib = "0.9"
gio = "0.8"
glib = "0.10"
gio = "0.9"
log = "0.4.8"
env_logger = "0.7.1"

View file

@ -210,11 +210,11 @@ impl Peer {
info!("starting negotiation with peer");
let peer_clone = self.downgrade();
let promise = gst::Promise::new_with_change_func(move |res| {
let s = res.expect("no answer");
let promise = gst::Promise::with_change_func(move |res| {
let s = res.ok().flatten().expect("no answer");
let peer = upgrade_weak!(peer_clone);
if let Err(err) = peer.on_offer_created(&s.to_owned()) {
if let Err(err) = peer.on_offer_created(s) {
gst_element_error!(
peer.bin,
gst::LibraryError::Failed,
@ -231,7 +231,7 @@ impl Peer {
// Once webrtcbin has create the offer SDP for us, handle it by sending it to the peer via the
// WebSocket connection
fn on_offer_created(&self, reply: &gst::Structure) -> Result<(), anyhow::Error> {
fn on_offer_created(&self, reply: &gst::StructureRef) -> Result<(), anyhow::Error> {
let offer = reply
.get_value("offer")?
.get::<gst_webrtc::WebRTCSessionDescription>()
@ -328,8 +328,8 @@ impl Peer {
.expect("Unable to set remote description");
let peer_clone = peer.downgrade();
let promise = gst::Promise::new_with_change_func(move |reply| {
let s = reply.expect("No answer");
let promise = gst::Promise::with_change_func(move |reply| {
let s = reply.ok().flatten().expect("No answer");
let peer = upgrade_weak!(peer_clone);
if let Err(err) = peer.on_answer_created(&s.to_owned()) {
@ -493,8 +493,8 @@ impl JanusGateway {
encoding_name=webrtc_codec.encoding_name
);
let encode_bin = gst::parse_bin_from_description(bin_description, false)?;
encode_bin.set_name("encode-bin")?;
let encode_bin =
gst::parse_bin_from_description_with_name(bin_description, false, "encode-bin")?;
pipeline.add(&encode_bin).expect("Failed to add encode bin");
@ -508,7 +508,7 @@ impl JanusGateway {
.get_static_pad("sink")
.expect("Failed to get sink pad from encoder");
if let Ok(video_ghost_pad) = gst::GhostPad::new(Some("video_sink"), &sinkpad) {
if let Ok(video_ghost_pad) = gst::GhostPad::with_target(Some("video_sink"), &sinkpad) {
encode_bin.add_pad(&video_ghost_pad)?;
srcpad.link(&video_ghost_pad)?;
}
@ -522,7 +522,8 @@ impl JanusGateway {
let srcpad = vsink
.get_static_pad("src")
.expect("Element without src pad");
if let Ok(webrtc_ghost_pad) = gst::GhostPad::new(Some("webrtc_video_src"), &srcpad) {
if let Ok(webrtc_ghost_pad) = gst::GhostPad::with_target(Some("webrtc_video_src"), &srcpad)
{
encode_bin.add_pad(&webrtc_ghost_pad)?;
webrtc_ghost_pad.link(&sinkpad2)?;
}

File diff suppressed because it is too large Load diff

View file

@ -10,10 +10,10 @@ async-std = "1"
structopt = { version = "0.3", default-features = false }
anyhow = "1"
rand = "0.7"
async-tungstenite = { version = "0.5", features = ["async-std-runtime", "async-native-tls"] }
gst = { package = "gstreamer", version = "0.15", features = ["v1_14"] }
gst-webrtc = { package = "gstreamer-webrtc", version = "0.15" }
gst-sdp = { package = "gstreamer-sdp", version = "0.15", features = ["v1_14"] }
async-tungstenite = { version = "0.8", features = ["async-std-runtime", "async-native-tls"] }
gst = { package = "gstreamer", version = "0.16", features = ["v1_14"] }
gst-webrtc = { package = "gstreamer-webrtc", version = "0.16" }
gst-sdp = { package = "gstreamer-sdp", version = "0.16", features = ["v1_14"] }
serde = "1"
serde_derive = "1"
serde_json = "1"

View file

@ -193,7 +193,7 @@ impl App {
// Create a stream for handling the GStreamer message asynchronously
let bus = pipeline.get_bus().unwrap();
let send_gst_msg_rx = gst::BusStream::new(&bus);
let send_gst_msg_rx = bus.stream();
// Channel for outgoing WebSocket messages from other threads
let (send_ws_msg_tx, send_ws_msg_rx) = mpsc::unbounded::<WsMessage>();
@ -338,7 +338,7 @@ impl App {
let audio_queue = peer_bin
.get_by_name("audio-queue")
.expect("can't find audio-queue");
let audio_sink_pad = gst::GhostPad::new(
let audio_sink_pad = gst::GhostPad::with_target(
Some("audio_sink"),
&audio_queue.get_static_pad("sink").unwrap(),
)
@ -348,7 +348,7 @@ impl App {
let video_queue = peer_bin
.get_by_name("video-queue")
.expect("can't find video-queue");
let video_sink_pad = gst::GhostPad::new(
let video_sink_pad = gst::GhostPad::with_target(
Some("video_sink"),
&video_queue.get_static_pad("sink").unwrap(),
)
@ -629,7 +629,7 @@ impl Peer {
println!("starting negotiation with peer {}", self.peer_id);
let peer_clone = self.downgrade();
let promise = gst::Promise::new_with_change_func(move |reply| {
let promise = gst::Promise::with_change_func(move |reply| {
let peer = upgrade_weak!(peer_clone);
if let Err(err) = peer.on_offer_created(reply) {
@ -652,12 +652,15 @@ impl Peer {
// WebSocket connection
fn on_offer_created(
&self,
reply: Result<&gst::StructureRef, gst::PromiseError>,
reply: Result<Option<&gst::StructureRef>, gst::PromiseError>,
) -> Result<(), anyhow::Error> {
let reply = match reply {
Ok(reply) => reply,
Ok(Some(reply)) => reply,
Ok(None) => {
bail!("Offer creation future got no reponse");
}
Err(err) => {
bail!("Offer creation future got no reponse: {:?}", err);
bail!("Offer creation future got error reponse: {:?}", err);
}
};
@ -698,12 +701,15 @@ impl Peer {
// WebSocket connection
fn on_answer_created(
&self,
reply: Result<&gst::StructureRef, gst::PromiseError>,
reply: Result<Option<&gst::StructureRef>, gst::PromiseError>,
) -> Result<(), anyhow::Error> {
let reply = match reply {
Ok(reply) => reply,
Ok(Some(reply)) => reply,
Ok(None) => {
bail!("Answer creation future got no reponse");
}
Err(err) => {
bail!("Answer creation future got no reponse: {:?}", err);
bail!("Answer creation future got error reponse: {:?}", err);
}
};
@ -778,7 +784,7 @@ impl Peer {
.unwrap();
let peer_clone = peer.downgrade();
let promise = gst::Promise::new_with_change_func(move |reply| {
let promise = gst::Promise::with_change_func(move |reply| {
let peer = upgrade_weak!(peer_clone);
if let Err(err) = peer.on_answer_created(reply) {
@ -869,12 +875,14 @@ impl Peer {
// Add a ghost pad on our conv bin that proxies the sink pad of the decodebin
let dbin = conv.get_by_name("dbin").unwrap();
let sinkpad =
gst::GhostPad::new(Some("sink"), &dbin.get_static_pad("sink").unwrap()).unwrap();
gst::GhostPad::with_target(Some("sink"), &dbin.get_static_pad("sink").unwrap())
.unwrap();
conv.add_pad(&sinkpad).unwrap();
// And another one that proxies the source pad of the last element
let src = conv.get_by_name("src").unwrap();
let srcpad = gst::GhostPad::new(Some("src"), &src.get_static_pad("src").unwrap()).unwrap();
let srcpad =
gst::GhostPad::with_target(Some("src"), &src.get_static_pad("src").unwrap()).unwrap();
conv.add_pad(&srcpad).unwrap();
self.bin.add(&conv).unwrap();
@ -886,11 +894,11 @@ impl Peer {
// And then add a new ghost pad to the peer bin that proxies the source pad we added above
if media_type == "video" {
let srcpad = gst::GhostPad::new(Some("video_src"), &srcpad).unwrap();
let srcpad = gst::GhostPad::with_target(Some("video_src"), &srcpad).unwrap();
srcpad.set_active(true).unwrap();
self.bin.add_pad(&srcpad).unwrap();
} else if media_type == "audio" {
let srcpad = gst::GhostPad::new(Some("audio_src"), &srcpad).unwrap();
let srcpad = gst::GhostPad::with_target(Some("audio_src"), &srcpad).unwrap();
srcpad.set_active(true).unwrap();
self.bin.add_pad(&srcpad).unwrap();
}

File diff suppressed because it is too large Load diff

View file

@ -10,10 +10,10 @@ async-std = "1"
structopt = { version = "0.3", default-features = false }
anyhow = "1"
rand = "0.7"
async-tungstenite = { version = "0.5", features = ["async-std-runtime", "async-native-tls"] }
gst = { package = "gstreamer", version = "0.15", features = ["v1_14"] }
gst-webrtc = { package = "gstreamer-webrtc", version = "0.15" }
gst-sdp = { package = "gstreamer-sdp", version = "0.15", features = ["v1_14"] }
async-tungstenite = { version = "0.8", features = ["async-std-runtime", "async-native-tls"] }
gst = { package = "gstreamer", version = "0.16", features = ["v1_14"] }
gst-webrtc = { package = "gstreamer-webrtc", version = "0.16" }
gst-sdp = { package = "gstreamer-sdp", version = "0.16", features = ["v1_14"] }
serde = "1"
serde_derive = "1"
serde_json = "1"

View file

@ -137,7 +137,7 @@ impl App {
// Create a stream for handling the GStreamer message asynchronously
let bus = pipeline.get_bus().unwrap();
let send_gst_msg_rx = gst::BusStream::new(&bus);
let send_gst_msg_rx = bus.stream();
// Channel for outgoing WebSocket messages from other threads
let (send_ws_msg_tx, send_ws_msg_rx) = mpsc::unbounded::<WsMessage>();
@ -277,7 +277,7 @@ impl App {
println!("starting negotiation");
let app_clone = self.downgrade();
let promise = gst::Promise::new_with_change_func(move |reply| {
let promise = gst::Promise::with_change_func(move |reply| {
let app = upgrade_weak!(app_clone);
if let Err(err) = app.on_offer_created(reply) {
@ -300,12 +300,15 @@ impl App {
// WebSocket connection
fn on_offer_created(
&self,
reply: Result<&gst::StructureRef, gst::PromiseError>,
reply: Result<Option<&gst::StructureRef>, gst::PromiseError>,
) -> Result<(), anyhow::Error> {
let reply = match reply {
Ok(reply) => reply,
Ok(Some(reply)) => reply,
Ok(None) => {
bail!("Offer creation future got no reponse");
}
Err(err) => {
bail!("Offer creation future got no reponse: {:?}", err);
bail!("Offer creation future got error reponse: {:?}", err);
}
};
@ -343,12 +346,15 @@ impl App {
// WebSocket connection
fn on_answer_created(
&self,
reply: Result<&gst::StructureRef, gst::PromiseError>,
reply: Result<Option<&gst::StructureRef>, gst::PromiseError>,
) -> Result<(), anyhow::Error> {
let reply = match reply {
Ok(reply) => reply,
Ok(Some(reply)) => reply,
Ok(None) => {
bail!("Answer creation future got no reponse");
}
Err(err) => {
bail!("Answer creation future got no reponse: {:?}", err);
bail!("Answer creation future got error reponse: {:?}", err);
}
};
@ -420,7 +426,7 @@ impl App {
.unwrap();
let app_clone = app.downgrade();
let promise = gst::Promise::new_with_change_func(move |reply| {
let promise = gst::Promise::with_change_func(move |reply| {
let app = upgrade_weak!(app_clone);
if let Err(err) = app.on_answer_created(reply) {