mirror of
https://gitee.com/openharmony/multimedia_av_codec
synced 2024-10-07 14:13:29 +00:00
commit
b68b81809e
@ -356,6 +356,8 @@ int32_t DashSegmentDownloader::GetWaterLineAbove()
|
||||
} else {
|
||||
waterLineAbove = static_cast<int32_t>(DEFAULT_MIN_CACHE_TIME * realTimeBitBate_ / BYTES_TO_BIT);
|
||||
}
|
||||
int32_t maxWaterLineAbove = static_cast<int32_t>(ringBufferCapcity_ / 2);
|
||||
waterLineAbove = waterLineAbove > maxWaterLineAbove ? maxWaterLineAbove : waterLineAbove;
|
||||
int32_t minWaterLineAbove = 2 * PLAY_WATER_LINE;
|
||||
waterLineAbove = waterLineAbove < minWaterLineAbove ? minWaterLineAbove : waterLineAbove;
|
||||
}
|
||||
@ -370,7 +372,7 @@ void DashSegmentDownloader::CalculateBitRate(size_t fragmentSize, double duratio
|
||||
return;
|
||||
}
|
||||
|
||||
realTimeBitBate_ = static_cast<int64_t>(fragmentSize * BYTES_TO_BIT) / duration;
|
||||
realTimeBitBate_ = static_cast<int64_t>(fragmentSize * BYTES_TO_BIT * SECOND_TO_MILLIONSECOND) / duration;
|
||||
MEDIA_LOG_I("CalculateBitRate streamId: " PUBLIC_LOG_D32 " realTimeBitBate: "
|
||||
PUBLIC_LOG_D64, streamId_, realTimeBitBate_);
|
||||
}
|
||||
@ -1015,12 +1017,6 @@ void DashSegmentDownloader::UpdateDownloadFinished(const std::string& url, const
|
||||
} else {
|
||||
downloadSpeed_ = 0;
|
||||
}
|
||||
if (downloadRequest_ != nullptr) {
|
||||
size_t fragmentSize = downloadRequest_->GetFileContentLength();
|
||||
double duration = downloadRequest_->GetDuration();
|
||||
CalculateBitRate(fragmentSize, duration);
|
||||
downloadBiteRate_ = downloadRequest_->GetBitRate();
|
||||
}
|
||||
|
||||
if (initSegment != nullptr && initSegment->writeState_ == INIT_SEGMENT_STATE_USING) {
|
||||
MEDIA_LOG_I("UpdateDownloadFinished:streamId:" PUBLIC_LOG_D32 ", writeState:"
|
||||
@ -1038,6 +1034,12 @@ void DashSegmentDownloader::UpdateDownloadFinished(const std::string& url, const
|
||||
if (mediaSegment_->contentLength_ == 0 && downloadRequest_ != nullptr) {
|
||||
mediaSegment_->contentLength_ = downloadRequest_->GetFileContentLength();
|
||||
}
|
||||
if (downloadRequest_ != nullptr) {
|
||||
size_t fragmentSize = mediaSegment_->contentLength_;
|
||||
double duration = downloadRequest_->GetDuration();
|
||||
CalculateBitRate(fragmentSize, duration);
|
||||
downloadBiteRate_ = downloadRequest_->GetBitRate();
|
||||
}
|
||||
mediaSegment_->isEos_ = true;
|
||||
if (mediaSegment_->isLast_) {
|
||||
MEDIA_LOG_I("AllSegmentFinish streamId: " PUBLIC_LOG_D32 " download complete", streamId_);
|
||||
|
@ -43,16 +43,6 @@ constexpr int64_t MS_2_NS = MS_2_US * US_2_NS;
|
||||
constexpr int64_t S_2_NS = S_2_MS * MS_2_NS;
|
||||
|
||||
constexpr int64_t MEDIA_PTS_UNSET = INT64_MIN + 1;
|
||||
|
||||
class TimeUtils {
|
||||
public:
|
||||
static int64_t GetBootTimeMs();
|
||||
static int64_t GetBootTimeUs();
|
||||
static int64_t GetMonotonicTimeMs();
|
||||
static int64_t GetMonotonicTimeUs();
|
||||
static int64_t GetCurrentTimeMs();
|
||||
};
|
||||
|
||||
} // namespace HttpPluginLite
|
||||
} // namespace Plugin
|
||||
} // namespace Media
|
||||
|
Loading…
Reference in New Issue
Block a user