Skip to content

Bugfix: Avoid repeat transcoding when the transcode is the same and source ip is localhost#3618

Closed
feixintianxia wants to merge 1 commit intoossrs:developfrom
feixintianxia:bugfix/bug-avoid-loop-transcoding
Closed

Bugfix: Avoid repeat transcoding when the transcode is the same and source ip is localhost#3618
feixintianxia wants to merge 1 commit intoossrs:developfrom
feixintianxia:bugfix/bug-avoid-loop-transcoding

Conversation

@feixintianxia
Copy link
Copy Markdown
Contributor

@feixintianxia feixintianxia commented Jul 6, 2023

When transcoding, if the output is set as "rtmp://127.0.0.1:[port]/[app]/[stream]_[engine]?vhost=[vhost]",
the source ip is "127.0.0.1", then it will cause repeated transcoding on the same server and the program crash.

For example:

-rw-rw-r-- 1 li li 9.6K  Jul  6 12:54 ffmpeg-encoder-__defaultVhost__-live-livestream.log
-rw-rw-r-- 1 li li 9.4K  Jul  6 12:54 ffmpeg-encoder-__defaultVhost__-live-livestream_.log
-rw-rw-r-- 1 li li 8.8K  Jul  6 12:54 ffmpeg-encoder-__defaultVhost__-live-livestream__.log
-rw-rw-r-- 1 li li 8.5K  Jul  6 12:54 ffmpeg-encoder-__defaultVhost__-live-livestream___.log
-rw-rw-r-- 1 li li 8.3K  Jul  6 12:54 ffmpeg-encoder-__defaultVhost__-live-livestream____.log
-rw-rw-r-- 1 li li 8.1K  Jul  6 12:54 ffmpeg-encoder-__defaultVhost__-live-livestream_____.log
-rw-rw-r-- 1 li li 7.5K  Jul  6 12:54 ffmpeg-encoder-__defaultVhost__-live-livestream______.log
-rw-rw-r-- 1 li li 7.4K  Jul  6 12:54 ffmpeg-encoder-__defaultVhost__-live-livestream_______.log
-rw-rw-r-- 1 li li 6.9K  Jul  6 12:54 ffmpeg-encoder-__defaultVhost__-live-livestream________.log
-rw-rw-r-- 1 li li 6.8K  Jul  6 12:54 ffmpeg-encoder-__defaultVhost__-live-livestream_________.log
-rw-rw-r-- 1 li li 3.3K  Jul  6 12:54 ffmpeg-encoder-__defaultVhost__-live-livestream__________.log


TRANS_BY_GPT3

@xiaozhihong xiaozhihong added Bug It might be a bug. and removed Bug It might be a bug. labels Jul 17, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 29, 2023
@winlinvip winlinvip force-pushed the develop branch 2 times, most recently from 0bb9637 to 2e211f6 Compare August 12, 2024 10:42
@duiniuluantanqin
Copy link
Copy Markdown
Member

see #4325

@winlinvip
Copy link
Copy Markdown
Member

Dup to #4325

@winlinvip winlinvip closed this Jun 4, 2025
winlinvip added a commit that referenced this pull request Jun 4, 2025
….0.41 (#4325)

#### What issue has been resolved?
for issue: #3516
#4055
#3618

#### What is the root cause of the problem?
The issue arises from a mismatch between the `input` and `output`
formats within the
[`SrsEncoder::initialize_ffmpeg`](https://github.com/ossrs/srs/pull/4325/files#diff-a3dd7c498fc26d36def2e8c2c3b7edfe1bf78f0620b1a838aefa70ba119cad03L241-L254)
function.

For example:
Input: `rtmp://127.0.0.1:1935/live?vhost=__defaultVhost__/livestream_ff`
Output:
`rtmp://127.0.0.1:1935/live/livestream_ff?vhost=__defaultVhost__`

This may result in the failure of the [code
segment](https://github.com/ossrs/srs/pull/4325/files#diff-a3dd7c498fc26d36def2e8c2c3b7edfe1bf78f0620b1a838aefa70ba119cad03L292-L298)
responsible for determining whether to loop.

#### What is the approach to solving this issue?
It simply involves modifying the order of `stream` and `vhost`.

#### How was the issue introduced?
The commit introducing this bug is:
7d47017
The order of [parameters in the configuration
file](7d47017#diff-428de168925d659dae72bb49273c3b048ed2800906c6848560badae854250126L26-R26)
has been modified to address the `ingest` issue.

#### Outstanding issues
Please note that this PR does not entirely resolve the issue; for
example, modifying the `output` format in configuration still results in
exceptions. To comprehensively address this problem, extensive code
modifications would be required.

However, strictly adhering to the configuration file format can
effectively prevent this issue.

---------

Co-authored-by: Jacob Su <suzp1984@gmail.com>
Co-authored-by: john <hondaxiao@tencent.com>
Co-authored-by: winlin <winlinvip@gmail.com>
winlinvip added a commit that referenced this pull request Jun 4, 2025
…4325)

for issue: #3516
#4055
#3618

The issue arises from a mismatch between the `input` and `output`
formats within the
[`SrsEncoder::initialize_ffmpeg`](https://github.com/ossrs/srs/pull/4325/files#diff-a3dd7c498fc26d36def2e8c2c3b7edfe1bf78f0620b1a838aefa70ba119cad03L241-L254)
function.

For example:
Input: `rtmp://127.0.0.1:1935/live?vhost=__defaultVhost__/livestream_ff`
Output:
`rtmp://127.0.0.1:1935/live/livestream_ff?vhost=__defaultVhost__`

This may result in the failure of the [code
segment](https://github.com/ossrs/srs/pull/4325/files#diff-a3dd7c498fc26d36def2e8c2c3b7edfe1bf78f0620b1a838aefa70ba119cad03L292-L298)
responsible for determining whether to loop.

It simply involves modifying the order of `stream` and `vhost`.

The commit introducing this bug is:
7d47017
The order of [parameters in the configuration
file](7d47017#diff-428de168925d659dae72bb49273c3b048ed2800906c6848560badae854250126L26-R26)
has been modified to address the `ingest` issue.

Please note that this PR does not entirely resolve the issue; for
example, modifying the `output` format in configuration still results in
exceptions. To comprehensively address this problem, extensive code
modifications would be required.

However, strictly adhering to the configuration file format can
effectively prevent this issue.

---------

Co-authored-by: Jacob Su <suzp1984@gmail.com>
Co-authored-by: john <hondaxiao@tencent.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

TransByAI Translated by AI/GPT.

Development

Successfully merging this pull request may close these issues.

4 participants