diff options
author | Gareth Stockwell <ext-gareth.stockwell@nokia.com> | 2010-04-14 19:45:58 (GMT) |
---|---|---|
committer | Gareth Stockwell <ext-gareth.stockwell@nokia.com> | 2010-04-15 05:40:14 (GMT) |
commit | 04c24781613a937c472c556391d738b6d563201d (patch) | |
tree | b348e70bcca112768272213da405c041c29749d3 /src/3rdparty | |
parent | 92ed8a1a049f60733ce15c4a5b79ed0fc389cfcd (diff) | |
download | Qt-04c24781613a937c472c556391d738b6d563201d.zip Qt-04c24781613a937c472c556391d738b6d563201d.tar.gz Qt-04c24781613a937c472c556391d738b6d563201d.tar.bz2 |
Phonon MMF: fixed crash during opening of video clip
A crash was observed during opening a video clip, and was traced
to dereferencing a null m_player pointer in
DsaVideoPlayer::handleParametersChanged(), which is called during
construction, but before createPlayer() has been called.
This was reproducible using the following sequence:
1. Launch qmediaplayer
2. Play an audio clip
3. Open a video clip
However, the following sequence worked as expected:
1. Launch qmediaplayer
2. Play a video clip
3. Play an audio clip
4. Play a video clip
...
It is not clear which commit introduced this defect.
Reviewed-by: Frans Englich
Diffstat (limited to 'src/3rdparty')
-rw-r--r-- | src/3rdparty/phonon/mmf/videoplayer_dsa.cpp | 60 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/videoplayer_surface.cpp | 55 |
2 files changed, 58 insertions, 57 deletions
diff --git a/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp b/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp index fbd8397..1925471 100644 --- a/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp +++ b/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp @@ -226,38 +226,40 @@ void MMF::DsaVideoPlayer::handleParametersChanged(VideoParameters parameters) getDsaRegion(m_wsSession, *m_window); #endif - static const TBool antialias = ETrue; - int err = KErrNone; - - if (parameters & ScaleFactors) { - TRAP(err, m_player->SetScaleFactorL(m_scaleWidth, m_scaleHeight, - antialias)); - if(KErrNone != err) { - TRACE("SetScaleFactorL (1) err %d", err); - setError(tr("Video display error"), err); + if (m_player) { + static const TBool antialias = ETrue; + int err = KErrNone; + + if (parameters & ScaleFactors) { + TRAP(err, m_player->SetScaleFactorL(m_scaleWidth, m_scaleHeight, + antialias)); + if(KErrNone != err) { + TRACE("SetScaleFactorL (1) err %d", err); + setError(tr("Video display error"), err); + } } - } - if (KErrNone == err) { - if (parameters & WindowHandle || parameters & WindowScreenRect) { - TRAP(err, - m_player->SetDisplayWindowL(m_wsSession, m_screenDevice, - *m_window, - m_videoScreenRect, - m_videoScreenRect)); - } + if (KErrNone == err) { + if (parameters & WindowHandle || parameters & WindowScreenRect) { + TRAP(err, + m_player->SetDisplayWindowL(m_wsSession, m_screenDevice, + *m_window, + m_videoScreenRect, + m_videoScreenRect)); + } - if (KErrNone != err) { - TRACE("SetDisplayWindowL err %d", err); - setError(tr("Video display error"), err); - } else { - m_dsaActive = true; - if (parameters & ScaleFactors) { - TRAP(err, m_player->SetScaleFactorL(m_scaleWidth, m_scaleHeight, - antialias)); - if (KErrNone != err) { - TRACE("SetScaleFactorL (2) err %d", err); - setError(tr("Video display error"), err); + if (KErrNone != err) { + TRACE("SetDisplayWindowL err %d", err); + setError(tr("Video display error"), err); + } else { + m_dsaActive = true; + if (parameters & ScaleFactors) { + TRAP(err, m_player->SetScaleFactorL(m_scaleWidth, m_scaleHeight, + antialias)); + if (KErrNone != err) { + TRACE("SetScaleFactorL (2) err %d", err); + setError(tr("Video display error"), err); + } } } } diff --git a/src/3rdparty/phonon/mmf/videoplayer_surface.cpp b/src/3rdparty/phonon/mmf/videoplayer_surface.cpp index 5f234e5..fda7342 100644 --- a/src/3rdparty/phonon/mmf/videoplayer_surface.cpp +++ b/src/3rdparty/phonon/mmf/videoplayer_surface.cpp @@ -104,44 +104,43 @@ void MMF::SurfaceVideoPlayer::handleVideoWindowChanged() void MMF::SurfaceVideoPlayer::handleParametersChanged(VideoParameters parameters) { - CVideoPlayerUtility2 *player = static_cast<CVideoPlayerUtility2 *>(m_player.data()); - - int err = KErrNone; - TRect rect; - if (m_videoOutput) { m_videoOutput->dump(); const QSize size = m_videoOutput->videoWindowSize(); rect.SetSize(TSize(size.width(), size.height())); } - 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; + CVideoPlayerUtility2 *player = static_cast<CVideoPlayerUtility2 *>(m_player.data()); + 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; } - m_displayWindow = window; - } - if (KErrNone == err) { - if (parameters & ScaleFactors) { - Q_ASSERT(m_displayWindow); - TRAP(err, player->SetVideoExtentL(*m_displayWindow, rect)); - if (KErrNone == err) - TRAP(err, player->SetWindowClipRectL(*m_displayWindow, rect)); - if (KErrNone == err) - TRAP(err, player->SetScaleFactorL(*m_displayWindow, m_scaleWidth, m_scaleHeight)); - if (KErrNone != err) - setError(tr("Video display error"), err); + if (KErrNone == err) { + if (parameters & ScaleFactors) { + Q_ASSERT(m_displayWindow); + TRAP(err, player->SetVideoExtentL(*m_displayWindow, rect)); + if (KErrNone == err) + TRAP(err, player->SetWindowClipRectL(*m_displayWindow, rect)); + if (KErrNone == err) + TRAP(err, player->SetScaleFactorL(*m_displayWindow, m_scaleWidth, m_scaleHeight)); + if (KErrNone != err) + setError(tr("Video display error"), err); + } } } } |