Loading media/codec2/sfplugin/CCodecBuffers.cpp +1 −11 Original line number Original line Diff line number Diff line Loading @@ -1301,17 +1301,7 @@ RawGraphicOutputBuffers::RawGraphicOutputBuffers( sp<Codec2Buffer> RawGraphicOutputBuffers::wrap(const std::shared_ptr<C2Buffer> &buffer) { sp<Codec2Buffer> RawGraphicOutputBuffers::wrap(const std::shared_ptr<C2Buffer> &buffer) { if (buffer == nullptr) { if (buffer == nullptr) { sp<Codec2Buffer> c2buffer = ConstGraphicBlockBuffer::AllocateEmpty( return new Codec2Buffer(mFormat, new ABuffer(nullptr, 0)); mFormat, [lbp = mLocalBufferPool](size_t capacity) { return lbp->newBuffer(capacity); }); if (c2buffer == nullptr) { ALOGD("[%s] ConstGraphicBlockBuffer::AllocateEmpty failed", mName); return nullptr; } c2buffer->setRange(0, 0); return c2buffer; } else { } else { return ConstGraphicBlockBuffer::Allocate( return ConstGraphicBlockBuffer::Allocate( mFormat, mFormat, Loading media/codec2/sfplugin/tests/CCodecBuffers_test.cpp +13 −0 Original line number Original line Diff line number Diff line Loading @@ -106,6 +106,19 @@ TEST(RawGraphicOutputBuffersTest, ChangeNumSlots) { } } } } TEST(RawGraphicOutputBuffersTest, WrapNullBuffer) { constexpr int32_t kWidth = 320; constexpr int32_t kHeight = 240; std::shared_ptr<RawGraphicOutputBuffers> buffers = GetRawGraphicOutputBuffers(kWidth, kHeight); sp<Codec2Buffer> buffer = buffers->wrap(nullptr); ASSERT_EQ(nullptr, buffer->base()); ASSERT_EQ(0, buffer->size()); ASSERT_EQ(0, buffer->offset()); } TEST(RawGraphicOutputBuffersTest, FlexYuvColorFormat) { TEST(RawGraphicOutputBuffersTest, FlexYuvColorFormat) { constexpr int32_t kWidth = 320; constexpr int32_t kWidth = 320; constexpr int32_t kHeight = 240; constexpr int32_t kHeight = 240; Loading media/libmediaplayerservice/nuplayer/RTSPSource.cpp +7 −5 Original line number Original line Diff line number Diff line Loading @@ -145,15 +145,17 @@ void NuPlayer::RTSPSource::stop() { return; return; } } // Close socket before posting message to RTSPSource message handler. if (mHandler != NULL) { close(mHandler->getARTSPConnection()->getSocket()); } sp<AMessage> msg = new AMessage(kWhatDisconnect, this); sp<AMessage> msg = new AMessage(kWhatDisconnect, this); sp<AMessage> dummy; sp<AMessage> dummy; msg->postAndAwaitResponse(&dummy); msg->postAndAwaitResponse(&dummy); // Close socket after posting message to RTSPSource message handler. if (mHandler != NULL && mHandler->getARTSPConnection()->getSocket() >= 0) { ALOGD("closing rtsp socket if not closed yet."); close(mHandler->getARTSPConnection()->getSocket()); } } } status_t NuPlayer::RTSPSource::feedMoreTSData() { status_t NuPlayer::RTSPSource::feedMoreTSData() { Loading media/libstagefright/rtsp/APacketSource.cpp +11 −0 Original line number Original line Diff line number Diff line Loading @@ -594,4 +594,15 @@ sp<MetaData> APacketSource::getFormat() { return mFormat; return mFormat; } } bool APacketSource::isVideo() { bool isVideo = false; const char *mime; if (mFormat->findCString(kKeyMIMEType, &mime)) { isVideo = !strncasecmp(mime, "video/", 6); } return isVideo; } } // namespace android } // namespace android media/libstagefright/rtsp/APacketSource.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -33,6 +33,8 @@ struct APacketSource : public RefBase { virtual sp<MetaData> getFormat(); virtual sp<MetaData> getFormat(); bool isVideo(); protected: protected: virtual ~APacketSource(); virtual ~APacketSource(); Loading Loading
media/codec2/sfplugin/CCodecBuffers.cpp +1 −11 Original line number Original line Diff line number Diff line Loading @@ -1301,17 +1301,7 @@ RawGraphicOutputBuffers::RawGraphicOutputBuffers( sp<Codec2Buffer> RawGraphicOutputBuffers::wrap(const std::shared_ptr<C2Buffer> &buffer) { sp<Codec2Buffer> RawGraphicOutputBuffers::wrap(const std::shared_ptr<C2Buffer> &buffer) { if (buffer == nullptr) { if (buffer == nullptr) { sp<Codec2Buffer> c2buffer = ConstGraphicBlockBuffer::AllocateEmpty( return new Codec2Buffer(mFormat, new ABuffer(nullptr, 0)); mFormat, [lbp = mLocalBufferPool](size_t capacity) { return lbp->newBuffer(capacity); }); if (c2buffer == nullptr) { ALOGD("[%s] ConstGraphicBlockBuffer::AllocateEmpty failed", mName); return nullptr; } c2buffer->setRange(0, 0); return c2buffer; } else { } else { return ConstGraphicBlockBuffer::Allocate( return ConstGraphicBlockBuffer::Allocate( mFormat, mFormat, Loading
media/codec2/sfplugin/tests/CCodecBuffers_test.cpp +13 −0 Original line number Original line Diff line number Diff line Loading @@ -106,6 +106,19 @@ TEST(RawGraphicOutputBuffersTest, ChangeNumSlots) { } } } } TEST(RawGraphicOutputBuffersTest, WrapNullBuffer) { constexpr int32_t kWidth = 320; constexpr int32_t kHeight = 240; std::shared_ptr<RawGraphicOutputBuffers> buffers = GetRawGraphicOutputBuffers(kWidth, kHeight); sp<Codec2Buffer> buffer = buffers->wrap(nullptr); ASSERT_EQ(nullptr, buffer->base()); ASSERT_EQ(0, buffer->size()); ASSERT_EQ(0, buffer->offset()); } TEST(RawGraphicOutputBuffersTest, FlexYuvColorFormat) { TEST(RawGraphicOutputBuffersTest, FlexYuvColorFormat) { constexpr int32_t kWidth = 320; constexpr int32_t kWidth = 320; constexpr int32_t kHeight = 240; constexpr int32_t kHeight = 240; Loading
media/libmediaplayerservice/nuplayer/RTSPSource.cpp +7 −5 Original line number Original line Diff line number Diff line Loading @@ -145,15 +145,17 @@ void NuPlayer::RTSPSource::stop() { return; return; } } // Close socket before posting message to RTSPSource message handler. if (mHandler != NULL) { close(mHandler->getARTSPConnection()->getSocket()); } sp<AMessage> msg = new AMessage(kWhatDisconnect, this); sp<AMessage> msg = new AMessage(kWhatDisconnect, this); sp<AMessage> dummy; sp<AMessage> dummy; msg->postAndAwaitResponse(&dummy); msg->postAndAwaitResponse(&dummy); // Close socket after posting message to RTSPSource message handler. if (mHandler != NULL && mHandler->getARTSPConnection()->getSocket() >= 0) { ALOGD("closing rtsp socket if not closed yet."); close(mHandler->getARTSPConnection()->getSocket()); } } } status_t NuPlayer::RTSPSource::feedMoreTSData() { status_t NuPlayer::RTSPSource::feedMoreTSData() { Loading
media/libstagefright/rtsp/APacketSource.cpp +11 −0 Original line number Original line Diff line number Diff line Loading @@ -594,4 +594,15 @@ sp<MetaData> APacketSource::getFormat() { return mFormat; return mFormat; } } bool APacketSource::isVideo() { bool isVideo = false; const char *mime; if (mFormat->findCString(kKeyMIMEType, &mime)) { isVideo = !strncasecmp(mime, "video/", 6); } return isVideo; } } // namespace android } // namespace android
media/libstagefright/rtsp/APacketSource.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -33,6 +33,8 @@ struct APacketSource : public RefBase { virtual sp<MetaData> getFormat(); virtual sp<MetaData> getFormat(); bool isVideo(); protected: protected: virtual ~APacketSource(); virtual ~APacketSource(); Loading