sources += [ "demuxer_memory_limit_android.cc" ]
} else if (is_castos) {
sources += [ "demuxer_memory_limit_cast.cc" ]
+ } else if (tizen_product_tv) {
+ sources += [ "demuxer_memory_limit_product_tv.cc" ]
} else if (is_fuchsia || tizen_multimedia) {
sources += [ "demuxer_memory_limit_low.cc" ]
} else {
GetDemuxerStreamVideoMemoryLimit(Demuxer::DemuxerTypes demuxer_type,
const VideoDecoderConfig* video_config);
+#if BUILDFLAG(IS_TIZEN_TV)
+MEDIA_EXPORT size_t
+UpdateDemuxerStreamVideoMemoryLimit(const VideoDecoderConfig* video_config);
+#endif
+
// The maximum amount of data (in bytes) a demuxer can keep in memory overall.
MEDIA_EXPORT size_t GetDemuxerMemoryLimit(Demuxer::DemuxerTypes demuxer_type);
// These values should not be used directly, they are selected by functions
// above based on platform capabilities.
+#if BUILDFLAG(IS_TIZEN_TV)
+constexpr size_t kDemuxerStreamVideoMemoryLimitTvUHD = 80 * 1024 * 1024;
+constexpr size_t kDemuxerStreamVideoMemoryLimitTvDefault = 40 * 1024 * 1024;
+constexpr size_t kDemuxerStreamAudioMemoryLimitTvDefault = 8 * 1024 * 1024;
+#endif
// Default audio memory limit: 12MB (5 minutes of 320Kbps content).
// Medium audio memory limit: 5MB.
--- /dev/null
+// Copyright 2019 Samsung Electronics Inc. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/base/demuxer_memory_limit.h"
+#include "media/base/video_decoder_config.h"
+
+namespace media {
+
+size_t UpdateDemuxerStreamVideoMemoryLimit(
+ const VideoDecoderConfig* video_config) {
+ static size_t demuxer_stream_video_memory_limit =
+ internal::kDemuxerStreamVideoMemoryLimitTvDefault;
+
+ if (!video_config)
+ return demuxer_stream_video_memory_limit;
+
+ const int kFHDWidth = 1920;
+ const int kFHDHeight = 1080;
+ bool isUHDResolution = video_config->coded_size().width() > kFHDWidth ||
+ video_config->coded_size().height() > kFHDHeight;
+ if (isUHDResolution) {
+ demuxer_stream_video_memory_limit =
+ internal::kDemuxerStreamVideoMemoryLimitTvUHD;
+ }
+
+ return demuxer_stream_video_memory_limit;
+}
+
+size_t GetDemuxerStreamVideoMemoryLimit(
+ Demuxer::DemuxerTypes /*demuxer_type*/,
+ const VideoDecoderConfig* video_config) {
+ return UpdateDemuxerStreamVideoMemoryLimit(video_config);
+}
+
+size_t GetDemuxerStreamAudioMemoryLimit(
+ const AudioDecoderConfig* /*audio_config*/) {
+ return internal::kDemuxerStreamAudioMemoryLimitTvDefault;
+}
+
+size_t GetDemuxerMemoryLimit(Demuxer::DemuxerTypes demuxer_type) {
+ return GetDemuxerStreamAudioMemoryLimit(nullptr) +
+ GetDemuxerStreamVideoMemoryLimit(demuxer_type, nullptr);
+}
+
+} // namespace media
DVLOG(2) << "New video config - index: " << append_config_index_;
video_configs_.resize(video_configs_.size() + 1);
video_configs_[append_config_index_] = config;
+#if BUILDFLAG(IS_TIZEN_TV)
+ size_t updated_memory_limit = UpdateDemuxerStreamVideoMemoryLimit(&config);
+ memory_limit_ = std::max(memory_limit_, updated_memory_limit);
+#endif
return true;
}