mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Merge 1ff0344f34
into 13597d1b7f
This commit is contained in:
commit
f2869fe0b4
3 changed files with 16 additions and 12 deletions
|
@ -956,15 +956,19 @@ srs_error_t SrsOriginHub::on_audio(SrsSharedPtrMessage* shared_audio)
|
||||||
|
|
||||||
// when got audio stream info.
|
// when got audio stream info.
|
||||||
SrsStatistic* stat = SrsStatistic::instance();
|
SrsStatistic* stat = SrsStatistic::instance();
|
||||||
if ((err = stat->on_audio_info(req_, format->acodec->id, c->sound_rate, c->sound_type, c->aac_object)) != srs_success) {
|
|
||||||
return srs_error_wrap(err, "stat audio");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (format->acodec->id == SrsAudioCodecIdMP3) {
|
if (format->acodec->id == SrsAudioCodecIdMP3) {
|
||||||
|
if ((err = stat->on_audio_info(req_, format->acodec->id, srs_flv_srates[c->sound_rate], flv_sound_types[c->sound_type], c->aac_object)) != srs_success) {
|
||||||
|
return srs_error_wrap(err, "stat audio");
|
||||||
|
}
|
||||||
srs_trace("%dB audio sh, codec(%d, %dbits, %dchannels, %dHZ)",
|
srs_trace("%dB audio sh, codec(%d, %dbits, %dchannels, %dHZ)",
|
||||||
msg->size, c->id, flv_sample_sizes[c->sound_size], flv_sound_types[c->sound_type],
|
msg->size, c->id, flv_sample_sizes[c->sound_size], flv_sound_types[c->sound_type],
|
||||||
srs_flv_srates[c->sound_rate]);
|
srs_flv_srates[c->sound_rate]);
|
||||||
} else {
|
} else {
|
||||||
|
if ((err = stat->on_audio_info(req_, format->acodec->id, srs_aac_srates[c->aac_sample_rate], c->aac_channels, c->aac_object)) != srs_success) {
|
||||||
|
return srs_error_wrap(err, "stat audio");
|
||||||
|
}
|
||||||
srs_trace("%dB audio sh, codec(%d, profile=%s, %dchannels, %dkbps, %dHZ), flv(%dbits, %dchannels, %dHZ)",
|
srs_trace("%dB audio sh, codec(%d, profile=%s, %dchannels, %dkbps, %dHZ), flv(%dbits, %dchannels, %dHZ)",
|
||||||
msg->size, c->id, srs_aac_object2str(c->aac_object).c_str(), c->aac_channels,
|
msg->size, c->id, srs_aac_object2str(c->aac_object).c_str(), c->aac_channels,
|
||||||
c->audio_data_rate / 1000, srs_aac_srates[c->aac_sample_rate],
|
c->audio_data_rate / 1000, srs_aac_srates[c->aac_sample_rate],
|
||||||
|
|
|
@ -88,8 +88,8 @@ SrsStatisticStream::SrsStatisticStream()
|
||||||
|
|
||||||
has_audio = false;
|
has_audio = false;
|
||||||
acodec = SrsAudioCodecIdReserved1;
|
acodec = SrsAudioCodecIdReserved1;
|
||||||
asample_rate = SrsAudioSampleRateReserved;
|
asample_rate = 0;
|
||||||
asound_type = SrsAudioChannelsReserved;
|
asound_type = 0;
|
||||||
aac_object = SrsAacObjectTypeReserved;
|
aac_object = SrsAacObjectTypeReserved;
|
||||||
width = 0;
|
width = 0;
|
||||||
height = 0;
|
height = 0;
|
||||||
|
@ -168,8 +168,8 @@ srs_error_t SrsStatisticStream::dumps(SrsJsonObject* obj)
|
||||||
obj->set("audio", audio);
|
obj->set("audio", audio);
|
||||||
|
|
||||||
audio->set("codec", SrsJsonAny::str(srs_audio_codec_id2str(acodec).c_str()));
|
audio->set("codec", SrsJsonAny::str(srs_audio_codec_id2str(acodec).c_str()));
|
||||||
audio->set("sample_rate", SrsJsonAny::integer(srs_flv_srates[asample_rate]));
|
audio->set("sample_rate", SrsJsonAny::integer(asample_rate));
|
||||||
audio->set("channel", SrsJsonAny::integer(asound_type + 1));
|
audio->set("channel", SrsJsonAny::integer(asound_type));
|
||||||
audio->set("profile", SrsJsonAny::str(srs_aac_object2str(aac_object).c_str()));
|
audio->set("profile", SrsJsonAny::str(srs_aac_object2str(aac_object).c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,7 +376,7 @@ srs_error_t SrsStatistic::on_video_info(SrsRequest* req, SrsVideoCodecId vcodec,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_error_t SrsStatistic::on_audio_info(SrsRequest* req, SrsAudioCodecId acodec, SrsAudioSampleRate asample_rate, SrsAudioChannels asound_type, SrsAacObjectType aac_object)
|
srs_error_t SrsStatistic::on_audio_info(SrsRequest* req, SrsAudioCodecId acodec, int asample_rate, int asound_type, SrsAacObjectType aac_object)
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
|
|
|
@ -82,8 +82,8 @@ public:
|
||||||
public:
|
public:
|
||||||
bool has_audio;
|
bool has_audio;
|
||||||
SrsAudioCodecId acodec;
|
SrsAudioCodecId acodec;
|
||||||
SrsAudioSampleRate asample_rate;
|
int asample_rate;
|
||||||
SrsAudioChannels asound_type;
|
int asound_type;
|
||||||
// The audio specified
|
// The audio specified
|
||||||
// audioObjectType, in 1.6.2.1 AudioSpecificConfig, page 33,
|
// audioObjectType, in 1.6.2.1 AudioSpecificConfig, page 33,
|
||||||
// 1.5.1.1 Audio object type definition, page 23,
|
// 1.5.1.1 Audio object type definition, page 23,
|
||||||
|
@ -169,8 +169,8 @@ public:
|
||||||
// When got video info for stream.
|
// When got video info for stream.
|
||||||
virtual srs_error_t on_video_info(SrsRequest* req, SrsVideoCodecId vcodec, int avc_profile, int avc_level, int width, int height);
|
virtual srs_error_t on_video_info(SrsRequest* req, SrsVideoCodecId vcodec, int avc_profile, int avc_level, int width, int height);
|
||||||
// When got audio info for stream.
|
// When got audio info for stream.
|
||||||
virtual srs_error_t on_audio_info(SrsRequest* req, SrsAudioCodecId acodec, SrsAudioSampleRate asample_rate,
|
virtual srs_error_t on_audio_info(SrsRequest* req, SrsAudioCodecId acodec, int asample_rate,
|
||||||
SrsAudioChannels asound_type, SrsAacObjectType aac_object);
|
int asound_type, SrsAacObjectType aac_object);
|
||||||
// When got videos, update the frames.
|
// When got videos, update the frames.
|
||||||
// We only stat the total number of video frames.
|
// We only stat the total number of video frames.
|
||||||
virtual srs_error_t on_video_frames(SrsRequest* req, int nb_frames);
|
virtual srs_error_t on_video_frames(SrsRequest* req, int nb_frames);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue