Crash in WebCore::MediaSourcePrivateAVFObjC::hasAudio const + 13
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Jan 2014 19:19:44 +0000 (19:19 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Jan 2014 19:19:44 +0000 (19:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=126768

Reviewed by Eric Carlson.

Null-check m_mediaSourcePrivate before calling.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::hasVideo):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::hasAudio):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@161987 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm

index 2aa8eee..d10f239 100644 (file)
@@ -1,3 +1,17 @@
+2014-01-10  Jer Noble  <jer.noble@apple.com>
+
+        Crash in WebCore::MediaSourcePrivateAVFObjC::hasAudio const + 13
+        https://bugs.webkit.org/show_bug.cgi?id=126768
+
+        Reviewed by Eric Carlson.
+
+        Null-check m_mediaSourcePrivate before calling.
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::hasVideo):
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::hasAudio):
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal):
+
 2014-01-14  Piotr Grad  <p.grad@samsung.com>
 
         [GStreamer] Playback rate is not set when pipeline is not ready.
index cd74dc8..4c16504 100644 (file)
@@ -308,11 +308,17 @@ IntSize MediaPlayerPrivateMediaSourceAVFObjC::naturalSize() const
 
 bool MediaPlayerPrivateMediaSourceAVFObjC::hasVideo() const
 {
+    if (!m_mediaSourcePrivate)
+        return false;
+
     return m_mediaSourcePrivate->hasVideo();
 }
 
 bool MediaPlayerPrivateMediaSourceAVFObjC::hasAudio() const
 {
+    if (!m_mediaSourcePrivate)
+        return false;
+
     return m_mediaSourcePrivate->hasAudio();
 }
 
@@ -349,7 +355,7 @@ void MediaPlayerPrivateMediaSourceAVFObjC::seekWithTolerance(double time, double
 
 void MediaPlayerPrivateMediaSourceAVFObjC::seekInternal(double time, double negativeThreshold, double positiveThreshold)
 {
-    MediaTime seekTime = m_mediaSourcePrivate->seekToTime(MediaTime::createWithDouble(time), MediaTime::createWithDouble(positiveThreshold), MediaTime::createWithDouble(negativeThreshold));
+    MediaTime seekTime = m_mediaSourcePrivate ? m_mediaSourcePrivate->seekToTime(MediaTime::createWithDouble(time), MediaTime::createWithDouble(positiveThreshold), MediaTime::createWithDouble(negativeThreshold)) : MediaTime::zeroTime();
 
     [m_synchronizer setRate:(m_playing ? m_rate : 0) time:toCMTime(seekTime)];
 }