diff options
| author | John Grossman <johngro@google.com> | 2012-08-13 09:56:22 -0700 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2012-08-13 09:56:22 -0700 |
| commit | 4fc9d476db8ba59053deac76dce9f403c34a0f2d (patch) | |
| tree | 890aa2ee51b6b650d744557ddd92df9722e0cb5f /media/libaah_rtp/pipe_event.cpp | |
| parent | 518cdbe52b60af91a2bd2d3ce2d29feac884ae02 (diff) | |
| parent | 73247cac58b0c295e02b2350722699689ac45189 (diff) | |
| download | frameworks_av-4fc9d476db8ba59053deac76dce9f403c34a0f2d.zip frameworks_av-4fc9d476db8ba59053deac76dce9f403c34a0f2d.tar.gz frameworks_av-4fc9d476db8ba59053deac76dce9f403c34a0f2d.tar.bz2 | |
am 73247cac: am d58a68a4: Merge changes Ibe7e6d4b,Icf8904db into jb-mr1-dev
* commit '73247cac58b0c295e02b2350722699689ac45189':
Move the AAH RTP code out of framework and into vendor.
Add the ability to dynamicaly register MediaPlayer types.
Diffstat (limited to 'media/libaah_rtp/pipe_event.cpp')
| -rw-r--r-- | media/libaah_rtp/pipe_event.cpp | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/media/libaah_rtp/pipe_event.cpp b/media/libaah_rtp/pipe_event.cpp deleted file mode 100644 index b8e6960..0000000 --- a/media/libaah_rtp/pipe_event.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2011 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. - */ - -#define LOG_TAG "LibAAH_RTP" -#include <utils/Log.h> - -#include <errno.h> -#include <fcntl.h> -#include <poll.h> -#include <unistd.h> - -#include "pipe_event.h" - -namespace android { - -PipeEvent::PipeEvent() { - pipe_[0] = -1; - pipe_[1] = -1; - - // Create the pipe. - if (pipe(pipe_) >= 0) { - // Set non-blocking mode on the read side of the pipe so we can - // easily drain it whenever we wakeup. - fcntl(pipe_[0], F_SETFL, O_NONBLOCK); - } else { - ALOGE("Failed to create pipe event %d %d %d", - pipe_[0], pipe_[1], errno); - pipe_[0] = -1; - pipe_[1] = -1; - } -} - -PipeEvent::~PipeEvent() { - if (pipe_[0] >= 0) { - close(pipe_[0]); - } - - if (pipe_[1] >= 0) { - close(pipe_[1]); - } -} - -void PipeEvent::clearPendingEvents() { - char drain_buffer[16]; - while (read(pipe_[0], drain_buffer, sizeof(drain_buffer)) > 0) { - // No body. - } -} - -bool PipeEvent::wait(int timeout) { - struct pollfd wait_fd; - - wait_fd.fd = getWakeupHandle(); - wait_fd.events = POLLIN; - wait_fd.revents = 0; - - int res = poll(&wait_fd, 1, timeout); - - if (res < 0) { - ALOGE("Wait error in PipeEvent; sleeping to prevent overload!"); - usleep(1000); - } - - return (res > 0); -} - -void PipeEvent::setEvent() { - char foo = 'q'; - write(pipe_[1], &foo, 1); -} - -} // namespace android - |
