summaryrefslogtreecommitdiffstats
path: root/src/3rdparty
diff options
context:
space:
mode:
authorGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-06-08 15:06:37 (GMT)
committerGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-07-07 12:25:43 (GMT)
commit31d4037ad8e07fc4302a846271b28965f3e11069 (patch)
treeb258fa6a5d04ee484f34c192efedc1519efdd3cc /src/3rdparty
parent50fbb9d19b3f524361c146de8ff0fb2fe6abacc9 (diff)
downloadQt-31d4037ad8e07fc4302a846271b28965f3e11069.zip
Qt-31d4037ad8e07fc4302a846271b28965f3e11069.tar.gz
Qt-31d4037ad8e07fc4302a846271b28965f3e11069.tar.bz2
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 5d8db26..343370c 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 c05da9c..8572fdc 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