Bug 964209 - [RTSP] Implement flags() function and set mExtractor to fix content process crash. r=sworkman
authorBenjamin Chen <bechen@mozilla.com>
Fri, 07 Feb 2014 15:46:26 +0800
changeset 167851 db980acda4f1cdef680b71e00eb1d18d01e2975a
parent 167850 5f8d42207dfdb4f71ed97a7761bde10944dfc21a
child 167852 727a68ceca5c592212f3bdd22e7ed027a44756f3
push id26190
push userryanvm@gmail.com
push dateMon, 10 Feb 2014 20:37:53 +0000
treeherdermozilla-central@07739c5c874f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssworkman
bugs964209
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 964209 - [RTSP] Implement flags() function and set mExtractor to fix content process crash. r=sworkman
content/media/omx/RtspOmxReader.cpp
--- a/content/media/omx/RtspOmxReader.cpp
+++ b/content/media/omx/RtspOmxReader.cpp
@@ -169,16 +169,17 @@ status_t RtspMediaSource::read(MediaBuff
 class RtspExtractor: public MediaExtractor
 {
 public:
   virtual size_t countTracks() MOZ_FINAL MOZ_OVERRIDE;
   virtual sp<android::MediaSource> getTrack(size_t index)
     MOZ_FINAL MOZ_OVERRIDE;
   virtual sp<MetaData> getTrackMetaData(
     size_t index, uint32_t flag = 0) MOZ_FINAL MOZ_OVERRIDE;
+  virtual uint32_t flags() const MOZ_FINAL MOZ_OVERRIDE;
 
   RtspExtractor(RtspMediaResource *aResource)
     : mRtspResource(aResource) {
     MOZ_COUNT_CTOR(RtspExtractor);
     MOZ_ASSERT(aResource);
     mController = mRtspResource->GetMediaStreamController();
     MOZ_ASSERT(mController);
   }
@@ -251,25 +252,34 @@ sp<MetaData> RtspExtractor::getTrackMeta
     rtspMetadata->GetAvccData(tempCString);
     if (tempCString.Length()) {
       meta->setData(kKeyAVCC, 0, tempCString.get(), tempCString.Length());
     }
   }
   return meta;
 }
 
+uint32_t RtspExtractor::flags() const
+{
+  if (mRtspResource->IsRealTime()) {
+    return 0;
+  } else {
+    return MediaExtractor::CAN_SEEK;
+  }
+}
+
 nsresult RtspOmxReader::InitOmxDecoder()
 {
   if (!mOmxDecoder.get()) {
     NS_ASSERTION(mDecoder, "RtspOmxReader mDecoder is null.");
     NS_ASSERTION(mDecoder->GetResource(),
                  "RtspOmxReader mDecoder->GetResource() is null.");
-    sp<MediaExtractor> extractor = new RtspExtractor(mRtspResource);
+    mExtractor = new RtspExtractor(mRtspResource);
     mOmxDecoder = new OmxDecoder(mDecoder->GetResource(), mDecoder);
-    if (!mOmxDecoder->Init(extractor)) {
+    if (!mOmxDecoder->Init(mExtractor)) {
       return NS_ERROR_FAILURE;
     }
   }
   return NS_OK;
 }
 
 nsresult RtspOmxReader::Seek(int64_t aTime, int64_t aStartTime,
                              int64_t aEndTime, int64_t aCurrentTime)