Index: Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp |
=================================================================== |
--- Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp (revision 97678) |
+++ Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp (working copy) |
@@ -100,11 +100,10 @@ |
WebMediaPlayerClientImpl::~WebMediaPlayerClientImpl() |
{ |
- // VideoLayerChromium may outlive this object so make sure all frames are |
- // released. |
+ // VideoLayerChromium may outlive this object so clear the back pointer. |
#if USE(ACCELERATED_COMPOSITING) |
if (m_videoLayer.get()) |
- m_videoLayer->releaseCurrentFrame(); |
+ m_videoLayer->releaseProvider(); |
#endif |
} |
@@ -220,13 +219,6 @@ |
{ |
m_url = url; |
- // Video frame object is owned by WebMediaPlayer. Before destroying |
- // WebMediaPlayer all frames need to be released. |
-#if USE(ACCELERATED_COMPOSITING) |
- if (m_videoLayer.get()) |
- m_videoLayer->releaseCurrentFrame(); |
-#endif |
- |
if (m_preload == MediaPlayer::None) { |
m_webMediaPlayer.clear(); |
m_delayingLoad = true; |
@@ -577,23 +569,24 @@ |
VideoFrameChromium* WebMediaPlayerClientImpl::getCurrentFrame() |
{ |
- VideoFrameChromium* videoFrame = 0; |
- if (m_webMediaPlayer.get()) { |
+ ASSERT(!m_currentVideoFrame); |
+ if (m_webMediaPlayer && !m_currentVideoFrame) { |
WebVideoFrame* webkitVideoFrame = m_webMediaPlayer->getCurrentFrame(); |
if (webkitVideoFrame) |
- videoFrame = new VideoFrameChromiumImpl(webkitVideoFrame); |
+ m_currentVideoFrame = adoptPtr(new VideoFrameChromiumImpl(webkitVideoFrame)); |
} |
- return videoFrame; |
+ return m_currentVideoFrame.get(); |
} |
void WebMediaPlayerClientImpl::putCurrentFrame(VideoFrameChromium* videoFrame) |
{ |
- if (videoFrame) { |
+ if (videoFrame && videoFrame == m_currentVideoFrame) { |
if (m_webMediaPlayer.get()) { |
m_webMediaPlayer->putCurrentFrame( |
VideoFrameChromiumImpl::toWebVideoFrame(videoFrame)); |
} |
- delete videoFrame; |
+ ASSERT(videoFrame == m_currentVideoFrame); |
+ m_currentVideoFrame.clear(); |
} |
} |
#endif |