Bug 990908 - Revert the change of bug 938512 and let the RTSP's code flow align to others. r=cpearce
authorBenjamin Chen <bechen@mozilla.com>
Thu, 24 Apr 2014 14:45:31 +0800
changeset 180654 8d160a730493b05033dea84c7583ae697d9f2ed6
parent 180653 819e836f1f73a0784398f8617ad665e493b6d141
child 180655 d3aaf927afb895ad0efffa5c41ba4e1219e93c53
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewerscpearce
bugs990908, 938512
milestone31.0a1
Bug 990908 - Revert the change of bug 938512 and let the RTSP's code flow align to others. r=cpearce
content/media/omx/OmxDecoder.cpp
content/media/omx/RtspOmxReader.cpp
content/media/omx/RtspOmxReader.h
--- a/content/media/omx/OmxDecoder.cpp
+++ b/content/media/omx/OmxDecoder.cpp
@@ -419,28 +419,16 @@ bool OmxDecoder::TryLoad() {
   // read video metadata
   if (mVideoSource.get() && !SetVideoFormat()) {
     NS_WARNING("Couldn't set OMX video format");
     return false;
   }
 
   // read audio metadata
   if (mAudioSource.get()) {
-    // For RTSP, we don't read the audio source for now.
-    // The metadata of RTSP will be obtained through SDP at connection time.
-    if (mResource->GetRtspPointer()) {
-      sp<MetaData> meta = mAudioSource->getFormat();
-      if (!meta->findInt32(kKeyChannelCount, &mAudioChannels) ||
-          !meta->findInt32(kKeySampleRate, &mAudioSampleRate)) {
-        NS_WARNING("Couldn't get audio metadata from OMX decoder");
-        return false;
-      }
-      return true;
-    }
-
     // To reliably get the channel and sample rate data we need to read from the
     // audio source until we get a INFO_FORMAT_CHANGE status
     status_t err = mAudioSource->read(&mAudioBuffer);
     if (err != INFO_FORMAT_CHANGED) {
       if (err != OK) {
         NS_WARNING("Couldn't read audio buffer from OMX decoder");
         return false;
       }
--- a/content/media/omx/RtspOmxReader.cpp
+++ b/content/media/omx/RtspOmxReader.cpp
@@ -298,21 +298,21 @@ nsresult RtspOmxReader::Seek(int64_t aTi
   // the seek time to OMX a/v decoders.
   return MediaOmxReader::Seek(aTime, aStartTime, aEndTime, aCurrentTime);
 }
 
 nsresult
 RtspOmxReader::ReadMetadata(MediaInfo* aInfo,
                             MetadataTags** aTags)
 {
+  SetActive();
+
   nsresult rv = MediaOmxReader::ReadMetadata(aInfo, aTags);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  SetActive();
-
   return NS_OK;
 }
 
 void RtspOmxReader::SetIdle() {
   // Call parent class to set OMXCodec idle.
   MediaOmxReader::SetIdle();
 
   // Need to pause RTSP streaming OMXCodec decoding.
--- a/content/media/omx/RtspOmxReader.h
+++ b/content/media/omx/RtspOmxReader.h
@@ -60,25 +60,16 @@ public:
   // we returned are not useful for the MediaDecodeStateMachine. Unlike the
   // ChannelMediaResource, it has a "cache" that can store the whole streaming
   // data so the |GetBuffered| function can retrieve useful time ranges.
   virtual nsresult GetBuffered(mozilla::dom::TimeRanges* aBuffered,
                                int64_t aStartTime) MOZ_FINAL MOZ_OVERRIDE {
     return NS_OK;
   }
 
-  // Override FindStartTime() to return null pointer.
-  // For Rtsp, we don't have the first video frame in DECODING_METADATA state.
-  // It will be available until player request Play() and media decoder enters
-  // DECODING state.
-  virtual VideoData* FindStartTime(int64_t& aOutStartTime)
-    MOZ_FINAL MOZ_OVERRIDE {
-    return nullptr;
-  }
-
   virtual void SetIdle() MOZ_OVERRIDE;
   virtual void SetActive() MOZ_OVERRIDE;
 
 private:
   // A pointer to RtspMediaResource for calling the Rtsp specific function.
   // The lifetime of mRtspResource is controlled by MediaDecoder. MediaDecoder
   // holds the MediaDecoderStateMachine and RtspMediaResource.
   // And MediaDecoderStateMachine holds this RtspOmxReader.