Bug 803471 - Part 2 - Use OmxClient in OmxDecoder. r=cdouble

This commit is contained in:
Sotaro Ikeda 2013-03-08 14:43:32 -05:00
parent 40f06f1db2
commit f598af80f7
2 changed files with 11 additions and 15 deletions

View File

@ -8,11 +8,10 @@
#include "base/basictypes.h"
#include <cutils/properties.h>
#include <stagefright/DataSource.h>
#include <stagefright/MediaExtractor.h>
#include <stagefright/MetaData.h>
#include <stagefright/OMXClient.h>
#include <stagefright/OMXCodec.h>
#include <OMX.h>
#include "mozilla/Preferences.h"
#include "mozilla/Types.h"
@ -170,14 +169,6 @@ public:
}
};
static sp<IOMX> sOMX = nullptr;
static sp<IOMX> GetOMX() {
if(sOMX.get() == nullptr) {
sOMX = new OMX;
}
return sOMX;
}
bool OmxDecoder::Init() {
#ifdef PR_LOGGING
if (!gOmxDecoderLog) {
@ -237,6 +228,13 @@ bool OmxDecoder::Init() {
mNativeWindow = new GonkNativeWindow();
// OMXClient::connect() always returns OK and abort's fatally if
// it can't connect.
OMXClient client;
status_t err = client.connect();
NS_ASSERTION(err == OK, "Failed to connect to OMX in mediaserver.");
sp<IOMX> omx = client.interface();
sp<MediaSource> videoTrack;
sp<MediaSource> videoSource;
if (videoTrackIndex != -1 && (videoTrack = extractor->getTrack(videoTrackIndex)) != nullptr) {
@ -246,7 +244,7 @@ bool OmxDecoder::Init() {
// for (h.264). So if we don't get a hardware decoder, just give
// up.
int flags = kHardwareCodecsOnly;
videoSource = OMXCodec::Create(GetOMX(),
videoSource = OMXCodec::Create(omx,
videoTrack->getFormat(),
false, // decoder
videoTrack,
@ -296,7 +294,7 @@ bool OmxDecoder::Init() {
if (!strcasecmp(audioMime, "audio/raw")) {
audioSource = audioTrack;
} else {
audioSource = OMXCodec::Create(GetOMX(),
audioSource = OMXCodec::Create(omx,
audioTrack->getFormat(),
false, // decoder
audioTrack);

View File

@ -1,7 +1,5 @@
#include <OMX.h>
#include <stagefright/MediaSource.h>
#include <stagefright/DataSource.h>
#include <stagefright/MediaSource.h>
#include <utils/RefBase.h>
#include "GonkNativeWindow.h"