summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-12-15 09:17:32 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-12-15 09:17:32 -0300
commitb12a2f456ccccae315426c7dd358bcec87112a0c (patch)
tree3017f2d5af49b85baa63703f29804b618953d350
parent4713bcccf3de5f8e0f577f29a67f38bfb8a99b57 (diff)
-fixes to theora video ending sooner than expected, fixes #3066
-rw-r--r--drivers/theora/video_stream_theora.cpp15
-rw-r--r--scene/gui/video_player.cpp3
2 files changed, 13 insertions, 5 deletions
diff --git a/drivers/theora/video_stream_theora.cpp b/drivers/theora/video_stream_theora.cpp
index fe248bc911..3fad19b476 100644
--- a/drivers/theora/video_stream_theora.cpp
+++ b/drivers/theora/video_stream_theora.cpp
@@ -504,6 +504,10 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
bool audio_pending = false;
+ bool no_vorbis=false;
+ bool no_theora=false;
+
+
while (vorbis_p) {
int ret;
float **pcm;
@@ -575,6 +579,7 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
}
} else { /* we need more data; break out to suck in another page */
//printf("need moar data\n");
+ no_vorbis=true;
break;
};
}
@@ -625,17 +630,19 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
/*If we are too slow, reduce the pp level.*/
pp_inc=pp_level>0?-1:0;
}
+ } else {
+
}
} else {
-
+ no_theora=true;
break;
}
}
#ifdef THEORA_USE_THREAD_STREAMING
- if (file && thread_eof && ring_buffer.data_left()==0) {
+ if (file && thread_eof && && (no_vorbis || no_theora) && ring_buffer.data_left()==0) {
#else
- if (file && /*!videobuf_ready && */ file->eof_reached()) {
+ if (file && /*!videobuf_ready && */ (no_vorbis || no_theora) && file->eof_reached()) {
#endif
printf("video done, stopping\n");
stop();
@@ -723,7 +730,7 @@ bool VideoStreamPlaybackTheora::is_playing() const {
void VideoStreamPlaybackTheora::set_paused(bool p_paused) {
- playing = !p_paused;
+ //pau = !p_paused;
};
bool VideoStreamPlaybackTheora::is_paused(bool p_paused) const {
diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp
index 22b19f50b2..58683a07ad 100644
--- a/scene/gui/video_player.cpp
+++ b/scene/gui/video_player.cpp
@@ -117,8 +117,9 @@ void VideoPlayer::_notification(int p_notification) {
case NOTIFICATION_ENTER_TREE: {
//set_idle_process(false); //don't annoy
- if (stream.is_valid() && autoplay && !get_tree()->is_editor_hint())
+ if (stream.is_valid() && autoplay && !get_tree()->is_editor_hint()) {
play();
+ }
} break;
case NOTIFICATION_PROCESS: {