Skip to content

Fix error about TestRtcPublish_HttpFlvPlay. v7.0.36#4363

Merged
winlinvip merged 5 commits intoossrs:developfrom
duiniuluantanqin:feature/TestRtcPublish_HttpFlvPlay
May 29, 2025
Merged

Fix error about TestRtcPublish_HttpFlvPlay. v7.0.36#4363
winlinvip merged 5 commits intoossrs:developfrom
duiniuluantanqin:feature/TestRtcPublish_HttpFlvPlay

Conversation

@duiniuluantanqin
Copy link
Copy Markdown
Member

@duiniuluantanqin duiniuluantanqin commented May 29, 2025

In the scenario of converting WebRTC to RTMP, this conversion will not proceed until an SenderReport is received; for reference, see: #2470.
Thus, if HTTP-FLV streaming is attempted before the SR is received, the FLV Header will contain only audio, devoid of video content.
This error can be resolved by disabling guess_has_av in the configuration file, since we can guarantee that both audio and video are present in the test cases.

However, in the original regression tests, the TestRtcPublish_HttpFlvPlay test case contains a bug:

if audioPacketsOK, videoPacketsOK := !hasAudio || nnAudio >= 10, !hasVideo || nnVideo >= 10; audioPacketsOK && videoPacketsOK {
logger.Tf(ctx, "Flv recv %v/%v audio, %v/%v video", hasAudio, nnAudio, hasVideo, nnVideo)
cancel()
}

The test would pass when hasAudio is true and hasVideo is false, which is actually incorrect. Therefore, it has been revised so that the test now only passes if both values are true.

@winlinvip winlinvip added the EnglishNative This issue is conveyed exclusively in English. label May 29, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an error in the TestRtcPublish_HttpFlvPlay test case by ensuring that both audio and video packets are required in the FLV stream. Key changes include:

  • Disabling the guess_has_av option in the regression-test configuration file.
  • Updating the test condition to fail unless both audio and video are present and meet the minimum packet count.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
trunk/conf/regression-test.conf Disables guess_has_av to better reflect expected streams.
trunk/3rdparty/srs-bench/srs/rtc_test.go Revises test logic to ensure both audio and video packets are required.
Comments suppressed due to low confidence (1)

trunk/3rdparty/srs-bench/srs/rtc_test.go:2421

  • The updated condition now strictly requires both audio and video packet counts to be met; please verify that this change fully aligns with the intended behavior of the test case.
if audioPacketsOK, videoPacketsOK := hasAudio && nnAudio >= 10, hasVideo && nnVideo >= 10; audioPacketsOK && videoPacketsOK {

@winlinvip winlinvip changed the title Fix error about TestRtcPublish_HttpFlvPlay Fix error about TestRtcPublish_HttpFlvPlay. v7.0.36 May 29, 2025
@winlinvip winlinvip added the RefinedByAI Refined by AI/GPT. label May 29, 2025
@winlinvip winlinvip merged commit a397250 into ossrs:develop May 29, 2025
17 checks passed
winlinvip added a commit that referenced this pull request May 29, 2025
In the scenario of converting WebRTC to RTMP, this conversion will not
proceed until an SenderReport is received; for reference, see:
#2470.
Thus, if HTTP-FLV streaming is attempted before the SR is received, the
FLV Header will contain only audio, devoid of video content.
This error can be resolved by disabling `guess_has_av` in the
configuration file, since we can guarantee that both audio and video are
present in the test cases.

However, in the original regression tests, the
`TestRtcPublish_HttpFlvPlay` test case contains a bug:

https://github.com/ossrs/srs/blob/5a404c089baa93b906d2452ef47e2ba8a9e6211c/trunk/3rdparty/srs-bench/srs/rtc_test.go#L2421-L2424

The test would pass when `hasAudio` is true and `hasVideo` is false,
which is actually incorrect. Therefore, it has been revised so that the
test now only passes if both values are true.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: winlin <winlinvip@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

EnglishNative This issue is conveyed exclusively in English. RefinedByAI Refined by AI/GPT.

Development

Successfully merging this pull request may close these issues.

3 participants