[video_player] Add missing mutex (#24)
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
## 0.9.3
|
||||||
|
* Improve the error handling.
|
||||||
|
* Add the missing mutex.
|
||||||
|
|
||||||
## 0.9.2
|
## 0.9.2
|
||||||
* Changed to send stream completed messages from main thread.
|
* Changed to send stream completed messages from main thread.
|
||||||
|
|
||||||
|
|||||||
@@ -155,11 +155,16 @@ int64_t GstVideoPlayer::GetCurrentPosition() {
|
|||||||
// received from GStreamer cannot be processed directly in a callback
|
// received from GStreamer cannot be processed directly in a callback
|
||||||
// function. This is because the event channel message of playback complettion
|
// function. This is because the event channel message of playback complettion
|
||||||
// needs to be thrown in the main thread.
|
// needs to be thrown in the main thread.
|
||||||
if (is_completed_) {
|
{
|
||||||
is_completed_ = false;
|
std::unique_lock<std::mutex> lock(mutex_event_completed_);
|
||||||
stream_handler_->OnNotifyCompleted();
|
if (is_completed_) {
|
||||||
if (auto_repeat_) {
|
is_completed_ = false;
|
||||||
SetSeek(0);
|
lock.unlock();
|
||||||
|
|
||||||
|
stream_handler_->OnNotifyCompleted();
|
||||||
|
if (auto_repeat_) {
|
||||||
|
SetSeek(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,6 +387,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);
|
||||||
|
std::lock_guard<std::mutex> lock(self->mutex_event_completed_);
|
||||||
self->is_completed_ = true;
|
self->is_completed_ = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ class GstVideoPlayer {
|
|||||||
bool mute_ = false;
|
bool mute_ = false;
|
||||||
bool auto_repeat_ = false;
|
bool auto_repeat_ = false;
|
||||||
bool is_completed_ = false;
|
bool is_completed_ = false;
|
||||||
|
std::mutex mutex_event_completed_;
|
||||||
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.2
|
version: 0.9.3
|
||||||
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