Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1e1bc0ab authored by Kris Alder's avatar Kris Alder Committed by Automerger Merge Worker
Browse files

Merge "Remove libcrypto dependency when building com.android.media" am: 853ef5c8

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/1336079

Change-Id: I46d260aaa9ba6b8a5179af602021cdfee38cc9ac
parents 2bd44cef 853ef5c8
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -12,7 +12,6 @@ cc_library {
    shared_libs: [
    shared_libs: [
        "libcgrouprc#29",
        "libcgrouprc#29",
        "libvndksupport#29",
        "libvndksupport#29",
        "libcrypto",
    ],
    ],


    header_libs: [
    header_libs: [
+11 −1
Original line number Original line Diff line number Diff line
@@ -36,6 +36,10 @@
#include <inttypes.h>
#include <inttypes.h>
#include <netinet/in.h>
#include <netinet/in.h>


#ifndef __ANDROID_APEX__
#include "HlsSampleDecryptor.h"
#endif

namespace android {
namespace android {


ElementaryStreamQueue::ElementaryStreamQueue(Mode mode, uint32_t flags)
ElementaryStreamQueue::ElementaryStreamQueue(Mode mode, uint32_t flags)
@@ -50,7 +54,13 @@ ElementaryStreamQueue::ElementaryStreamQueue(Mode mode, uint32_t flags)


    // Create the decryptor anyway since we don't know the use-case unless key is provided
    // Create the decryptor anyway since we don't know the use-case unless key is provided
    // Won't decrypt if key info not available (e.g., scanner/extractor just parsing ts files)
    // Won't decrypt if key info not available (e.g., scanner/extractor just parsing ts files)
    mSampleDecryptor = isSampleEncrypted() ? new HlsSampleDecryptor : NULL;
    mSampleDecryptor = isSampleEncrypted() ?
#ifdef __ANDROID_APEX__
        new SampleDecryptor
#else
        new HlsSampleDecryptor
#endif
        : NULL;
}
}


sp<MetaData> ElementaryStreamQueue::getFormat() {
sp<MetaData> ElementaryStreamQueue::getFormat() {
+2 −2
Original line number Original line Diff line number Diff line
@@ -25,7 +25,7 @@
#include <utils/RefBase.h>
#include <utils/RefBase.h>
#include <vector>
#include <vector>


#include "HlsSampleDecryptor.h"
#include "SampleDecryptor.h"


namespace android {
namespace android {


@@ -109,7 +109,7 @@ private:


    sp<MetaData> mFormat;
    sp<MetaData> mFormat;


    sp<HlsSampleDecryptor> mSampleDecryptor;
    sp<SampleDecryptor> mSampleDecryptor;
    int mAUIndex;
    int mAUIndex;


    bool isSampleEncrypted() const {
    bool isSampleEncrypted() const {
+10 −8
Original line number Original line Diff line number Diff line
@@ -14,9 +14,9 @@
 * limitations under the License.
 * limitations under the License.
 */
 */


#ifndef SAMPLE_AES_PROCESSOR_H_
#ifndef HLS_SAMPLE_AES_PROCESSOR_H_


#define SAMPLE_AES_PROCESSOR_H_
#define HLS_SAMPLE_AES_PROCESSOR_H_


#include <media/stagefright/foundation/AMessage.h>
#include <media/stagefright/foundation/AMessage.h>
#include <media/stagefright/foundation/AString.h>
#include <media/stagefright/foundation/AString.h>
@@ -28,18 +28,20 @@
#include <utils/RefBase.h>
#include <utils/RefBase.h>
#include <utils/Vector.h>
#include <utils/Vector.h>


#include "SampleDecryptor.h"

namespace android {
namespace android {


struct HlsSampleDecryptor : RefBase {
struct HlsSampleDecryptor : SampleDecryptor {


    HlsSampleDecryptor();
    HlsSampleDecryptor();
    explicit HlsSampleDecryptor(const sp<AMessage> &sampleAesKeyItem);
    explicit HlsSampleDecryptor(const sp<AMessage> &sampleAesKeyItem);


    void signalNewSampleAesKey(const sp<AMessage> &sampleAesKeyItem);
    virtual void signalNewSampleAesKey(const sp<AMessage> &sampleAesKeyItem);


    size_t processNal(uint8_t *nalData, size_t nalSize);
    virtual size_t processNal(uint8_t *nalData, size_t nalSize);
    void processAAC(size_t adtsHdrSize, uint8_t *data, size_t size);
    virtual void processAAC(size_t adtsHdrSize, uint8_t *data, size_t size);
    void processAC3(uint8_t *data, size_t size);
    virtual void processAC3(uint8_t *data, size_t size);


    static AString aesBlockToStr(uint8_t block[AES_BLOCK_SIZE]);
    static AString aesBlockToStr(uint8_t block[AES_BLOCK_SIZE]);


@@ -60,4 +62,4 @@ private:


}  // namespace android
}  // namespace android


#endif // SAMPLE_AES_PROCESSOR_H_
#endif // HLS_SAMPLE_AES_PROCESSOR_H_
+44 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef SAMPLE_AES_PROCESSOR_H_

#define SAMPLE_AES_PROCESSOR_H_

#include <media/stagefright/foundation/AMessage.h>

#include <utils/RefBase.h>

namespace android {

// Base class of HlsSampleDecryptor which has dummy default implementation.
struct SampleDecryptor : RefBase {

    SampleDecryptor() { };

    virtual void signalNewSampleAesKey(const sp<AMessage> &) { };

    virtual size_t processNal(uint8_t *, size_t) { return -1; };
    virtual void processAAC(size_t, uint8_t *, size_t) { };
    virtual void processAC3(uint8_t *, size_t) { };

private:
    DISALLOW_EVIL_CONSTRUCTORS(SampleDecryptor);
};

}  // namespace android

#endif // SAMPLE_AES_PROCESSOR_H_