Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use base::TimeDelta in DecoderBuffer::Allocator #2209

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions cobalt/media/decoder_buffer_allocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,10 @@ int DecoderBufferAllocator::GetBufferPadding() const {
#endif // SB_API_VERSION >= 14
}

int64_t DecoderBufferAllocator::GetBufferGarbageCollectionDurationThreshold()
const {
return SbMediaGetBufferGarbageCollectionDurationThreshold();
base::TimeDelta
DecoderBufferAllocator::GetBufferGarbageCollectionDurationThreshold() const {
return base::TimeDelta::FromMicroseconds(
SbMediaGetBufferGarbageCollectionDurationThreshold());
}

int DecoderBufferAllocator::GetProgressiveBufferBudget(
Expand Down
3 changes: 2 additions & 1 deletion cobalt/media/decoder_buffer_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <memory>

#include "base/compiler_specific.h"
#include "base/time/time.h"
#include "cobalt/media/bidirectional_fit_reuse_allocator.h"
#include "cobalt/media/decoder_buffer_memory_info.h"
#include "cobalt/media/starboard_memory_allocator.h"
Expand Down Expand Up @@ -46,7 +47,7 @@ class DecoderBufferAllocator : public ::media::DecoderBuffer::Allocator,
int GetAudioBufferBudget() const override;
int GetBufferAlignment() const override;
int GetBufferPadding() const override;
int64_t GetBufferGarbageCollectionDurationThreshold() const override;
base::TimeDelta GetBufferGarbageCollectionDurationThreshold() const override;
int GetProgressiveBufferBudget(SbMediaVideoCodec codec, int resolution_width,
int resolution_height,
int bits_per_pixel) const override;
Expand Down
2 changes: 1 addition & 1 deletion third_party/chromium/media/base/decoder_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class MEDIA_EXPORT DecoderBuffer
virtual int GetAudioBufferBudget() const = 0;
virtual int GetBufferAlignment() const = 0;
virtual int GetBufferPadding() const = 0;
virtual int64_t GetBufferGarbageCollectionDurationThreshold() const = 0;
virtual base::TimeDelta GetBufferGarbageCollectionDurationThreshold() const = 0;
virtual int GetProgressiveBufferBudget(SbMediaVideoCodec codec,
int resolution_width,
int resolution_height,
Expand Down
6 changes: 3 additions & 3 deletions third_party/chromium/media/filters/source_buffer_stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -848,11 +848,11 @@ bool SourceBufferStream::GarbageCollectIfNeeded(base::TimeDelta media_time,
#if defined(STARBOARD)
// Address duration based GC.
base::TimeDelta duration = GetBufferedDurationForGarbageCollection();
const int64_t duration_gc_threadold =
base::TimeDelta duration_gc_threadold =
DecoderBuffer::Allocator::GetInstance()
->GetBufferGarbageCollectionDurationThreshold();
if (duration.InMicroseconds() > duration_gc_threadold) {
effective_memory_limit = ranges_size * duration_gc_threadold /
if (duration > duration_gc_threadold) {
effective_memory_limit = ranges_size * duration_gc_threadold.InMicroseconds() /
duration.InMicroseconds();
}
#endif // defined(STARBOARD)
Expand Down