Skip to content

Commit

Permalink
[codec] Use SimpleDecodingSource for decoding on Android 7. Only work…
Browse files Browse the repository at this point in the history
…s for audio. JB#39144
  • Loading branch information
Andrew Branson committed Dec 5, 2017
1 parent 032d3fd commit 9cd19c7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions droidmediacodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <media/stagefright/OMXCodec.h>
#else
#include <media/hardware/MetadataBufferType.h>
#include <media/stagefright/SimpleDecodingSource.h>
#endif

#include <media/stagefright/MediaSource.h>
Expand Down Expand Up @@ -448,8 +449,7 @@ class DroidMediaCodecBuilder {
src,
NULL, flags(), window);
#else
// TODO - decoders for Android 7+
return NULL;
return android::SimpleDecodingSource::Create(src, flags(), window);
#endif
}

Expand Down Expand Up @@ -617,6 +617,12 @@ DroidMediaCodec *droid_media_codec_create(DroidMediaCodecBuilder& builder)
} else {
queue = new DroidMediaBufferQueue("DroidMediaCodecBufferQueue");
window = queue->window();
#if ANDROID_MAJOR >= 7
if (!queue->connectListener()) {
ALOGE("Failed to connect buffer queue listener");
return NULL;
#endif
}
}

#if ANDROID_MAJOR >= 5
Expand Down Expand Up @@ -664,10 +670,12 @@ DroidMediaCodec *droid_media_codec_create_encoder(DroidMediaCodecEncoderMetaData
bool droid_media_codec_start(DroidMediaCodec *codec)
{
if (codec->m_queue.get() != NULL) {
#if ANDROID_MAJOR < 7
if (!codec->m_queue->connectListener()) {
ALOGE("Failed to connect buffer queue listener");
return false;
}
#endif

android::status_t err = native_window_api_connect(codec->m_window.get(),
NATIVE_WINDOW_API_MEDIA);
Expand Down

0 comments on commit 9cd19c7

Please sign in to comment.