Skip to content

Codec PT available despite negotiation failure #861

@algesten

Description

@algesten

I have another issue here, related to this one:

This is my code used to send the data:

    fn handle_media_data_out(&mut self, data: MediaPacket) {
        // ...
        let codec_id: Option<Pt> = if data.codec == MediaCodec::H265 {
                self.rtc
                    .codec_config()
                    .find(|p| p.spec().codec == Codec::H265)
                    .map(|p| p.pt())
            } else {
                self.rtc
                    .codec_config()
                    .find(|p| {
                        p.spec().codec == Codec::H264
                            && p.spec().format.packetization_mode == Some(1)
                            && p.spec().format.profile_level_id == Some(0x42e01f)
                    })
                    .map(|p| p.pt())
            };

        let Some(writer) = self.rtc.writer(mid) else {
            debug!("No writer for mid: {:?}", mid);
            return;
        };

        let Some(codec_id) = codec_id else {
            warn!("Unsupported codec for media data");
            return;
        };

        trace!(
            "Client ({}) sending media data: codec_id={}, timestamp={:?}, media_time={:?}, size={}",
            *self.id,
            codec_id,
            data.timestamp,
            media_time,
            data.data.len()
        );

        if let Err(e) = writer.write(codec_id, data.timestamp, media_time, data.data) {
            warn!("Client ({}) failed: {:?}", *self.id, e);
            self.rtc.disconnect();
        }
    }

Even with H265 failed to match (I've checked str0m's SDP ANSWER, it does not contain an H265 entry), I can still get the codec_id by the .find(|p| p.spec().codec == Codec::H265) lookup (I believe it should to be None if matching failed), and it is Pt(102) which is the default H265 PT in str0m.

Originally posted by @showier-drastic in #860

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions