diff --git a/content/media/omx/OmxDecoder.cpp b/content/media/omx/OmxDecoder.cpp index 0ac1ae3869e4..5ce86774dcb9 100644 --- a/content/media/omx/OmxDecoder.cpp +++ b/content/media/omx/OmxDecoder.cpp @@ -421,6 +421,18 @@ bool OmxDecoder::TryLoad() { // 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 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); diff --git a/content/media/omx/RtspOmxReader.h b/content/media/omx/RtspOmxReader.h index be4c4de54313..399ab74bf6a4 100644 --- a/content/media/omx/RtspOmxReader.h +++ b/content/media/omx/RtspOmxReader.h @@ -62,6 +62,15 @@ public: 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; + } + private: // A pointer to RtspMediaResource for calling the Rtsp specific function. // The lifetime of mRtspResource is controlled by MediaDecoder. MediaDecoder