Skip to content

basic: first RTP packets are lost in the BufferedReader #37

Closed

Description

@compot-dev

rtsp_connect() reads the RTSP responses through new BufferedReader(new InputStreamReader(s.getInputStream())), then passes the raw s.getInputStream() to tcp_stream(). Any bytes the reader has already buffered (up to 8 KiB, decoded as characters) are lost. These are usually the first interleaved RTP packets: SPS, PPS and the first IDR. The picture then starts only at the next key frame, and the stream has to resync on $.

The DESCRIBE response body (SDP) is also never read with Content-Length. Its lines are consumed by the loop that waits for the SETUP response, which only works by accident.

Fix: read the responses byte by byte from one InputStream, honour Content-Length, and pass the same stream to tcp_stream(). This is what RtspClient.readLine() / readRtspResponse() on v2 do.

Activity

  1. added
    bugSomething isn't working
    basicLegacy basic branch
    on Oct 12, 2026
  2. compot-dev commented on Oct 12, 2026

    @compot-dev
    CollaboratorAuthor

    Fixed in #41 (merged into basic as 6cf68b5). Not closed automatically because basic is not the default branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    basicLegacy basic branchbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions