summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/rtsp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2010-10-10 17:13:28 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-10-10 17:13:28 -0700
commit1c8ef86f2c25272488c171f1469f996ebf335edc (patch)
tree988609d64f7ff8e853540cf96a2a5c73c1a64461 /media/libstagefright/rtsp
parent2eeadf9ded4b5770a713496e9887d668889987bc (diff)
parenta5412b0431a22e52a4cc1623b92eb48fcd4d985c (diff)
downloadframeworks_av-1c8ef86f2c25272488c171f1469f996ebf335edc.zip
frameworks_av-1c8ef86f2c25272488c171f1469f996ebf335edc.tar.gz
frameworks_av-1c8ef86f2c25272488c171f1469f996ebf335edc.tar.bz2
am 14ea1048: am c5912acc: Merge "Disable the access unit timeout temporarily while a seek operation is in progress." into gingerbread
Merge commit '14ea1048e7e8a4b40836b5601bc86b91663525cb' * commit '14ea1048e7e8a4b40836b5601bc86b91663525cb': Disable the access unit timeout temporarily while a seek operation is in progress.
Diffstat (limited to 'media/libstagefright/rtsp')
-rw-r--r--media/libstagefright/rtsp/MyHandler.h35
1 files changed, 29 insertions, 6 deletions
diff --git a/media/libstagefright/rtsp/MyHandler.h b/media/libstagefright/rtsp/MyHandler.h
index 09dc156..9fb5f2a 100644
--- a/media/libstagefright/rtsp/MyHandler.h
+++ b/media/libstagefright/rtsp/MyHandler.h
@@ -86,6 +86,7 @@ struct MyHandler : public AHandler {
mFirstAccessUnitNTP(0),
mNumAccessUnitsReceived(0),
mCheckPending(false),
+ mCheckGeneration(0),
mTryTCPInterleaving(false),
mReceivedFirstRTCPPacket(false) {
mNetLooper->setName("rtsp net");
@@ -434,6 +435,13 @@ struct MyHandler : public AHandler {
case 'chek':
{
+ int32_t generation;
+ CHECK(msg->findInt32("generation", &generation));
+ if (generation != mCheckGeneration) {
+ // This is an outdated message. Ignore.
+ break;
+ }
+
if (mNumAccessUnitsReceived == 0) {
LOGI("stream ended? aborting.");
(new AMessage('abor', id()))->post();
@@ -454,12 +462,7 @@ struct MyHandler : public AHandler {
}
++mNumAccessUnitsReceived;
-
- if (!mCheckPending) {
- mCheckPending = true;
- sp<AMessage> check = new AMessage('chek', id());
- check->post(kAccessUnitTimeoutUs);
- }
+ postAccessUnitTimeoutCheck();
size_t trackIndex;
CHECK(msg->findSize("track-index", &trackIndex));
@@ -557,6 +560,11 @@ struct MyHandler : public AHandler {
mSeekPending = true;
+ // Disable the access unit timeout until we resumed
+ // playback again.
+ mCheckPending = true;
+ ++mCheckGeneration;
+
AString request = "PAUSE ";
request.append(mSessionURL);
request.append(" RTSP/1.0\r\n");
@@ -612,6 +620,9 @@ struct MyHandler : public AHandler {
LOGI("PLAY completed with result %d (%s)",
result, strerror(-result));
+ mCheckPending = false;
+ postAccessUnitTimeoutCheck();
+
if (result == OK) {
sp<RefBase> obj;
CHECK(msg->findObject("response", &obj));
@@ -674,6 +685,17 @@ struct MyHandler : public AHandler {
}
}
+ void postAccessUnitTimeoutCheck() {
+ if (mCheckPending) {
+ return;
+ }
+
+ mCheckPending = true;
+ sp<AMessage> check = new AMessage('chek', id());
+ check->setInt32("generation", mCheckGeneration);
+ check->post(kAccessUnitTimeoutUs);
+ }
+
static void SplitString(
const AString &s, const char *separator, List<AString> *items) {
items->clear();
@@ -783,6 +805,7 @@ private:
uint64_t mFirstAccessUnitNTP;
int64_t mNumAccessUnitsReceived;
bool mCheckPending;
+ int32_t mCheckGeneration;
bool mTryTCPInterleaving;
bool mReceivedFirstRTCPPacket;