mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 12:37:09 +08:00
优化获取丢包率相关代码
This commit is contained in:
parent
974428d1e7
commit
926e78272c
@ -342,12 +342,12 @@ Value makeMediaSourceJson(MediaSource &media){
|
|||||||
obj["codec_id_name"] = track->getCodecName();
|
obj["codec_id_name"] = track->getCodecName();
|
||||||
obj["ready"] = track->ready();
|
obj["ready"] = track->ready();
|
||||||
obj["codec_type"] = codec_type;
|
obj["codec_type"] = codec_type;
|
||||||
|
if (current_thread) {
|
||||||
|
obj["loss"] = media.getLossRate(codec_type);
|
||||||
|
}
|
||||||
switch(codec_type){
|
switch(codec_type){
|
||||||
case TrackAudio : {
|
case TrackAudio : {
|
||||||
auto audio_track = dynamic_pointer_cast<AudioTrack>(track);
|
auto audio_track = dynamic_pointer_cast<AudioTrack>(track);
|
||||||
if (current_thread) {
|
|
||||||
obj["loss"] = media.getLossRate(TrackAudio);
|
|
||||||
}
|
|
||||||
obj["sample_rate"] = audio_track->getAudioSampleRate();
|
obj["sample_rate"] = audio_track->getAudioSampleRate();
|
||||||
obj["channels"] = audio_track->getAudioChannel();
|
obj["channels"] = audio_track->getAudioChannel();
|
||||||
obj["sample_bit"] = audio_track->getAudioSampleBit();
|
obj["sample_bit"] = audio_track->getAudioSampleBit();
|
||||||
@ -355,9 +355,6 @@ Value makeMediaSourceJson(MediaSource &media){
|
|||||||
}
|
}
|
||||||
case TrackVideo : {
|
case TrackVideo : {
|
||||||
auto video_track = dynamic_pointer_cast<VideoTrack>(track);
|
auto video_track = dynamic_pointer_cast<VideoTrack>(track);
|
||||||
if (current_thread) {
|
|
||||||
obj["loss"] = media.getLossRate(TrackVideo);
|
|
||||||
}
|
|
||||||
obj["width"] = video_track->getVideoWidth();
|
obj["width"] = video_track->getVideoWidth();
|
||||||
obj["height"] = video_track->getVideoHeight();
|
obj["height"] = video_track->getVideoHeight();
|
||||||
obj["fps"] = round(video_track->getVideoFps());
|
obj["fps"] = round(video_track->getVideoFps());
|
||||||
|
Loading…
Reference in New Issue
Block a user