summaryrefslogtreecommitdiff
path: root/src/3rdparty
diff options
context:
space:
mode:
authorGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-06-08 16:06:37 +0100
committerGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-07-07 13:25:43 +0100
commit31d4037ad8e07fc4302a846271b28965f3e11069 (patch)
treeb258fa6a5d04ee484f34c192efedc1519efdd3cc /src/3rdparty
parent50fbb9d19b3f524361c146de8ff0fb2fe6abacc9 (diff)
downloadqt4-tools-31d4037ad8e07fc4302a846271b28965f3e11069.tar.gz
Fixed crash which occurs when switching between video clips
When Phonon::MediaObject::setCurrentSource() is called when the MediaObject is connected to a Phonon::VideoWidget, the MMF::AbstractVideoOutput pointer is propagated inside the backend from the first MMF::AbstractVideoPlayer to the second. If the VideoWidget is subsquently re-sized, the code path enters the ScaleFactors branch of the MMF::SurfaceVideoPlayer::handleParametersChanged function. At this point, m_displayWindow is still set to the inital null value, and the assertion therefore fails. This change ensures that m_displayWindow is updated before attempting to apply the scale factor change. Task-number: QTBUG-11377 Reviewed-by: Thierry Bastian
Diffstat (limited to 'src/3rdparty')
-rw-r--r--src/3rdparty/phonon/mmf/videoplayer_surface.cpp42
-rw-r--r--src/3rdparty/phonon/mmf/videoplayer_surface.h3
2 files changed, 32 insertions, 13 deletions
diff --git a/src/3rdparty/phonon/mmf/videoplayer_surface.cpp b/src/3rdparty/phonon/mmf/videoplayer_surface.cpp
index 5d8db268d0..343370c685 100644
--- a/src/3rdparty/phonon/mmf/videoplayer_surface.cpp
+++ b/src/3rdparty/phonon/mmf/videoplayer_surface.cpp
@@ -118,23 +118,14 @@ void MMF::SurfaceVideoPlayer::handleParametersChanged(VideoParameters parameters
if (player) {
int err = KErrNone;
if (parameters & WindowHandle) {
- if (m_displayWindow)
- player->RemoveDisplayWindow(*m_displayWindow);
-
- RWindow *window = static_cast<RWindow *>(m_window);
- if (window) {
- window->SetBackgroundColor(TRgb(0, 0, 0, 255));
- TRAP(err, player->AddDisplayWindowL(m_wsSession, m_screenDevice, *window, rect, rect));
- if (KErrNone != err) {
- setError(tr("Video display error"), err);
- window = 0;
- }
- }
- m_displayWindow = window;
+ removeDisplayWindow();
+ addDisplayWindow(rect);
}
if (KErrNone == err) {
if (parameters & ScaleFactors) {
+ if (!m_displayWindow)
+ addDisplayWindow(rect);
Q_ASSERT(m_displayWindow);
TRAP(err, player->SetVideoExtentL(*m_displayWindow, rect));
if (KErrNone == err)
@@ -148,5 +139,30 @@ void MMF::SurfaceVideoPlayer::handleParametersChanged(VideoParameters parameters
}
}
+void MMF::SurfaceVideoPlayer::addDisplayWindow(const TRect &rect)
+{
+ Q_ASSERT(!m_displayWindow);
+ RWindow *window = static_cast<RWindow *>(m_window);
+ if (window) {
+ window->SetBackgroundColor(TRgb(0, 0, 0, 255));
+ CVideoPlayerUtility2 *player = static_cast<CVideoPlayerUtility2 *>(m_player.data());
+ Q_ASSERT(player);
+ TRAPD(err, player->AddDisplayWindowL(m_wsSession, m_screenDevice, *window, rect, rect));
+ if (KErrNone == err)
+ m_displayWindow = window;
+ else
+ setError(tr("Video display error"), err);
+ }
+}
+
+void MMF::SurfaceVideoPlayer::removeDisplayWindow()
+{
+ CVideoPlayerUtility2 *player = static_cast<CVideoPlayerUtility2 *>(m_player.data());
+ if (player && m_displayWindow) {
+ player->RemoveDisplayWindow(*m_displayWindow);
+ m_displayWindow = 0;
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/videoplayer_surface.h b/src/3rdparty/phonon/mmf/videoplayer_surface.h
index c05da9ca70..8572fdc6ba 100644
--- a/src/3rdparty/phonon/mmf/videoplayer_surface.h
+++ b/src/3rdparty/phonon/mmf/videoplayer_surface.h
@@ -62,6 +62,9 @@ private:
void handleVideoWindowChanged();
void handleParametersChanged(VideoParameters parameters);
+ void addDisplayWindow(const TRect &rect);
+ void removeDisplayWindow();
+
private:
// Window handle which has been passed to the MMF via
// CVideoPlayerUtility2::SetDisplayWindowL