BlueGit

ict rusty-teams

Files

rusty-teams / vendor / libwebrtc / src / video_track.rs

video_track.rs

video_track.rs 1.9 KiB Download Raw
1// Copyright 2025 LiveKit, Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use std::fmt::Debug;
16
17use crate::{
18 imp::video_track as imp_vt,
19 media_stream_track::{media_stream_track, RtcTrackState},
20};
21
22#[cfg(not(target_arch = "wasm32"))]
23use crate::native::packet_trailer::PacketTrailerHandler;
24
25#[derive(Clone)]
26pub struct RtcVideoTrack {
27 pub(crate) handle: imp_vt::RtcVideoTrack,
28}
29
30impl RtcVideoTrack {
31 media_stream_track!();
32
33 /// Set the packet trailer handler for this track.
34 ///
35 /// When set, any `NativeVideoStream` created from this track will
36 /// automatically use this handler to populate `user_timestamp`
37 /// on each decoded frame.
38 #[cfg(not(target_arch = "wasm32"))]
39 pub fn set_packet_trailer_handler(&self, handler: PacketTrailerHandler) {
40 self.handle.set_packet_trailer_handler(handler);
41 }
42
43 /// Get the packet trailer handler, if one has been set.
44 #[cfg(not(target_arch = "wasm32"))]
45 pub fn packet_trailer_handler(&self) -> Option<PacketTrailerHandler> {
46 self.handle.packet_trailer_handler()
47 }
48}
49
50impl Debug for RtcVideoTrack {
51 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
52 f.debug_struct("RtcVideoTrack")
53 .field("id", &self.id())
54 .field("enabled", &self.enabled())
55 .field("state", &self.state())
56 .finish()
57 }
58}