1 // Copyright 2019 Samsung Electronics Inc. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "media/base/demuxer_memory_limit.h"
6 #include "media/base/video_decoder_config.h"
10 size_t UpdateDemuxerStreamVideoMemoryLimit(
11 const VideoDecoderConfig* video_config) {
12 static size_t demuxer_stream_video_memory_limit =
13 internal::kDemuxerStreamVideoMemoryLimitTvDefault;
16 return demuxer_stream_video_memory_limit;
18 const int kFHDWidth = 1920;
19 const int kFHDHeight = 1080;
20 bool isUHDResolution = video_config->coded_size().width() > kFHDWidth ||
21 video_config->coded_size().height() > kFHDHeight;
22 if (isUHDResolution) {
23 demuxer_stream_video_memory_limit =
24 internal::kDemuxerStreamVideoMemoryLimitTvUHD;
27 return demuxer_stream_video_memory_limit;
30 size_t GetDemuxerStreamVideoMemoryLimit(
31 Demuxer::DemuxerTypes /*demuxer_type*/,
32 const VideoDecoderConfig* video_config) {
33 return UpdateDemuxerStreamVideoMemoryLimit(video_config);
36 size_t GetDemuxerStreamAudioMemoryLimit(
37 const AudioDecoderConfig* /*audio_config*/) {
38 return internal::kDemuxerStreamAudioMemoryLimitTvDefault;
41 size_t GetDemuxerMemoryLimit(Demuxer::DemuxerTypes demuxer_type) {
42 return GetDemuxerStreamAudioMemoryLimit(nullptr) +
43 GetDemuxerStreamVideoMemoryLimit(demuxer_type, nullptr);