[video_player] Add missing mutex (#24)
This commit is contained in:
committed by
GitHub
parent
dd294a8803
commit
ee9630877a
@@ -1,3 +1,7 @@
|
||||
## 0.9.3
|
||||
* Improve the error handling.
|
||||
* Add the missing mutex.
|
||||
|
||||
## 0.9.2
|
||||
* 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
|
||||
// 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);
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(mutex_event_completed_);
|
||||
if (is_completed_) {
|
||||
is_completed_ = false;
|
||||
lock.unlock();
|
||||
|
||||
stream_handler_->OnNotifyCompleted();
|
||||
if (auto_repeat_) {
|
||||
SetSeek(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -382,6 +387,7 @@ GstBusSyncReply GstVideoPlayer::HandleGstMessage(GstBus* bus,
|
||||
switch (GST_MESSAGE_TYPE(message)) {
|
||||
case GST_MESSAGE_EOS: {
|
||||
auto* self = reinterpret_cast<GstVideoPlayer*>(user_data);
|
||||
std::lock_guard<std::mutex> lock(self->mutex_event_completed_);
|
||||
self->is_completed_ = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ class GstVideoPlayer {
|
||||
bool mute_ = false;
|
||||
bool auto_repeat_ = false;
|
||||
bool is_completed_ = false;
|
||||
std::mutex mutex_event_completed_;
|
||||
std::shared_mutex mutex_buffer_;
|
||||
std::unique_ptr<VideoPlayerStreamHandler> stream_handler_;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: video_player_elinux
|
||||
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
|
||||
repository: https://github.com/sony/flutter-elinux-plugins/tree/main/packages/video_player/video_player
|
||||
|
||||
|
||||
Reference in New Issue
Block a user