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

Fix 30 tests from PlayerComponentsTests testcase in player_filter_tests. #585

Merged
merged 2 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,7 @@ class PlayerComponentsTest
// working.
void RenderAndProcessPendingJobs() {
// Call GetCurrentDecodeTarget() periodically for decode to texture mode.
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment can be removed or changed since it's not longer limited to just decode to texture mode

Copy link
Collaborator Author

@v-kryachko v-kryachko Jun 16, 2023

Choose a reason for hiding this comment

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

Fixed in commit 6162a2b

Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: The commit message of the 2nd commit is the same as the first. The commit message should convey the contents on the commit. In this case it could be e.g. "Fix outdated comment"

if (output_mode_ == kSbPlayerOutputModeDecodeToTexture &&
GetVideoRenderer()) {
if (GetVideoRenderer()) {
#if SB_HAS(GLES2)
fake_graphics_context_provider_.RunOnGlesContextThread(
std::bind(&PlayerComponentsTest::RenderOnGlesContextThread, this));
Expand Down Expand Up @@ -441,7 +440,11 @@ class PlayerComponentsTest
}

void RenderOnGlesContextThread() {
SbDecodeTargetRelease(GetVideoRenderer()->GetCurrentDecodeTarget());
if (output_mode_ == kSbPlayerOutputModeDecodeToTexture) {
SbDecodeTargetRelease(GetVideoRenderer()->GetCurrentDecodeTarget());
} else {
fake_graphics_context_provider_.Render();
}
}

bool TryToWriteOneInputBuffer(SbTime max_timestamp) {
Expand Down
11 changes: 11 additions & 0 deletions starboard/testing/fake_graphics_context_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@

#define EGL_CALL_SIMPLE(x) (EGL_CALL_PREFIX x)

#define GL_CALL(x) \
do { \
SbGetGlesInterface()->x; \
SB_DCHECK((SbGetGlesInterface()->glGetError()) == SB_GL_NO_ERROR); \
} while (false)

namespace starboard {
namespace testing {

Expand Down Expand Up @@ -291,6 +297,11 @@ void FakeGraphicsContextProvider::MakeNoContextCurrent() {
eglMakeCurrent(display_, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
}

void FakeGraphicsContextProvider::Render() {
GL_CALL(glClear(SB_GL_COLOR_BUFFER_BIT));
EGL_CALL(eglSwapBuffers(display_, surface_));
}

void FakeGraphicsContextProvider::DestroyContext() {
MakeNoContextCurrent();
EGL_CALL_SIMPLE(eglDestroyContext(display_, context_));
Expand Down
2 changes: 2 additions & 0 deletions starboard/testing/fake_graphics_context_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class FakeGraphicsContextProvider {
void ReleaseDecodeTarget(SbDecodeTarget decode_target);
#endif // SB_HAS(GLES2)

void Render();

private:
#if SB_HAS(GLES2)
static void* ThreadEntryPoint(void* context);
Expand Down