mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-07-03 08:57:32 +08:00
优化代码
除1024改成右移10位
This commit is contained in:
@@ -284,9 +284,9 @@ static bool makeFolderMenu(const string &httpPath, const string &strFullPath, st
|
||||
} else if (fileSize < 1024 * 1024) {
|
||||
ss << fixed << setprecision(2) << " (" << fileSize / 1024.0 << "KB)";
|
||||
} else if (fileSize < 1024 * 1024 * 1024) {
|
||||
ss << fixed << setprecision(2) << " (" << fileSize / 1024 / 1024.0 << "MB)";
|
||||
ss << fixed << setprecision(2) << " (" << (fileSize >> 10) / 1024.0 << "MB)";
|
||||
} else {
|
||||
ss << fixed << setprecision(2) << " (" << fileSize / 1024 / 1024 / 1024.0 << "GB)";
|
||||
ss << fixed << setprecision(2) << " (" << (fileSize >> 20) / 1024.0 << "GB)";
|
||||
}
|
||||
ss << "</a></li>\r\n";
|
||||
}
|
||||
|
||||
@@ -34,14 +34,14 @@ VideoMeta::VideoMeta(const VideoTrack::Ptr &video) {
|
||||
_metadata.set("framerate", video->getVideoFps());
|
||||
}
|
||||
if (video->getBitRate()) {
|
||||
_metadata.set("videodatarate", video->getBitRate() / 1024);
|
||||
_metadata.set("videodatarate", video->getBitRate() >> 10);
|
||||
}
|
||||
_metadata.set("videocodecid", Factory::getAmfByCodecId(video->getCodecId()));
|
||||
}
|
||||
|
||||
AudioMeta::AudioMeta(const AudioTrack::Ptr &audio) {
|
||||
if (audio->getBitRate()) {
|
||||
_metadata.set("audiodatarate", audio->getBitRate() / 1024);
|
||||
_metadata.set("audiodatarate", audio->getBitRate() >> 10);
|
||||
}
|
||||
if (audio->getAudioSampleRate() > 0) {
|
||||
_metadata.set("audiosamplerate", audio->getAudioSampleRate());
|
||||
|
||||
Reference in New Issue
Block a user