Changed to send completed event message from main thread (#22)
I changed to send the completed event messages from main thread to avoid flutter engine's fml checker error.
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
## 0.9.2
|
||||||
|
* Changed to send stream completed messages from main thread.
|
||||||
|
|
||||||
## 0.9.1
|
## 0.9.1
|
||||||
* Temporarily disable auto-repeat.
|
* Temporarily disable auto-repeat.
|
||||||
* Update the elinux template of the example app.
|
* Update the elinux template of the example app.
|
||||||
|
|||||||
@@ -141,6 +141,20 @@ int64_t GstVideoPlayer::GetCurrentPosition() {
|
|||||||
if (!gst_element_query_position(gst_.pipeline, GST_FORMAT_TIME, &position)) {
|
if (!gst_element_query_position(gst_.pipeline, GST_FORMAT_TIME, &position)) {
|
||||||
std::cerr << "Failed to get current position" << std::endl;
|
std::cerr << "Failed to get current position" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: We need to handle this code in the proper plase.
|
||||||
|
// The VideoPlayer plugin doesn't have a main loop, so EOS message
|
||||||
|
// received from GStreamer cannot be processed directly in a callback
|
||||||
|
// function. This is because the event channel message of playback complettion
|
||||||
|
// needs to be thrown in the main thread.
|
||||||
|
if (is_completed_) {
|
||||||
|
is_completed_ = false;
|
||||||
|
stream_handler_->OnNotifyCompleted();
|
||||||
|
if (auto_repeat_) {
|
||||||
|
SetSeek(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return position / GST_MSECOND;
|
return position / GST_MSECOND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,15 +374,7 @@ GstBusSyncReply GstVideoPlayer::HandleGstMessage(GstBus* bus,
|
|||||||
switch (GST_MESSAGE_TYPE(message)) {
|
switch (GST_MESSAGE_TYPE(message)) {
|
||||||
case GST_MESSAGE_EOS: {
|
case GST_MESSAGE_EOS: {
|
||||||
auto* self = reinterpret_cast<GstVideoPlayer*>(user_data);
|
auto* self = reinterpret_cast<GstVideoPlayer*>(user_data);
|
||||||
// TODO: Support auto repeat. If the following is enabled,
|
self->is_completed_ = true;
|
||||||
// the app will freeze when playback is completed. We need to investigate
|
|
||||||
// the correct auto-repeat method.
|
|
||||||
#if 0
|
|
||||||
if (self->auto_repeat_) {
|
|
||||||
self->SetSeek(0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
self->stream_handler_->OnNotifyCompleted();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GST_MESSAGE_WARNING: {
|
case GST_MESSAGE_WARNING: {
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ class GstVideoPlayer {
|
|||||||
double playback_rate_ = 1.0;
|
double playback_rate_ = 1.0;
|
||||||
bool mute_ = false;
|
bool mute_ = false;
|
||||||
bool auto_repeat_ = false;
|
bool auto_repeat_ = false;
|
||||||
|
bool is_completed_ = false;
|
||||||
std::shared_mutex mutex_buffer_;
|
std::shared_mutex mutex_buffer_;
|
||||||
std::unique_ptr<VideoPlayerStreamHandler> stream_handler_;
|
std::unique_ptr<VideoPlayerStreamHandler> stream_handler_;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name: video_player_elinux
|
name: video_player_elinux
|
||||||
description: Flutter plugin for displaying inline video with other Flutter widgets on Embedded Linux.
|
description: Flutter plugin for displaying inline video with other Flutter widgets on Embedded Linux.
|
||||||
version: 0.9.1
|
version: 0.9.2
|
||||||
homepage: https://github.com/sony/flutter-elinux-plugins
|
homepage: https://github.com/sony/flutter-elinux-plugins
|
||||||
repository: https://github.com/sony/flutter-elinux-plugins/tree/main/packages/video_player/video_player
|
repository: https://github.com/sony/flutter-elinux-plugins/tree/main/packages/video_player/video_player
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user