Bug 1041346 - Remove MediaBufferGroup from libstagefright, since it's no longer used. r=kentuckyfriedtakahe

This commit is contained in:
Chris Pearce 2014-07-21 14:00:42 +12:00
parent 5fd4a67174
commit 2e7b854815
6 changed files with 2 additions and 152 deletions

View File

@ -6,7 +6,6 @@ frameworks/av/include/media/stagefright/foundation/ADebug.h
frameworks/av/include/media/stagefright/foundation/AHandler.h
frameworks/av/include/media/stagefright/foundation/AString.h
frameworks/av/include/media/stagefright/foundation/hexdump.h
frameworks/av/include/media/stagefright/MediaBufferGroup.h
frameworks/av/include/media/stagefright/MediaDefs.h
frameworks/av/include/media/stagefright/MediaErrors.h
frameworks/av/include/media/stagefright/MediaExtractor.h

View File

@ -54,8 +54,8 @@ public:
MediaBuffer(const sp<ABuffer> &buffer);
// Decrements the reference count and returns the buffer to its
// associated MediaBufferGroup if the reference count drops to 0.
// Decrements the reference count and deletes it if the reference
// count drops to 0.
void release();
// Increments the reference count.

View File

@ -1,58 +0,0 @@
/*
* Copyright (C) 2009 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 MEDIA_BUFFER_GROUP_H_
#define MEDIA_BUFFER_GROUP_H_
#include <media/stagefright/MediaBuffer.h>
#include <utils/Errors.h>
#include <utils/threads.h>
namespace stagefright {
class MediaBuffer;
class MetaData;
class MediaBufferGroup : public MediaBufferObserver {
public:
MediaBufferGroup();
~MediaBufferGroup();
void add_buffer(MediaBuffer *buffer);
// Blocks until a buffer is available and returns it to the caller,
// the returned buffer will have a reference count of 1.
status_t acquire_buffer(MediaBuffer **buffer);
protected:
virtual void signalBufferReturned(MediaBuffer *buffer);
private:
friend class MediaBuffer;
Mutex mLock;
Condition mCondition;
MediaBuffer *mFirstBuffer, *mLastBuffer;
MediaBufferGroup(const MediaBufferGroup &);
MediaBufferGroup &operator=(const MediaBufferGroup &);
};
} // namespace stagefright
#endif // MEDIA_BUFFER_GROUP_H_

View File

@ -33,7 +33,6 @@
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/AMessage.h>
#include <media/stagefright/MediaBuffer.h>
#include <media/stagefright/MediaBufferGroup.h>
#include <media/stagefright/MediaDefs.h>
#include <media/stagefright/MediaSource.h>
#include <media/stagefright/MetaData.h>

View File

@ -1,89 +0,0 @@
/*
* Copyright (C) 2009 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.
*/
#undef LOG_TAG
#define LOG_TAG "MediaBufferGroup"
#include <utils/Log.h>
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/MediaBuffer.h>
#include <media/stagefright/MediaBufferGroup.h>
namespace stagefright {
MediaBufferGroup::MediaBufferGroup()
: mFirstBuffer(NULL),
mLastBuffer(NULL) {
}
MediaBufferGroup::~MediaBufferGroup() {
MediaBuffer *next;
for (MediaBuffer *buffer = mFirstBuffer; buffer != NULL;
buffer = next) {
next = buffer->nextBuffer();
CHECK_EQ(buffer->refcount(), 0);
buffer->setObserver(NULL);
buffer->release();
}
}
void MediaBufferGroup::add_buffer(MediaBuffer *buffer) {
Mutex::Autolock autoLock(mLock);
buffer->setObserver(this);
if (mLastBuffer) {
mLastBuffer->setNextBuffer(buffer);
} else {
mFirstBuffer = buffer;
}
mLastBuffer = buffer;
}
status_t MediaBufferGroup::acquire_buffer(MediaBuffer **out) {
Mutex::Autolock autoLock(mLock);
for (;;) {
for (MediaBuffer *buffer = mFirstBuffer;
buffer != NULL; buffer = buffer->nextBuffer()) {
if (buffer->refcount() == 0) {
buffer->add_ref();
buffer->reset();
*out = buffer;
goto exit;
}
}
// All buffers are in use. Block until one of them is returned to us.
mCondition.wait(mLock);
}
exit:
return OK;
}
void MediaBufferGroup::signalBufferReturned(MediaBuffer *) {
Mutex::Autolock autoLock(mLock);
mCondition.signal();
}
} // namespace stagefright
#undef LOG_TAG

View File

@ -75,7 +75,6 @@ UNIFIED_SOURCES += [
'frameworks/av/media/libstagefright/foundation/AString.cpp',
'frameworks/av/media/libstagefright/id3/ID3.cpp',
'frameworks/av/media/libstagefright/MediaBuffer.cpp',
'frameworks/av/media/libstagefright/MediaBufferGroup.cpp',
'frameworks/av/media/libstagefright/MediaDefs.cpp',
'frameworks/av/media/libstagefright/MediaSource.cpp',
'frameworks/av/media/libstagefright/MPEG4Extractor.cpp',