mirror of
https://gitee.com/openharmony/multimedia_av_codec
synced 2024-11-27 00:50:36 +00:00
commit
847198f168
@ -1088,6 +1088,11 @@ size_t DashMediaDownloader::GetBufferSize() const
|
||||
return segmentDownloader->GetBufferSize();
|
||||
}
|
||||
|
||||
bool DashMediaDownloader::GetPlayable()
|
||||
{
|
||||
return GetBufferSize() > 0;
|
||||
}
|
||||
|
||||
void DashMediaDownloader::SetAppUid(int32_t appUid)
|
||||
{
|
||||
for (size_t i = 0; i < segmentDownloaders_.size(); i++) {
|
||||
|
@ -67,6 +67,7 @@ public:
|
||||
void SetDemuxerState(int32_t streamId) override;
|
||||
void GetPlaybackInfo(PlaybackInfo& playbackInfo) override;
|
||||
size_t GetBufferSize() const override;
|
||||
bool GetPlayable() override;
|
||||
void SetAppUid(int32_t appUid) override;
|
||||
bool GetBufferingTimeOut() override;
|
||||
|
||||
|
@ -1501,8 +1501,10 @@ void HlsMediaDownloader::CalculateBitRate(size_t fragmentSize, double duration)
|
||||
if (fragmentSize == 0 || duration == 0) {
|
||||
return;
|
||||
}
|
||||
int32_t calculateBitRate = static_cast<int32_t>(static_cast<int32_t>(fragmentSize * BYTES_TO_BIT) / duration);
|
||||
|
||||
double divisorFragmentSize = (static_cast<double>(fragmentSize) / static_cast<double>(ONE_SECONDS))
|
||||
* static_cast<double>(BYTES_TO_BIT);
|
||||
double dividendDuration = static_cast<double>(duration) / static_cast<double>(ONE_SECONDS);
|
||||
int32_t calculateBitRate = static_cast<int32_t>(divisorFragmentSize / dividendDuration);
|
||||
currentBitRate_ = (calculateBitRate >> 1) + (currentBitRate_ >> 1) + ((calculateBitRate | currentBitRate_) & 1);
|
||||
MEDIA_LOG_I("HLS Calculate avgBitRate: " PUBLIC_LOG_D32, currentBitRate_);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user