fork/rust-sdks
git clone https://git.julia.blue/fork/rust-sdks
55bda13
main
1/* 2* Copyright 2023 LiveKit 3* 4* Licensed under the Apache License, Version 2.0 (the “License”); 5* you may not use this file except in compliance with the License. 6* You may obtain a copy of the License at 7* 8* http://www.apache.org/licenses/LICENSE-2.0 9* 10* Unless required by applicable law or agreed to in writing, software 11* distributed under the License is distributed on an “AS IS” BASIS, 12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13* See the License for the specific language governing permissions and 14* limitations under the License. 15*/ 16 17#include <algorithm> 18#include <iostream> 19#include <memory> 20 21#include "api/media_stream_interface.h" 22#include "api/video/video_frame.h" 23#include "api/video/video_rotation.h" 24#include "audio/remix_resample.h" 25#include "common_audio/include/audio_util.h" 26#include "livekit/media_stream.h" 27#include "rtc_base/logging.h" 28#include "rtc_base/ref_counted_object.h" 29#include "rtc_base/time_utils.h" 30 31namespace livekit { 32 33MediaStreamTrack ::MediaStreamTrack ( 34 std::shared_ptr < RtcRuntime > rtc_runtime , 35 rtc::scoped_refptr < webrtc::MediaStreamTrackInterface > track ) 36 :rtc_runtime_ (rtc_runtime ),track_ (std::move (track )) {} 37 38rust::String MediaStreamTrack ::kind ()const { 39return track_ -> kind (); 40} 41 42rust::String MediaStreamTrack ::id ()const { 43return track_ -> id (); 44} 45 46bool MediaStreamTrack ::enabled ()const { 47return track_ -> enabled (); 48} 49 50bool MediaStreamTrack ::set_enabled (bool enable )const { 51return track_ -> set_enabled (enable ); 52} 53 54TrackState MediaStreamTrack ::state ()const { 55return static_cast < TrackState > (track_ -> state ()); 56} 57 58}// namespace livekit