rust-sdks icon indicating copy to clipboard operation
rust-sdks copied to clipboard

Publish tracks with different codecs not working

Open thepacketloss opened this issue 1 year ago • 3 comments

when I publish 3 tracks with different codecs all three tracks will publish with the codec of first published track. I mean consider I want to publish 3 tracks like these : Track 1 with AV1 Track 2 with VP9 Track 3 with VP8 all 3 tracks will be published with AV1 codec and if I change the order of publish like this : Track 1 with VP8 Track 2 with VP9 Track 3 with AV1 then all 3 tracks will be published with VP8 codec.

thepacketloss avatar Jan 08 '25 12:01 thepacketloss

can you share a snippet that could repro the issue? we'll take a look

davidzhao avatar Mar 01 '25 08:03 davidzhao

` tokio::spawn(async move { let rtc_track = video_track.rtc_track(); let mut video_stream = NativeVideoStream::new(rtc_track);

let source = NativeVideoSource::new(VideoResolution {
    width: publication.dimension().0,
    height: publication.dimension().1,
});

let video_source = RtcVideoSource::Native(source.clone());
let identity = participant.identity().0;
let name = participant.name();
let name = name.as_str();
let av1_track =
    LocalVideoTrack::create_video_track(name, video_source.clone());
let vp9_track =
    LocalVideoTrack::create_video_track(name, video_source.clone());
let vp8_track =
    LocalVideoTrack::create_video_track(name, video_source);

let av1_pub = match room
    .local_participant()
    .publish_track(
        LocalTrack::Video(av1_track),
        TrackPublishOptions {
            simulcast: true,
            source: publication.source(),
            stream: identity.clone(),
            video_codec: VideoCodec::AV1,
            video_encoding: Some(VideoEncoding {
                max_bitrate: bitrate as u64,
                max_framerate: framerate as f64,
            }),
            dtx: false,
            red: false,
            audio_encoding: None,
        },
    )
    .await
{
    Ok(t) => t,
    Err(err) => {
        return;
    }
};

let vp9_pub = match room
    .local_participant()
    .publish_track(
        LocalTrack::Video(vp9_track),
        TrackPublishOptions {
            simulcast: true,
            source: publication.source(),
            stream: identity.clone(),
            video_codec: VideoCodec::VP9,
            video_encoding: Some(VideoEncoding {
                max_bitrate: bitrate as u64,
                max_framerate: framerate as f64,
            }),
            dtx: false,
            red: false,
            audio_encoding: None,
        },
    )
    .await
{
    Ok(t) => t,
    Err(err) => {
        return;
    }
};

let vp8_pub = match room
    .local_participant()
    .publish_track(
        LocalTrack::Video(vp8_track),
        TrackPublishOptions {
            simulcast: true,
            source: publication.source(),
            stream: identity.clone(),
            video_codec: VideoCodec::VP8,
            video_encoding: Some(VideoEncoding {
                max_bitrate: bitrate as u64,
                max_framerate: framerate as f64,
            }),
            dtx: false,
            red: false,
            audio_encoding: None,
        },
    )
    .await
{
    Ok(t) => t,
    Err(err) => {
        return;
    }
};

while let Some(frame) = video_stream.next().await {
    source.capture_frame(&frame);
}

});

`

thepacketloss avatar Mar 01 '25 09:03 thepacketloss

@davidzhao This problem happens EXACTLY after version 0.7.0 I mean I tested all rust sdk versions from latest down to 0.7.0 and saw that this version does not have this problem. also now the python sdk (including new rust sdk version) have this problem too. for now I'm using the 0.7.0 version. Thanks.

thepacketloss avatar Mar 01 '25 09:03 thepacketloss