Import Cobalt 19.master.0.186195
Includes the following patches:
https://cobalt-review.googlesource.com/c/cobalt/+/4910
by milko.leporis@mips.com
https://cobalt-review.googlesource.com/c/cobalt/+/4830
by linus.wang@samsung.com
https://cobalt-review.googlesource.com/c/cobalt/+/4831
by linus.wang@samsung.com
Change-Id: I285ceafb6db80c1440dd14795458e66d3bccd766
diff --git a/src/cobalt/bindings/contexts.py b/src/cobalt/bindings/contexts.py
index 23cd3d7..885f6e5 100644
--- a/src/cobalt/bindings/contexts.py
+++ b/src/cobalt/bindings/contexts.py
@@ -30,6 +30,7 @@
from overload_context import get_overload_contexts
from v8_attributes import is_constructor_attribute
from v8_interface import method_overloads_by_name
+import v8_utilities
def is_date_type(idl_type):
@@ -397,6 +398,12 @@
self.typed_object_to_cobalt_type(interface, operation),
'is_static':
operation.is_static,
+ 'on_instance':
+ v8_utilities.on_instance(interface, operation),
+ 'on_interface':
+ v8_utilities.on_interface(interface, operation),
+ 'on_prototype':
+ v8_utilities.on_prototype(interface, operation),
'call_with':
operation.extended_attributes.get('CallWith', None),
'raises_exception':
@@ -406,7 +413,6 @@
'unsupported':
'NotSupported' in operation.extended_attributes,
}
-
context.update(self.partial_context(interface, operation))
return context
@@ -486,6 +492,12 @@
self.typed_object_to_cobalt_type(interface, attribute),
'is_static':
attribute.is_static,
+ 'on_instance':
+ v8_utilities.on_instance(interface, attribute),
+ 'on_interface':
+ v8_utilities.on_interface(interface, attribute),
+ 'on_prototype':
+ v8_utilities.on_prototype(interface, attribute),
'is_read_only':
attribute.is_read_only,
'call_with':
@@ -598,6 +610,9 @@
context['idl_name'] = context['overloads'][0]['idl_name']
context['conditional'] = context['overloads'][0]['conditional']
context['unsupported'] = context['overloads'][0]['unsupported']
+ context['on_instance'] = context['overloads'][0]['on_instance']
+ context['on_interface'] = context['overloads'][0]['on_interface']
+ context['on_prototype'] = context['overloads'][0]['on_prototype']
for overload in context['overloads']:
assert context['conditional'] == overload['conditional'], (
'All overloads must have the same conditional.')
diff --git a/src/cobalt/bindings/v8c/templates/interface.cc.template b/src/cobalt/bindings/v8c/templates/interface.cc.template
index a5dabfc..8d8736c 100644
--- a/src/cobalt/bindings/v8c/templates/interface.cc.template
+++ b/src/cobalt/bindings/v8c/templates/interface.cc.template
@@ -661,7 +661,7 @@
{% endif %}
// The location of the property is determined as follows:
-{% if attribute.is_static %}
+{% if attribute.on_interface %}
// Operations installed on the interface object must be static methods, so
// no need to specify a signature, i.e. no need to do type check against a
// holder.
@@ -669,7 +669,7 @@
// If the attribute is a static attribute, then there is a single
// corresponding property and it exists on the interface's interface object.
function_template->
-{% elif attribute.is_unforgeable or is_global_interface %}
+{% elif attribute.on_instance %}
// Otherwise, if the attribute is unforgeable on the interface or if the
// interface was declared with the [Global] extended attribute, then the
// property exists on every object that implements the interface.
@@ -741,11 +741,11 @@
method_template->SetLength({{operation.length}});
// The location of the property is determined as follows:
-{% if operation.is_static %}
+{% if operation.on_interface %}
// If the operation is static, then the property exists on the interface
// object.
function_template->
-{% elif operation.is_unforgeable or is_global_interface %}
+{% elif operation.on_instance %}
// Otherwise, if the operation is unforgeable on the interface or if the
// interface was declared with the [Global] extended attribute, then the
// property exists on every object that implements the interface.
diff --git a/src/cobalt/build/build.id b/src/cobalt/build/build.id
index 3450182..0952d93 100644
--- a/src/cobalt/build/build.id
+++ b/src/cobalt/build/build.id
@@ -1 +1 @@
-185967
\ No newline at end of file
+186195
\ No newline at end of file
diff --git a/src/cobalt/dom/rule_matching.cc b/src/cobalt/dom/rule_matching.cc
index 736efae..86ae85b 100644
--- a/src/cobalt/dom/rule_matching.cc
+++ b/src/cobalt/dom/rule_matching.cc
@@ -600,12 +600,13 @@
// |parent_nodes| and |matching_nodes|, as these two containers are kept in
// sync.
for (const auto& parent_node_to_remove : parent_nodes_to_remove) {
- for (size_t index = 0; index < parent_nodes->size(); ++index) {
+ for (size_t index = 0; index < parent_nodes->size();) {
if (parent_node_to_remove == (*parent_nodes)[index]) {
node_removed = true;
parent_nodes->erase(parent_nodes->begin() + index);
matching_nodes->erase(matching_nodes->begin() + index);
- break;
+ } else {
+ ++index;
}
}
}
diff --git a/src/cobalt/media/base/drm_system.cc b/src/cobalt/media/base/drm_system.cc
index 5cf1eb6..6ac8145 100644
--- a/src/cobalt/media/base/drm_system.cc
+++ b/src/cobalt/media/base/drm_system.cc
@@ -207,8 +207,9 @@
void DrmSystem::CloseSession(const std::string& session_id) {
DCHECK(message_loop_->BelongsToCurrentThread());
-
+#if !SB_HAS(DRM_SESSION_CLOSED)
id_to_session_map_.erase(session_id);
+#endif // !SB_HAS(DRM_SESSION_CLOSED)
SbDrmCloseSession(wrapped_drm_system_, session_id.c_str(), session_id.size());
}
diff --git a/src/cobalt/script/standalone_javascript_runner.cc b/src/cobalt/script/standalone_javascript_runner.cc
index cc92421..d18217c 100644
--- a/src/cobalt/script/standalone_javascript_runner.cc
+++ b/src/cobalt/script/standalone_javascript_runner.cc
@@ -30,6 +30,7 @@
}
void StandaloneJavascriptRunner::RunInteractive() {
+#if defined(COBALT_LINUX)
while (!std::cin.eof() && std::cin.good()) {
// Interactive prompt.
std::cout << "> ";
@@ -42,6 +43,9 @@
}
}
std::cout << std::endl;
+#else
+ NOTIMPLEMENTED();
+#endif
}
void StandaloneJavascriptRunner::ExecuteFile(const FilePath& path) {
diff --git a/src/starboard/contrib/creator/README.md b/src/starboard/contrib/creator/README.md
index f6f57f0..6e66ee0 100644
--- a/src/starboard/contrib/creator/README.md
+++ b/src/starboard/contrib/creator/README.md
@@ -1,7 +1,7 @@
# MIPS support
starboard/contrib/creator directory contains port of Cobalt for Creator CI20 platform:
-https://creatordev.io/ci20.html
+https://www.elinux.org/MIPS_Creator_CI20
# Building Cobalt for CI20
diff --git a/src/starboard/contrib/creator/shared/media_is_video_supported.cc b/src/starboard/contrib/creator/shared/media_is_video_supported.cc
index 67f03f3..1b13fa7 100644
--- a/src/starboard/contrib/creator/shared/media_is_video_supported.cc
+++ b/src/starboard/contrib/creator/shared/media_is_video_supported.cc
@@ -21,7 +21,12 @@
int frame_width,
int frame_height,
int64_t bitrate,
- int fps) {
+ int fps,
+ bool decode_to_texture_required) {
+ if (decode_to_texture_required) {
+ // There is no Creator CI20 360 video implementation.
+ return false;
+ }
return video_codec == kSbMediaVideoCodecH264 && frame_width <= 1920 &&
frame_height <= 1080 &&
bitrate <= SB_MEDIA_MAX_VIDEO_BITRATE_IN_BITS_PER_SECOND && fps <= 30;
diff --git a/src/starboard/contrib/creator/shared/starboard_platform.gypi b/src/starboard/contrib/creator/shared/starboard_platform.gypi
index 0353a9e..c53674c 100644
--- a/src/starboard/contrib/creator/shared/starboard_platform.gypi
+++ b/src/starboard/contrib/creator/shared/starboard_platform.gypi
@@ -12,8 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
{
+ 'includes': [
+ '<(DEPTH)/starboard/shared/starboard/player/filter/player_filter.gypi',
+ ],
'variables': {
'starboard_platform_sources': [
+ '<@(filter_based_player_sources)',
'<(DEPTH)/starboard/contrib/creator/shared/media_is_video_supported.cc',
'<(DEPTH)/starboard/contrib/creator/shared/player_components_impl.cc',
'<(DEPTH)/starboard/linux/shared/atomic_public.h',
@@ -247,38 +251,6 @@
'<(DEPTH)/starboard/shared/starboard/new.cc',
'<(DEPTH)/starboard/shared/starboard/player/decoded_audio_internal.cc',
'<(DEPTH)/starboard/shared/starboard/player/decoded_audio_internal.h',
- '<(DEPTH)/starboard/shared/starboard/player/filter/audio_decoder_internal.h',
- '<(DEPTH)/starboard/shared/starboard/player/filter/audio_frame_tracker.cc',
- '<(DEPTH)/starboard/shared/starboard/player/filter/audio_frame_tracker.h',
- '<(DEPTH)/starboard/shared/starboard/player/filter/audio_time_stretcher.h',
- '<(DEPTH)/starboard/shared/starboard/player/filter/audio_time_stretcher.cc',
- '<(DEPTH)/starboard/shared/starboard/player/filter/audio_renderer_internal.cc',
- '<(DEPTH)/starboard/shared/starboard/player/filter/audio_renderer_internal.h',
- '<(DEPTH)/starboard/shared/starboard/player/filter/audio_renderer_sink.h',
- '<(DEPTH)/starboard/shared/starboard/player/filter/audio_renderer_sink_impl.cc',
- '<(DEPTH)/starboard/shared/starboard/player/filter/audio_renderer_sink_impl.h',
- '<(DEPTH)/starboard/shared/starboard/player/filter/audio_resampler_impl.cc',
- '<(DEPTH)/starboard/shared/starboard/player/filter/cpu_video_frame.cc',
- '<(DEPTH)/starboard/shared/starboard/player/filter/cpu_video_frame.h',
- '<(DEPTH)/starboard/shared/starboard/player/filter/decoded_audio_queue.h',
- '<(DEPTH)/starboard/shared/starboard/player/filter/decoded_audio_queue.cc',
- '<(DEPTH)/starboard/shared/starboard/player/filter/filter_based_player_worker_handler.cc',
- '<(DEPTH)/starboard/shared/starboard/player/filter/filter_based_player_worker_handler.h',
- '<(DEPTH)/starboard/shared/starboard/player/filter/media_time_provider.h',
- '<(DEPTH)/starboard/shared/starboard/player/filter/media_time_provider_impl.cc',
- '<(DEPTH)/starboard/shared/starboard/player/filter/media_time_provider_impl.h',
- '<(DEPTH)/starboard/shared/starboard/player/filter/player_components.h',
- '<(DEPTH)/starboard/shared/starboard/player/filter/punchout_video_renderer_sink.cc',
- '<(DEPTH)/starboard/shared/starboard/player/filter/punchout_video_renderer_sink.h',
- '<(DEPTH)/starboard/shared/starboard/player/filter/video_decoder_internal.h',
- '<(DEPTH)/starboard/shared/starboard/player/filter/video_frame_internal.h',
- '<(DEPTH)/starboard/shared/starboard/player/filter/video_render_algorithm.h',
- '<(DEPTH)/starboard/shared/starboard/player/filter/video_render_algorithm_impl.cc',
- '<(DEPTH)/starboard/shared/starboard/player/filter/video_render_algorithm_impl.h',
- '<(DEPTH)/starboard/shared/starboard/player/filter/video_renderer_internal.cc',
- '<(DEPTH)/starboard/shared/starboard/player/filter/video_renderer_internal.h',
- '<(DEPTH)/starboard/shared/starboard/player/filter/wsola_internal.h',
- '<(DEPTH)/starboard/shared/starboard/player/filter/wsola_internal.cc',
'<(DEPTH)/starboard/shared/starboard/player/input_buffer_internal.cc',
'<(DEPTH)/starboard/shared/starboard/player/input_buffer_internal.h',
'<(DEPTH)/starboard/shared/starboard/player/job_queue.cc',
diff --git a/src/starboard/linux/shared/BUILD.gn b/src/starboard/linux/shared/BUILD.gn
index 2ad6091..321db07 100644
--- a/src/starboard/linux/shared/BUILD.gn
+++ b/src/starboard/linux/shared/BUILD.gn
@@ -470,6 +470,7 @@
"//starboard/shared/starboard/media/media_get_audio_output_count_stereo_only.cc",
"//starboard/shared/starboard/media/media_is_audio_supported_aac_and_opus.cc",
"//starboard/shared/starboard/media/media_is_output_protected.cc",
+ "//starboard/shared/starboard/media/media_is_transfer_characteristics_supported.cc",
"//starboard/shared/starboard/media/media_set_output_protection.cc",
"//starboard/shared/starboard/media/media_util.cc",
"//starboard/shared/starboard/media/media_util.h",
@@ -537,7 +538,7 @@
"//starboard/shared/starboard/system_request_stop.cc",
"//starboard/shared/starboard/system_request_suspend.cc",
"//starboard/shared/starboard/system_request_unpause.cc",
- '//starboard/shared/starboard/system_supports_resume.cc',
+ "//starboard/shared/starboard/system_supports_resume.cc",
"//starboard/shared/starboard/window_set_default_options.cc",
"//starboard/shared/stub/accessibility_get_display_settings.cc",
"//starboard/shared/stub/accessibility_get_text_to_speech_settings.cc",
@@ -558,7 +559,6 @@
"//starboard/shared/stub/image_decode.cc",
"//starboard/shared/stub/image_is_decode_supported.cc",
"//starboard/shared/stub/media_is_supported.cc",
- "//starboard/shared/stub/media_is_transfer_characteristics_supported.cc",
"//starboard/shared/stub/microphone_close.cc",
"//starboard/shared/stub/microphone_create.cc",
"//starboard/shared/stub/microphone_destroy.cc",
diff --git a/src/starboard/linux/shared/starboard_platform.gypi b/src/starboard/linux/shared/starboard_platform.gypi
index c7588ca..67a24f7 100644
--- a/src/starboard/linux/shared/starboard_platform.gypi
+++ b/src/starboard/linux/shared/starboard_platform.gypi
@@ -240,6 +240,7 @@
'<(DEPTH)/starboard/shared/starboard/media/media_is_audio_supported_aac_and_opus.cc',
'<(DEPTH)/starboard/shared/starboard/media/media_is_buffer_pool_allocate_on_demand.cc',
'<(DEPTH)/starboard/shared/starboard/media/media_is_buffer_using_memory_pool.cc',
+ '<(DEPTH)/starboard/shared/starboard/media/media_is_transfer_characteristics_supported.cc',
'<(DEPTH)/starboard/shared/starboard/media/media_set_output_protection.cc',
'<(DEPTH)/starboard/shared/starboard/media/media_util.cc',
'<(DEPTH)/starboard/shared/starboard/media/media_util.h',
@@ -296,7 +297,6 @@
'<(DEPTH)/starboard/shared/stub/cryptography_transform.cc',
'<(DEPTH)/starboard/shared/stub/image_decode.cc',
'<(DEPTH)/starboard/shared/stub/image_is_decode_supported.cc',
- '<(DEPTH)/starboard/shared/stub/media_is_transfer_characteristics_supported.cc',
'<(DEPTH)/starboard/shared/stub/microphone_close.cc',
'<(DEPTH)/starboard/shared/stub/microphone_create.cc',
'<(DEPTH)/starboard/shared/stub/microphone_destroy.cc',
diff --git a/src/starboard/nplb/system_get_property_test.cc b/src/starboard/nplb/system_get_property_test.cc
index bb4379b..0a255c3 100644
--- a/src/starboard/nplb/system_get_property_test.cc
+++ b/src/starboard/nplb/system_get_property_test.cc
@@ -113,7 +113,7 @@
BasicTest(static_cast<SbSystemPropertyId>(99999), true, false, __LINE__);
}
-TEST(SbSystemGetPathTest, DoesNotTouchOutputBufferOnFailureForDefinedIds) {
+TEST(SbSystemGetPropertyTest, DoesNotTouchOutputBufferOnFailureForDefinedIds) {
UnmodifiedOnFailureTest(kSbSystemPropertyChipsetModelNumber, __LINE__);
UnmodifiedOnFailureTest(kSbSystemPropertyFirmwareVersion, __LINE__);
UnmodifiedOnFailureTest(kSbSystemPropertyFriendlyName, __LINE__);
diff --git a/src/starboard/raspi/shared/starboard_platform.gypi b/src/starboard/raspi/shared/starboard_platform.gypi
index be746db..835f5d0 100644
--- a/src/starboard/raspi/shared/starboard_platform.gypi
+++ b/src/starboard/raspi/shared/starboard_platform.gypi
@@ -290,6 +290,7 @@
'<(DEPTH)/starboard/shared/starboard/media/media_is_buffer_pool_allocate_on_demand.cc',
'<(DEPTH)/starboard/shared/starboard/media/media_is_buffer_using_memory_pool.cc',
'<(DEPTH)/starboard/shared/starboard/media/media_is_output_protected.cc',
+ '<(DEPTH)/starboard/shared/starboard/media/media_is_transfer_characteristics_supported.cc',
'<(DEPTH)/starboard/shared/starboard/media/media_set_output_protection.cc',
'<(DEPTH)/starboard/shared/starboard/media/media_util.cc',
'<(DEPTH)/starboard/shared/starboard/media/media_util.h',
@@ -351,7 +352,6 @@
'<(DEPTH)/starboard/shared/stub/drm_update_server_certificate.cc',
'<(DEPTH)/starboard/shared/stub/drm_update_session.cc',
'<(DEPTH)/starboard/shared/stub/media_is_supported.cc',
- '<(DEPTH)/starboard/shared/stub/media_is_transfer_characteristics_supported.cc',
'<(DEPTH)/starboard/shared/stub/system_clear_platform_error.cc',
'<(DEPTH)/starboard/shared/stub/system_get_total_gpu_memory.cc',
'<(DEPTH)/starboard/shared/stub/system_get_used_gpu_memory.cc',
diff --git a/src/starboard/raspi/shared/system_get_property.cc b/src/starboard/raspi/shared/system_get_property.cc
index 3930087..a04ae5e 100644
--- a/src/starboard/raspi/shared/system_get_property.cc
+++ b/src/starboard/raspi/shared/system_get_property.cc
@@ -15,6 +15,9 @@
#include "starboard/system.h"
#include <sys/utsname.h>
+
+#include <string>
+
#include "starboard/log.h"
#include "starboard/string.h"
@@ -60,19 +63,10 @@
if (uname(&name) == -1)
return false;
- if (SbStringCopy(out_value, "Raspian ", value_length) >= value_length)
- return false;
+ std::string temp =
+ starboard::FormatString("Raspian %s %s", name.sysname, name.machine);
- if (SbStringConcat(out_value, name.sysname, value_length) >= value_length)
- return false;
-
- if (SbStringConcat(out_value, " ", value_length) >= value_length)
- return false;
-
- if (SbStringConcat(out_value, name.machine, value_length) >= value_length)
- return false;
-
- return true;
+ return CopyStringAndTestIfSuccess(out_value, value_length, temp.c_str());
}
default:
diff --git a/src/starboard/shared/directfb/application_directfb.cc b/src/starboard/shared/directfb/application_directfb.cc
index da8d63b..152bc31 100644
--- a/src/starboard/shared/directfb/application_directfb.cc
+++ b/src/starboard/shared/directfb/application_directfb.cc
@@ -459,7 +459,8 @@
sigemptyset(&sigaction_config.sa_mask);
sigaction_config.sa_flags = 0;
- // Unblock SIGSEGV, which has been blocked earlier (perhaps by libdirectfb)
+ // Unblock SIGSEGV, which has been blocked earlier (perhaps by
+ // libdirectfb)
sigset_t set;
sigemptyset(&set);
sigaddset(&set, SIGSEGV);
@@ -523,6 +524,9 @@
SbInputData* data = new SbInputData();
SbMemorySet(data, 0, sizeof(*data));
+#if SB_API_VERSION >= 10
+ data->timestamp = SbTimeGetMonotonicNow();
+#endif // SB_API_VERSION >= 10
data->window = window_;
SB_DCHECK(SbWindowIsValid(data->window));
data->type = (event.type == DIET_KEYPRESS ? kSbInputEventTypePress
diff --git a/src/starboard/shared/linux/dev_input/dev_input.cc b/src/starboard/shared/linux/dev_input/dev_input.cc
index ec46365..2ef71fb 100644
--- a/src/starboard/shared/linux/dev_input/dev_input.cc
+++ b/src/starboard/shared/linux/dev_input/dev_input.cc
@@ -892,6 +892,9 @@
SbInputData* data = new SbInputData();
SbMemorySet(data, 0, sizeof(*data));
+#if SB_API_VERSION >= 10
+ data->timestamp = SbTimeGetMonotonicNow();
+#endif // SB_API_VERSION >= 10
data->window = window;
data->type = type;
data->device_type = kSbInputDeviceTypeGamepad;
@@ -912,6 +915,9 @@
SbInputData* data = new SbInputData();
SbMemorySet(data, 0, sizeof(*data));
+#if SB_API_VERSION >= 10
+ data->timestamp = SbTimeGetMonotonicNow();
+#endif // SB_API_VERSION >= 10
data->window = window;
data->type = kSbInputEventTypeMove;
data->device_type = kSbInputDeviceTypeGamepad;
@@ -940,6 +946,9 @@
SbInputData* data = new SbInputData();
SbMemorySet(data, 0, sizeof(*data));
+#if SB_API_VERSION >= 10
+ data->timestamp = SbTimeGetMonotonicNow();
+#endif // SB_API_VERSION >= 10
data->window = window;
data->type = type;
data->device_type = kSbInputDeviceTypeTouchPad;
@@ -1120,6 +1129,9 @@
SB_DCHECK(event.value <= 2);
SbInputData* data = new SbInputData();
SbMemorySet(data, 0, sizeof(*data));
+#if SB_API_VERSION >= 10
+ data->timestamp = SbTimeGetMonotonicNow();
+#endif // SB_API_VERSION >= 10
data->window = window_;
data->type =
(event.value == 0 ? kSbInputEventTypeUnpress : kSbInputEventTypePress);
diff --git a/src/starboard/shared/starboard/media/media_is_transfer_characteristics_supported.cc b/src/starboard/shared/starboard/media/media_is_transfer_characteristics_supported.cc
new file mode 100644
index 0000000..01f4eca
--- /dev/null
+++ b/src/starboard/shared/starboard/media/media_is_transfer_characteristics_supported.cc
@@ -0,0 +1,22 @@
+// Copyright 2018 The Cobalt Authors. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "starboard/shared/starboard/media/media_support_internal.h"
+
+#include "starboard/media.h"
+
+SB_EXPORT bool SbMediaIsTransferCharacteristicsSupported(
+ SbMediaTransferId transfer_id) {
+ return transfer_id == kSbMediaTransferIdBt709;
+}
diff --git a/src/starboard/shared/starboard/player/filter/testing/audio_decoder_test.cc b/src/starboard/shared/starboard/player/filter/testing/audio_decoder_test.cc
index 46e07e8..39a108e 100644
--- a/src/starboard/shared/starboard/player/filter/testing/audio_decoder_test.cc
+++ b/src/starboard/shared/starboard/player/filter/testing/audio_decoder_test.cc
@@ -68,7 +68,9 @@
class AudioDecoderTest : public ::testing::TestWithParam<const char*> {
public:
- AudioDecoderTest() : dmp_reader_(ResolveTestFileName(GetParam()).c_str()) {}
+ AudioDecoderTest() : dmp_reader_(ResolveTestFileName(GetParam()).c_str()) {
+ SB_LOG(INFO) << "Testing " << GetParam();
+ }
void SetUp() override {
ASSERT_NE(dmp_reader_.audio_codec(), kSbMediaAudioCodecNone);
ASSERT_GT(dmp_reader_.number_of_audio_buffers(), 0);
diff --git a/src/starboard/shared/starboard/player/filter/testing/video_decoder_test.cc b/src/starboard/shared/starboard/player/filter/testing/video_decoder_test.cc
index 12622c5..8b7d749 100644
--- a/src/starboard/shared/starboard/player/filter/testing/video_decoder_test.cc
+++ b/src/starboard/shared/starboard/player/filter/testing/video_decoder_test.cc
@@ -97,7 +97,9 @@
class VideoDecoderTest : public ::testing::TestWithParam<TestParam> {
public:
VideoDecoderTest()
- : dmp_reader_(ResolveTestFileName(GetParam().filename).c_str()) {}
+ : dmp_reader_(ResolveTestFileName(GetParam().filename).c_str()) {
+ SB_LOG(INFO) << "Testing " << GetParam().filename;
+ }
void SetUp() override {
ASSERT_NE(dmp_reader_.video_codec(), kSbMediaVideoCodecNone);
@@ -571,6 +573,9 @@
video_decoder_->GetMaxNumberOfCachedFrames();
}));
WriteEndOfStream();
+ if (decoded_frames_.size() >= video_decoder_->GetMaxNumberOfCachedFrames()) {
+ return;
+ }
bool error_occurred = false;
ASSERT_NO_FATAL_FAILURE(DrainOutputs(
&error_occurred, [=](const Event& event, bool* continue_process) {
diff --git a/src/starboard/shared/starboard/player/video_dmp_reader.cc b/src/starboard/shared/starboard/player/video_dmp_reader.cc
index 28b3ad4..c497871 100644
--- a/src/starboard/shared/starboard/player/video_dmp_reader.cc
+++ b/src/starboard/shared/starboard/player/video_dmp_reader.cc
@@ -64,15 +64,21 @@
VideoDmpReader::VideoDmpReader(const char* filename)
: reverse_byte_order_(false),
- read_cb_(std::bind(&VideoDmpReader::ReadFromFile, this, _1, _2)) {
- SB_CHECK(SbFileCanOpen(filename, kSbFileOpenOnly | kSbFileRead))
- << "Can't open " << filename;
- file_ = SbFileOpen(filename, kSbFileOpenOnly | kSbFileRead, NULL, NULL);
- SB_DCHECK(SbFileIsValid(file_));
+ read_cb_(std::bind(&VideoDmpReader::ReadFromCache, this, _1, _2)) {
+ ScopedFile file(filename, kSbFileOpenOnly | kSbFileRead);
+ SB_CHECK(file.IsValid()) << "Failed to open " << filename;
+ int64_t file_size = file.GetSize();
+ SB_CHECK(file_size >= 0);
+
+ file_cache_.resize(file_size);
+ int bytes_read = file.Read(file_cache_.data(), file_size);
+ SB_CHECK(bytes_read == file_size);
Parse();
- SbFileClose(file_);
+ // To free memory used by |file_cache_|.
+ decltype(file_cache_) empty;
+ file_cache_.swap(empty);
}
VideoDmpReader::~VideoDmpReader() {}
@@ -111,7 +117,7 @@
}
for (;;) {
uint32_t type;
- int bytes_read = ReadFromFile(&type, sizeof(type));
+ int bytes_read = ReadFromCache(&type, sizeof(type));
if (bytes_read <= 0) {
break;
}
@@ -205,8 +211,12 @@
std::move(data), video_sample_info);
}
-int VideoDmpReader::ReadFromFile(void* buffer, int bytes_to_read) {
- return SbFileRead(file_, static_cast<char*>(buffer), bytes_to_read);
+int VideoDmpReader::ReadFromCache(void* buffer, int bytes_to_read) {
+ bytes_to_read = std::min(
+ bytes_to_read, static_cast<int>(file_cache_.size()) - file_cache_offset_);
+ SbMemoryCopy(buffer, file_cache_.data() + file_cache_offset_, bytes_to_read);
+ file_cache_offset_ += bytes_to_read;
+ return bytes_to_read;
}
} // namespace video_dmp
diff --git a/src/starboard/shared/starboard/player/video_dmp_reader.h b/src/starboard/shared/starboard/player/video_dmp_reader.h
index e692b3a..2fc8a13 100644
--- a/src/starboard/shared/starboard/player/video_dmp_reader.h
+++ b/src/starboard/shared/starboard/player/video_dmp_reader.h
@@ -98,9 +98,8 @@
void Parse();
AudioAccessUnit ReadAudioAccessUnit();
VideoAccessUnit ReadVideoAccessUnit();
- int ReadFromFile(void* buffer, int bytes_to_read);
+ int ReadFromCache(void* buffer, int bytes_to_read);
- SbFile file_;
ReadCB read_cb_;
bool reverse_byte_order_;
@@ -115,6 +114,9 @@
std::vector<AudioAccessUnit> audio_access_units_;
std::vector<VideoAccessUnit> video_access_units_;
+
+ int file_cache_offset_ = 0;
+ std::vector<char> file_cache_;
};
} // namespace video_dmp
diff --git a/src/starboard/shared/wayland/dev_input.cc b/src/starboard/shared/wayland/dev_input.cc
index 2531e5e..2a1e102 100644
--- a/src/starboard/shared/wayland/dev_input.cc
+++ b/src/starboard/shared/wayland/dev_input.cc
@@ -524,6 +524,9 @@
void DevInput::CreateKey(int key, int state, bool is_repeat) {
SbInputData* data = new SbInputData();
SbMemorySet(data, 0, sizeof(*data));
+#if SB_API_VERSION >= 10
+ data->timestamp = SbTimeGetMonotonicNow();
+#endif // SB_API_VERSION >= 10
data->window = window_;
data->type = (state == 0 ? kSbInputEventTypeUnpress : kSbInputEventTypePress);
data->device_type = kSbInputDeviceTypeRemote;
diff --git a/src/starboard/shared/x11/application_x11.cc b/src/starboard/shared/x11/application_x11.cc
index b52f730..5d45828 100644
--- a/src/starboard/shared/x11/application_x11.cc
+++ b/src/starboard/shared/x11/application_x11.cc
@@ -1119,6 +1119,9 @@
scoped_ptr<SbInputData> data(new SbInputData());
SbMemorySet(data.get(), 0, sizeof(*data));
+#if SB_API_VERSION >= 10
+ data->timestamp = SbTimeGetMonotonicNow();
+#endif // SB_API_VERSION >= 10
data->window = windows_[0];
SB_DCHECK(SbWindowIsValid(data->window));
data->type = paste_buffer_key_release_pending_ ? kSbInputEventTypeUnpress
@@ -1184,6 +1187,9 @@
scoped_ptr<SbInputData> data(new SbInputData());
SbMemorySet(data.get(), 0, sizeof(*data));
+#if SB_API_VERSION >= 10
+ data->timestamp = SbTimeGetMonotonicNow();
+#endif // SB_API_VERSION >= 10
data->window = FindWindow(x_key_event->window);
SB_DCHECK(SbWindowIsValid(data->window));
data->type = x_event->type == KeyPress ? kSbInputEventTypePress
@@ -1211,6 +1217,9 @@
#endif
scoped_ptr<SbInputData> data(new SbInputData());
SbMemorySet(data.get(), 0, sizeof(*data));
+#if SB_API_VERSION >= 10
+ data->timestamp = SbTimeGetMonotonicNow();
+#endif // SB_API_VERSION >= 10
data->window = FindWindow(x_button_event->window);
SB_DCHECK(SbWindowIsValid(data->window));
data->key = XButtonEventToSbKey(x_button_event);
@@ -1241,6 +1250,9 @@
XMotionEvent* x_motion_event = reinterpret_cast<XMotionEvent*>(x_event);
scoped_ptr<SbInputData> data(new SbInputData());
SbMemorySet(data.get(), 0, sizeof(*data));
+#if SB_API_VERSION >= 10
+ data->timestamp = SbTimeGetMonotonicNow();
+#endif // SB_API_VERSION >= 10
data->window = FindWindow(x_motion_event->window);
SB_DCHECK(SbWindowIsValid(data->window));
#if SB_API_VERSION >= 6