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

[media] Refine DecoderBufferAllocator memory budget #4674

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

xiaomings
Copy link
Contributor

@xiaomings xiaomings commented Jan 9, 2025

Now SbMedia budget functions are properly respected when deciding MediaSource buffer memory limits.

DecoderBuffer::Allocator interface has been refined to remove SbMedia types, and all Starboard dependency is resolved inside the concrete DecoderBufferAllocator implementation in //media/starboard.

The logic to determine whether a video is 10 bits has been refined, as the video mime type is no longer available.

b/322027866

@xiaomings xiaomings requested review from a team as code owners January 9, 2025 01:00
@xiaomings xiaomings requested a review from johnxwork January 9, 2025 01:00
@xiaomings xiaomings force-pushed the decoder_buffer_allocator branch 2 times, most recently from b5863f1 to d3802ad Compare January 9, 2025 18:37
@@ -462,7 +462,9 @@ source_set("base") {
]
}

if (is_android) {
if (is_cobalt && use_starboard_media) {
sources += [ "demuxer_memory_limit_starboard.cc" ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is not under /*/starboard/ directory, the code doesn't get formatted.

Should we move this to /media/base/starboard, so we can get it formatted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this. I forced code formatting on decoder_buffer.h and demuxer_memory_limit_starboard.cc so they are ok now.

I am also happy to move the latter to //media/base/starboard if that's preferred. Just wanted to double check if we should create the folder and move the file there, or we should also create a BUILD.gn for it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a folder. We did the same thing for all other places.

We should consider to follow the same approach. Example PR is #4352.

@xiaomings xiaomings force-pushed the decoder_buffer_allocator branch 4 times, most recently from 7def28c to 9ddf1c6 Compare January 9, 2025 22:26

if (video_config->codec() == VideoCodec::kH264) {
LOG(INFO) << "H264 encountered, assume 8 bits.";
return 8;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: as 8 bits and 10 bits are used frequently, should we consider to define them as constexpr, so the name itself can know they are 8 and 10 bits?

@xiaomings xiaomings force-pushed the decoder_buffer_allocator branch 2 times, most recently from 2081cd7 to 028c2e6 Compare January 10, 2025 00:55
Now SbMedia budget functions are properly respected when deciding
MediaSource buffer memory limits.

DecoderBuffer::Allocator interface has been refined to remove SbMedia
types, and all Starboard dependency is resolved inside the concrete
DecoderBufferAllocator implementation in //media/starboard.

The logic to determine whether a video is 10 bits has been refined, as
the video mime type is no longer available.

b/322027866
@xiaomings xiaomings force-pushed the decoder_buffer_allocator branch from 028c2e6 to 7fc63cd Compare January 10, 2025 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants