AI: AAC: Fix mono audio reported as stereo in HTTP API. v7.0.112 (#3556)

This commit is contained in:
OSSRS-AI 2025-10-29 22:21:55 -04:00 committed by winlin
parent 8438c8a799
commit 91a051b45d
4 changed files with 16 additions and 3 deletions

View File

@ -7,6 +7,7 @@ The changelog for SRS.
<a name="v7-changes"></a>
## SRS 7.0 Changelog
* v7.0, 2025-10-29, AI: AAC: Fix mono audio reported as stereo in HTTP API. v7.0.112 (#3556)
* v7.0, 2025-10-27, HLS/DASH: Fix dispose to skip unpublish when not enabled, and add forbidden directory protection to SrsPath::unlink. v7.0.111
* v7.0, 2025-10-27, AI: HTTP-FLV: Enforce minimum 10ms sleep to prevent CPU busy-wait when mw_latency=0. v7.0.110 (#3963)
* v7.0, 2025-10-26, AI: Edge: Fix stream names with dots being incorrectly truncated in source URL generation. v7.0.109 (#4011)

View File

@ -24,7 +24,9 @@ function SrsRtcWhipWhepAsync() {
self.constraints = {
audio: true,
video: {
width: {ideal: 320, max: 576}
width: {ideal: 320, max: 720},
//width: {ideal: 720, max: 1080},
//width: 1280, height: 720, frameRate: 30,
}
};

View File

@ -1008,7 +1008,17 @@ srs_error_t SrsOriginHub::on_audio(SrsMediaPacket *shared_audio)
sample_rate = srs_audio_sample_rate_from_number(srs_aac_srates[c->aac_sample_rate_]);
}
if ((err = stat_->on_audio_info(req_, format->acodec_->id_, sample_rate, c->sound_type_, c->aac_object_)) != srs_success) {
// For AAC, use aac_channels_ from AudioSpecificConfig instead of sound_type_ from FLV tag.
// The FLV sound_type field is often incorrect for AAC streams (e.g., FFmpeg sets it to stereo
// even for mono streams). The AAC AudioSpecificConfig channelConfiguration is the authoritative
// source: 1=mono, 2=stereo. Map to SrsAudioChannels: 0=mono, 1=stereo.
// For MP3 and other codecs, use sound_type_ from FLV tag.
SrsAudioChannels channels = c->sound_type_;
if (format->acodec_->id_ == SrsAudioCodecIdAAC) {
channels = (c->aac_channels_ == 1) ? SrsAudioChannelsMono : SrsAudioChannelsStereo;
}
if ((err = stat_->on_audio_info(req_, format->acodec_->id_, sample_rate, channels, c->aac_object_)) != srs_success) {
return srs_error_wrap(err, "stat audio");
}

View File

@ -9,6 +9,6 @@
#define VERSION_MAJOR 7
#define VERSION_MINOR 0
#define VERSION_REVISION 111
#define VERSION_REVISION 112
#endif