Bug#616422: please backport an upstream fix for busy CPU to squeeze gnash
Package: gnash
Version: 0.8.8-9
Severity: important
Tags: patch
commit 0d5cea87446e84e2e9f4bb4ddc4541f7d2824c71 upstream
>From 0d5cea87446e84e2e9f4bb4ddc4541f7d2824c71 Mon Sep 17 00:00:00 2001
From: Bastiaan Jacques <bastiaan@bjacques.org>
Date: Sat, 19 Feb 2011 01:24:20 +0100
Subject: [PATCH] Don't busy the CPU trying to use a bad stream.
---
libmedia/gst/MediaParserGst.cpp | 26 ++++++++++----------------
1 files changed, 10 insertions(+), 16 deletions(-)
diff --git a/libmedia/gst/MediaParserGst.cpp b/libmedia/gst/MediaParserGst.cpp
index ce6441a..2778ae2 100644
--- a/libmedia/gst/MediaParserGst.cpp
+++ b/libmedia/gst/MediaParserGst.cpp
@@ -74,7 +74,7 @@ MediaParserGst::MediaParserGst(std::auto_ptr<IOChannel> stream)
SimpleTimer timer;
size_t counter = 0;
- while (!probingConditionsMet(timer)) {
+ while (!probingConditionsMet(timer) && !_stream->eof() && !_stream->bad()) {
if (!pushGstBuffer()) {
++counter;
@@ -141,7 +141,7 @@ MediaParserGst::parseNextChunk()
// FIXME: our caller check for _parsingComplete prior
// to call parseNextChunk
- if (_stream->eof()) {
+ if (_stream->eof() || _stream->bad()) {
//log_debug (_("Stream EOF, emitting!"));
_parsingComplete = true;
return false;
@@ -174,24 +174,18 @@ MediaParserGst::pushGstBuffer()
std::streamoff ret = _stream->read(GST_BUFFER_DATA(buffer), PUSHBUF_SIZE);
- if (ret == 0) {
- if (!_stream->eof()) {
- log_error(_("MediaParserGst failed to read the stream, but did not "
- "reach EOF!"));
+ if (ret < PUSHBUF_SIZE) {
+ if (!_stream->eof() && !_stream->bad()) {
+ log_error(_("MediaParserGst failed to read the stream, but it did"
+ " not reach EOF or enter a bad state."));
} else {
_parsingComplete = true;
}
- gst_buffer_unref(buffer);
- return false;
- }
- if (ret < PUSHBUF_SIZE) {
- if (!_stream->eof()) {
- log_error(_("MediaParserGst failed to read the stream, but did not "
- "reach EOF!"));
- } else {
- _parsingComplete = true;
- }
+ if (!ret) {
+ gst_buffer_unref(buffer);
+ return false;
+ }
GST_BUFFER_SIZE(buffer) = ret;
}
--
1.7.4.1
I didn't check how the patch applies to squeeze, but we do definitely
see high CPU usage by gnash in our labs' daily usage.
people get used to killall -9 gnash as a "fix".
The patch seems trivial enough as backport candidate.
thank you
--
maks
-- System Information:
Debian Release: wheezy/sid
APT prefers testing
APT policy: (900, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.37-trunk-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages gnash depends on:
ii gnash-common 0.8.8-9 GNU Shockwave Flash (SWF) player -
ii libc6 2.11.2-11 Embedded GNU C Library: Shared lib
ii libcairo2 1.8.10-6 The Cairo 2D vector graphics libra
ii libgcc1 1:4.5.0-5 GCC support library
ii libgl1-mesa-glx [libgl1] 7.7.1-4 A free implementation of the OpenG
ii libglib2.0-0 2.28.1-1+b1 The GLib library of C routines
ii libgtk2.0-0 2.20.1-2 The GTK+ graphical user interface
ii libgtkglext1 1.2.0-1.1 OpenGL Extension to GTK+ (shared l
ii libstdc++6 4.5.0-5 The GNU Standard C++ Library v3
ii libx11-6 2:1.4.1-5 X11 client-side library
gnash recommends no packages.
gnash suggests no packages.
-- debconf-show failed
Reply to: