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 15:58:15 (GMT)
commit12f56ae9006b75e37365022065b786830b4a3038 (patch)
treee7477ce5e79081cfd48e0bd2fbfbc6ed28af899c /src/3rdparty
parenta1c7b42e8b67e935fe30310af49524a25fa631fc (diff)
downloadQt-12f56ae9006b75e37365022065b786830b4a3038.zip
Qt-12f56ae9006b75e37365022065b786830b4a3038.tar.gz
Qt-12f56ae9006b75e37365022065b786830b4a3038.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