8000 Workaround for EVT_MEDIA_LOADED by cdoty · Pull Request #1830 · wxWidgets/wxWidgets · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Workaround for EVT_MEDIA_LOADED #1830

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Workaround for EVT_MEDIA_LOADED #1830

wants to merge 5 commits into from

Conversation

cdoty
Copy link
@cdoty cdoty commented Apr 30, 2020

This uses the stop event sent after a video is loaded to indicate it has completed loaded.

cdoty added 5 commits April 29, 2020 22:31
Workaround for EVT_MEDIA_LOADED issue.
Workaround for EVT_MEDIA_LOADED issue.
Removed incorrect commit.
Fixed m_bLoadEventSent flag.
Fixed flag.. for the final time.
Copy link
Contributor
@vadz vadz left a comment

Choose a reason for hiding this comment

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

I'm sorry, but this PR does a number of very non-obvious changes without any explanations, nor even instructions about reproducing the problem which it is supposed to fix. Could you please explain what's going on here? Without this we really can't do anything about it.

TIA!

@@ -1590,11 +1600,10 @@ void wxAMMediaEvtHandler::OnActiveX(wxActiveXEvent& event)
// size of the video (will error) - however on 4
// it won't play on downloaded things until it is
// completely downloaded so we use the lesser of two evils...
else if(event[0].GetInteger() == 3 &&
else if(event[0].GetInteger() >= 3 &&
Copy link
Contributor

Choose a reason for hiding this comment

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

The comment above explicitly says that we don't want to do it on 4, so at the very least it needs to be changed/updated to avoid confusion. But it's not clear at all whether you decided it wasn't the lesser evil, finally, or if you think this problem doesn't exist any more or something else. Please explain it.

Copy link
Author
@cdoty cdoty May 29, 2020

Choose a reason for hiding this comment

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

The problem was that the video wouldn't play if the load event is sent on 3. This is solved by in essence delaying the sending of the load event. When the video finished loading, the AM software sends a stop event. The "workaround" takes advantage of this and sends the finish load event if it's been triggered by receiving event 4.
To summarize, the FinishLoad has been broken down into a two part operation to avoid the problem with not being able to determine the video size, while still allowing event 4 to trigger the calling of FinishLoad. In the DirectShow backend, there is no notification when the video is fully loaded.

!m_bLoadEventSent)
{
m_bLoadEventSent = true;
m_amb->FinishLoad();
Copy link
Contributor

Choose a reason for hiding this comment

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

This really seems wrong, why are we setting m_bLoadEventSent to true if we're not actually sending the event?

Copy link
Author
@cdoty cdoty May 29, 2020

Choose a reason for hiding this comment

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

Calling m_amb->FinishLoad is sending the load event. The meaning of the flag has been changed to load event queued. m_bLoadEventSent could be renamed, to m_bLoadEventQueued, if that would improve the situation.

Comment on lines +1565 to +1567
m_bLoadEventSent = false;

m_amb->FinishLoad();
Copy link
Contributor

Choose a reason for hiding this comment

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

This just doesn't make sense, you seem to have changed the meaning of m_bLoadEventSent flag without changing its name nor the comments describing it. A flag with this name must be set to true, not false, when FinishLoad() is called.

Copy link
Author

Choose a reason for hiding this comment

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

Renaming m_bLoadEventSent to m_bLoadEventQueued would probably clear up the misunderstanding, but I wanted to fit the solution as closely as possible with the existing code base, changing as little as possible.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please update the PR to result in clear code and also add the comment(s) explaining what you wrote above?

Making as few changes as possible is certainly laudable, but it should be a secondary change, the primary ones should be to have correct and as simple/clear possible code.

TIA!

@vadz vadz added the work needed Too useful to close, but can't be applied in current state label May 3, 2020
@vadz
Copy link
Contributor
vadz commented Apr 30, 2025

This PR has been in "work needed" state for more than a year and will be closed soon. Please update it, e.g. by commenting here, if anybody intends to resume working on it.

@vadz
Copy link
Contributor
vadz commented May 10, 2025

If anybody is using wxMediaCtrl under Windows and can test this, it could probably be applied, but I don't, personally, and can't merge this without neither fully understanding the changes done here nor testing them. Please test this PR if anybody is interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
work needed Too useful to close, but can't be applied in current state
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0