blob: daf60f6e6a8fbc85e53caa2a52792eade121fff8 [file] [log] [blame]
Andreas Huberf9334412010-12-15 15:17:42 -08001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17//#define LOG_NDEBUG 0
18#define LOG_TAG "NuPlayer"
19#include <utils/Log.h>
20
21#include "NuPlayer.h"
Andreas Huber5bc087c2010-12-23 10:27:40 -080022
23#include "HTTPLiveSource.h"
Andreas Huberf9334412010-12-15 15:17:42 -080024#include "NuPlayerDecoder.h"
Andreas Huber43c3e6c2011-01-05 12:17:08 -080025#include "NuPlayerDriver.h"
Andreas Huberf9334412010-12-15 15:17:42 -080026#include "NuPlayerRenderer.h"
Andreas Huber5bc087c2010-12-23 10:27:40 -080027#include "NuPlayerSource.h"
Andreas Huber2bfdd422011-10-11 15:24:07 -070028#include "RTSPSource.h"
Andreas Huber5bc087c2010-12-23 10:27:40 -080029#include "StreamingSource.h"
Andreas Huberafed0e12011-09-20 15:39:58 -070030#include "GenericSource.h"
Andreas Huber5bc087c2010-12-23 10:27:40 -080031
32#include "ATSParser.h"
Andreas Huberf9334412010-12-15 15:17:42 -080033
Andreas Huber3831a062010-12-21 10:22:33 -080034#include <media/stagefright/foundation/hexdump.h>
Andreas Huberf9334412010-12-15 15:17:42 -080035#include <media/stagefright/foundation/ABuffer.h>
36#include <media/stagefright/foundation/ADebug.h>
37#include <media/stagefright/foundation/AMessage.h>
38#include <media/stagefright/ACodec.h>
Andreas Huber3fe62152011-09-16 15:09:22 -070039#include <media/stagefright/MediaDefs.h>
Andreas Huberf9334412010-12-15 15:17:42 -080040#include <media/stagefright/MediaErrors.h>
41#include <media/stagefright/MetaData.h>
Glenn Kasten11731182011-02-08 17:26:17 -080042#include <gui/ISurfaceTexture.h>
Andreas Huberf9334412010-12-15 15:17:42 -080043
Andreas Huber3fe62152011-09-16 15:09:22 -070044#include "avc_utils.h"
45
Andreas Huberf9334412010-12-15 15:17:42 -080046namespace android {
47
48////////////////////////////////////////////////////////////////////////////////
49
50NuPlayer::NuPlayer()
Andreas Huber9b80c2b2011-06-30 15:47:02 -070051 : mUIDValid(false),
Andreas Huber3fe62152011-09-16 15:09:22 -070052 mVideoIsAVC(false),
Andreas Huber9b80c2b2011-06-30 15:47:02 -070053 mAudioEOS(false),
Andreas Huberf9334412010-12-15 15:17:42 -080054 mVideoEOS(false),
Andreas Huber5bc087c2010-12-23 10:27:40 -080055 mScanSourcesPending(false),
Andreas Huber1aef2112011-01-04 14:01:29 -080056 mScanSourcesGeneration(0),
Andreas Huber6e3d3112011-11-28 12:36:11 -080057 mTimeDiscontinuityPending(false),
Andreas Huberf9334412010-12-15 15:17:42 -080058 mFlushingAudio(NONE),
Andreas Huber1aef2112011-01-04 14:01:29 -080059 mFlushingVideo(NONE),
60 mResetInProgress(false),
Andreas Huber3fe62152011-09-16 15:09:22 -070061 mResetPostponed(false),
62 mSkipRenderingAudioUntilMediaTimeUs(-1ll),
63 mSkipRenderingVideoUntilMediaTimeUs(-1ll),
64 mVideoLateByUs(0ll),
65 mNumFramesTotal(0ll),
Marco Nelissen8b712412012-04-27 09:33:24 -070066 mNumFramesDropped(0ll) {
Andreas Huberf9334412010-12-15 15:17:42 -080067}
68
69NuPlayer::~NuPlayer() {
70}
71
Andreas Huber9b80c2b2011-06-30 15:47:02 -070072void NuPlayer::setUID(uid_t uid) {
73 mUIDValid = true;
74 mUID = uid;
75}
76
Andreas Huber43c3e6c2011-01-05 12:17:08 -080077void NuPlayer::setDriver(const wp<NuPlayerDriver> &driver) {
78 mDriver = driver;
Andreas Huberf9334412010-12-15 15:17:42 -080079}
80
81void NuPlayer::setDataSource(const sp<IStreamSource> &source) {
82 sp<AMessage> msg = new AMessage(kWhatSetDataSource, id());
83
Andreas Huber5bc087c2010-12-23 10:27:40 -080084 msg->setObject("source", new StreamingSource(source));
85 msg->post();
86}
Andreas Huberf9334412010-12-15 15:17:42 -080087
Andreas Huberafed0e12011-09-20 15:39:58 -070088static bool IsHTTPLiveURL(const char *url) {
89 if (!strncasecmp("http://", url, 7)
90 || !strncasecmp("https://", url, 8)) {
91 size_t len = strlen(url);
92 if (len >= 5 && !strcasecmp(".m3u8", &url[len - 5])) {
93 return true;
94 }
95
96 if (strstr(url,"m3u8")) {
97 return true;
98 }
99 }
100
101 return false;
102}
103
Andreas Huber5bc087c2010-12-23 10:27:40 -0800104void NuPlayer::setDataSource(
105 const char *url, const KeyedVector<String8, String8> *headers) {
106 sp<AMessage> msg = new AMessage(kWhatSetDataSource, id());
107
Andreas Huberafed0e12011-09-20 15:39:58 -0700108 sp<Source> source;
109 if (IsHTTPLiveURL(url)) {
110 source = new HTTPLiveSource(url, headers, mUIDValid, mUID);
111 } else if (!strncasecmp(url, "rtsp://", 7)) {
112 source = new RTSPSource(url, headers, mUIDValid, mUID);
Andreas Huber2bfdd422011-10-11 15:24:07 -0700113 } else {
Andreas Huberafed0e12011-09-20 15:39:58 -0700114 source = new GenericSource(url, headers, mUIDValid, mUID);
Andreas Huber2bfdd422011-10-11 15:24:07 -0700115 }
116
Andreas Huberafed0e12011-09-20 15:39:58 -0700117 msg->setObject("source", source);
118 msg->post();
119}
120
121void NuPlayer::setDataSource(int fd, int64_t offset, int64_t length) {
122 sp<AMessage> msg = new AMessage(kWhatSetDataSource, id());
123
124 sp<Source> source = new GenericSource(fd, offset, length);
125 msg->setObject("source", source);
Andreas Huberf9334412010-12-15 15:17:42 -0800126 msg->post();
127}
128
Glenn Kasten11731182011-02-08 17:26:17 -0800129void NuPlayer::setVideoSurfaceTexture(const sp<ISurfaceTexture> &surfaceTexture) {
130 sp<AMessage> msg = new AMessage(kWhatSetVideoNativeWindow, id());
131 sp<SurfaceTextureClient> surfaceTextureClient(surfaceTexture != NULL ?
132 new SurfaceTextureClient(surfaceTexture) : NULL);
133 msg->setObject("native-window", new NativeWindowWrapper(surfaceTextureClient));
Andreas Huberf9334412010-12-15 15:17:42 -0800134 msg->post();
135}
136
137void NuPlayer::setAudioSink(const sp<MediaPlayerBase::AudioSink> &sink) {
138 sp<AMessage> msg = new AMessage(kWhatSetAudioSink, id());
139 msg->setObject("sink", sink);
140 msg->post();
141}
142
143void NuPlayer::start() {
144 (new AMessage(kWhatStart, id()))->post();
145}
146
Andreas Huber43c3e6c2011-01-05 12:17:08 -0800147void NuPlayer::pause() {
Andreas Huberb4082222011-01-20 15:23:04 -0800148 (new AMessage(kWhatPause, id()))->post();
Andreas Huber43c3e6c2011-01-05 12:17:08 -0800149}
150
151void NuPlayer::resume() {
Andreas Huberb4082222011-01-20 15:23:04 -0800152 (new AMessage(kWhatResume, id()))->post();
Andreas Huber43c3e6c2011-01-05 12:17:08 -0800153}
154
Andreas Huber1aef2112011-01-04 14:01:29 -0800155void NuPlayer::resetAsync() {
156 (new AMessage(kWhatReset, id()))->post();
157}
158
Andreas Huber43c3e6c2011-01-05 12:17:08 -0800159void NuPlayer::seekToAsync(int64_t seekTimeUs) {
160 sp<AMessage> msg = new AMessage(kWhatSeek, id());
161 msg->setInt64("seekTimeUs", seekTimeUs);
162 msg->post();
163}
164
Andreas Huber53df1a42010-12-22 10:03:04 -0800165// static
Andreas Huber1aef2112011-01-04 14:01:29 -0800166bool NuPlayer::IsFlushingState(FlushStatus state, bool *needShutdown) {
Andreas Huber53df1a42010-12-22 10:03:04 -0800167 switch (state) {
168 case FLUSHING_DECODER:
Andreas Huber1aef2112011-01-04 14:01:29 -0800169 if (needShutdown != NULL) {
170 *needShutdown = false;
Andreas Huber53df1a42010-12-22 10:03:04 -0800171 }
172 return true;
173
Andreas Huber1aef2112011-01-04 14:01:29 -0800174 case FLUSHING_DECODER_SHUTDOWN:
175 if (needShutdown != NULL) {
176 *needShutdown = true;
Andreas Huber53df1a42010-12-22 10:03:04 -0800177 }
178 return true;
179
180 default:
181 return false;
182 }
183}
184
Andreas Huberf9334412010-12-15 15:17:42 -0800185void NuPlayer::onMessageReceived(const sp<AMessage> &msg) {
186 switch (msg->what()) {
187 case kWhatSetDataSource:
188 {
Steve Block3856b092011-10-20 11:56:00 +0100189 ALOGV("kWhatSetDataSource");
Andreas Huberf9334412010-12-15 15:17:42 -0800190
191 CHECK(mSource == NULL);
192
Andreas Huber5bc087c2010-12-23 10:27:40 -0800193 sp<RefBase> obj;
194 CHECK(msg->findObject("source", &obj));
Andreas Huberf9334412010-12-15 15:17:42 -0800195
Andreas Huber5bc087c2010-12-23 10:27:40 -0800196 mSource = static_cast<Source *>(obj.get());
Andreas Huberf9334412010-12-15 15:17:42 -0800197 break;
198 }
199
Glenn Kasten11731182011-02-08 17:26:17 -0800200 case kWhatSetVideoNativeWindow:
Andreas Huberf9334412010-12-15 15:17:42 -0800201 {
Steve Block3856b092011-10-20 11:56:00 +0100202 ALOGV("kWhatSetVideoNativeWindow");
Andreas Huberf9334412010-12-15 15:17:42 -0800203
204 sp<RefBase> obj;
Glenn Kasten11731182011-02-08 17:26:17 -0800205 CHECK(msg->findObject("native-window", &obj));
Andreas Huberf9334412010-12-15 15:17:42 -0800206
Glenn Kasten11731182011-02-08 17:26:17 -0800207 mNativeWindow = static_cast<NativeWindowWrapper *>(obj.get());
Andreas Huberf9334412010-12-15 15:17:42 -0800208 break;
209 }
210
211 case kWhatSetAudioSink:
212 {
Steve Block3856b092011-10-20 11:56:00 +0100213 ALOGV("kWhatSetAudioSink");
Andreas Huberf9334412010-12-15 15:17:42 -0800214
215 sp<RefBase> obj;
216 CHECK(msg->findObject("sink", &obj));
217
218 mAudioSink = static_cast<MediaPlayerBase::AudioSink *>(obj.get());
219 break;
220 }
221
222 case kWhatStart:
223 {
Steve Block3856b092011-10-20 11:56:00 +0100224 ALOGV("kWhatStart");
Andreas Huber43c3e6c2011-01-05 12:17:08 -0800225
Andreas Huber3fe62152011-09-16 15:09:22 -0700226 mVideoIsAVC = false;
Andreas Huber1aef2112011-01-04 14:01:29 -0800227 mAudioEOS = false;
228 mVideoEOS = false;
Andreas Huber32f3cef2011-03-02 15:34:46 -0800229 mSkipRenderingAudioUntilMediaTimeUs = -1;
230 mSkipRenderingVideoUntilMediaTimeUs = -1;
Andreas Huber3fe62152011-09-16 15:09:22 -0700231 mVideoLateByUs = 0;
232 mNumFramesTotal = 0;
233 mNumFramesDropped = 0;
Andreas Huber1aef2112011-01-04 14:01:29 -0800234
Andreas Huber5bc087c2010-12-23 10:27:40 -0800235 mSource->start();
Andreas Huberf9334412010-12-15 15:17:42 -0800236
237 mRenderer = new Renderer(
238 mAudioSink,
239 new AMessage(kWhatRendererNotify, id()));
240
241 looper()->registerHandler(mRenderer);
242
Andreas Huber1aef2112011-01-04 14:01:29 -0800243 postScanSources();
Andreas Huberf9334412010-12-15 15:17:42 -0800244 break;
245 }
246
247 case kWhatScanSources:
248 {
Andreas Huber1aef2112011-01-04 14:01:29 -0800249 int32_t generation;
250 CHECK(msg->findInt32("generation", &generation));
251 if (generation != mScanSourcesGeneration) {
252 // Drop obsolete msg.
253 break;
254 }
255
Andreas Huber5bc087c2010-12-23 10:27:40 -0800256 mScanSourcesPending = false;
257
Steve Block3856b092011-10-20 11:56:00 +0100258 ALOGV("scanning sources haveAudio=%d, haveVideo=%d",
Andreas Huber43c3e6c2011-01-05 12:17:08 -0800259 mAudioDecoder != NULL, mVideoDecoder != NULL);
260
Haynes Mathew George5d246ef2012-07-09 10:36:57 -0700261 if (mNativeWindow != NULL) {
262 instantiateDecoder(false, &mVideoDecoder);
263 }
Andreas Huberf9334412010-12-15 15:17:42 -0800264
265 if (mAudioSink != NULL) {
Andreas Huber5bc087c2010-12-23 10:27:40 -0800266 instantiateDecoder(true, &mAudioDecoder);
Andreas Huberf9334412010-12-15 15:17:42 -0800267 }
268
Andreas Hubereac68ba2011-09-27 12:12:25 -0700269 status_t err;
270 if ((err = mSource->feedMoreTSData()) != OK) {
Andreas Huber1aef2112011-01-04 14:01:29 -0800271 if (mAudioDecoder == NULL && mVideoDecoder == NULL) {
272 // We're not currently decoding anything (no audio or
273 // video tracks found) and we just ran out of input data.
Andreas Hubereac68ba2011-09-27 12:12:25 -0700274
275 if (err == ERROR_END_OF_STREAM) {
276 notifyListener(MEDIA_PLAYBACK_COMPLETE, 0, 0);
277 } else {
278 notifyListener(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, err);
279 }
Andreas Huber1aef2112011-01-04 14:01:29 -0800280 }
Andreas Huberf9334412010-12-15 15:17:42 -0800281 break;
282 }
283
Haynes Mathew George5d246ef2012-07-09 10:36:57 -0700284 if (mAudioDecoder == NULL && mAudioSink != NULL ||
285 mVideoDecoder == NULL && mNativeWindow != NULL) {
Andreas Huberf9334412010-12-15 15:17:42 -0800286 msg->post(100000ll);
Andreas Huber5bc087c2010-12-23 10:27:40 -0800287 mScanSourcesPending = true;
Andreas Huberf9334412010-12-15 15:17:42 -0800288 }
289 break;
290 }
291
292 case kWhatVideoNotify:
293 case kWhatAudioNotify:
294 {
295 bool audio = msg->what() == kWhatAudioNotify;
296
297 sp<AMessage> codecRequest;
298 CHECK(msg->findMessage("codec-request", &codecRequest));
299
300 int32_t what;
301 CHECK(codecRequest->findInt32("what", &what));
302
303 if (what == ACodec::kWhatFillThisBuffer) {
304 status_t err = feedDecoderInputData(
305 audio, codecRequest);
306
Andreas Huber5bc087c2010-12-23 10:27:40 -0800307 if (err == -EWOULDBLOCK) {
Andreas Hubereac68ba2011-09-27 12:12:25 -0700308 if (mSource->feedMoreTSData() == OK) {
Andreas Huber1183a4a2011-11-03 11:00:21 -0700309 msg->post(10000ll);
Andreas Huber5bc087c2010-12-23 10:27:40 -0800310 }
Andreas Huberf9334412010-12-15 15:17:42 -0800311 }
312 } else if (what == ACodec::kWhatEOS) {
Andreas Huberdc9bacd2011-09-26 10:53:29 -0700313 int32_t err;
314 CHECK(codecRequest->findInt32("err", &err));
315
316 if (err == ERROR_END_OF_STREAM) {
Steve Block3856b092011-10-20 11:56:00 +0100317 ALOGV("got %s decoder EOS", audio ? "audio" : "video");
Andreas Huberdc9bacd2011-09-26 10:53:29 -0700318 } else {
Steve Block3856b092011-10-20 11:56:00 +0100319 ALOGV("got %s decoder EOS w/ error %d",
Andreas Huberdc9bacd2011-09-26 10:53:29 -0700320 audio ? "audio" : "video",
321 err);
322 }
323
324 mRenderer->queueEOS(audio, err);
Andreas Huberf9334412010-12-15 15:17:42 -0800325 } else if (what == ACodec::kWhatFlushCompleted) {
Andreas Huber1aef2112011-01-04 14:01:29 -0800326 bool needShutdown;
Andreas Huber53df1a42010-12-22 10:03:04 -0800327
Andreas Huberf9334412010-12-15 15:17:42 -0800328 if (audio) {
Andreas Huber1aef2112011-01-04 14:01:29 -0800329 CHECK(IsFlushingState(mFlushingAudio, &needShutdown));
Andreas Huberf9334412010-12-15 15:17:42 -0800330 mFlushingAudio = FLUSHED;
331 } else {
Andreas Huber1aef2112011-01-04 14:01:29 -0800332 CHECK(IsFlushingState(mFlushingVideo, &needShutdown));
Andreas Huberf9334412010-12-15 15:17:42 -0800333 mFlushingVideo = FLUSHED;
Andreas Huber3fe62152011-09-16 15:09:22 -0700334
335 mVideoLateByUs = 0;
Andreas Huberf9334412010-12-15 15:17:42 -0800336 }
337
Steve Block3856b092011-10-20 11:56:00 +0100338 ALOGV("decoder %s flush completed", audio ? "audio" : "video");
Andreas Huberf9334412010-12-15 15:17:42 -0800339
Andreas Huber1aef2112011-01-04 14:01:29 -0800340 if (needShutdown) {
Steve Block3856b092011-10-20 11:56:00 +0100341 ALOGV("initiating %s decoder shutdown",
Andreas Huber53df1a42010-12-22 10:03:04 -0800342 audio ? "audio" : "video");
Andreas Huberf9334412010-12-15 15:17:42 -0800343
Andreas Huber53df1a42010-12-22 10:03:04 -0800344 (audio ? mAudioDecoder : mVideoDecoder)->initiateShutdown();
Andreas Huberf9334412010-12-15 15:17:42 -0800345
Andreas Huber53df1a42010-12-22 10:03:04 -0800346 if (audio) {
347 mFlushingAudio = SHUTTING_DOWN_DECODER;
348 } else {
349 mFlushingVideo = SHUTTING_DOWN_DECODER;
350 }
Andreas Huberf9334412010-12-15 15:17:42 -0800351 }
Andreas Huber3831a062010-12-21 10:22:33 -0800352
353 finishFlushIfPossible();
Andreas Huber2c2814b2010-12-15 17:18:20 -0800354 } else if (what == ACodec::kWhatOutputFormatChanged) {
Andreas Huber31e25082011-01-10 10:38:31 -0800355 if (audio) {
356 int32_t numChannels;
357 CHECK(codecRequest->findInt32("channel-count", &numChannels));
Andreas Huber2c2814b2010-12-15 17:18:20 -0800358
Andreas Huber31e25082011-01-10 10:38:31 -0800359 int32_t sampleRate;
360 CHECK(codecRequest->findInt32("sample-rate", &sampleRate));
Andreas Huber2c2814b2010-12-15 17:18:20 -0800361
Steve Block3856b092011-10-20 11:56:00 +0100362 ALOGV("Audio output format changed to %d Hz, %d channels",
Andreas Huber31e25082011-01-10 10:38:31 -0800363 sampleRate, numChannels);
Andreas Huber2c2814b2010-12-15 17:18:20 -0800364
Andreas Huber31e25082011-01-10 10:38:31 -0800365 mAudioSink->close();
Eric Laurent1948eb32012-04-13 16:50:19 -0700366
367 audio_output_flags_t flags;
368 int64_t durationUs;
369 // FIXME: we should handle the case where the video decoder is created after
370 // we receive the format change indication. Current code will just make that
371 // we select deep buffer with video which should not be a problem as it should
372 // not prevent from keeping A/V sync.
373 if (mVideoDecoder == NULL &&
374 mSource->getDuration(&durationUs) == OK &&
375 durationUs > AUDIO_SINK_MIN_DEEP_BUFFER_DURATION_US) {
376 flags = AUDIO_OUTPUT_FLAG_DEEP_BUFFER;
377 } else {
378 flags = AUDIO_OUTPUT_FLAG_NONE;
379 }
380
Andreas Huber98065552012-05-03 11:33:01 -0700381 int32_t channelMask;
382 if (!codecRequest->findInt32("channel-mask", &channelMask)) {
383 channelMask = CHANNEL_MASK_USE_CHANNEL_ORDER;
384 }
385
Andreas Huber078cfcf2011-09-15 12:25:04 -0700386 CHECK_EQ(mAudioSink->open(
387 sampleRate,
388 numChannels,
Andreas Huber98065552012-05-03 11:33:01 -0700389 (audio_channel_mask_t)channelMask,
Andreas Huber078cfcf2011-09-15 12:25:04 -0700390 AUDIO_FORMAT_PCM_16_BIT,
Eric Laurent1948eb32012-04-13 16:50:19 -0700391 8 /* bufferCount */,
392 NULL,
393 NULL,
394 flags),
Andreas Huber078cfcf2011-09-15 12:25:04 -0700395 (status_t)OK);
Andreas Huber31e25082011-01-10 10:38:31 -0800396 mAudioSink->start();
Andreas Huber2c2814b2010-12-15 17:18:20 -0800397
Andreas Huber31e25082011-01-10 10:38:31 -0800398 mRenderer->signalAudioSinkChanged();
399 } else {
400 // video
Andreas Huber3831a062010-12-21 10:22:33 -0800401
Andreas Huber31e25082011-01-10 10:38:31 -0800402 int32_t width, height;
403 CHECK(codecRequest->findInt32("width", &width));
404 CHECK(codecRequest->findInt32("height", &height));
405
406 int32_t cropLeft, cropTop, cropRight, cropBottom;
407 CHECK(codecRequest->findRect(
408 "crop",
409 &cropLeft, &cropTop, &cropRight, &cropBottom));
410
Steve Block3856b092011-10-20 11:56:00 +0100411 ALOGV("Video output format changed to %d x %d "
Andreas Hubercb67cd12011-08-26 16:02:19 -0700412 "(crop: %d x %d @ (%d, %d))",
Andreas Huber31e25082011-01-10 10:38:31 -0800413 width, height,
Andreas Hubercb67cd12011-08-26 16:02:19 -0700414 (cropRight - cropLeft + 1),
415 (cropBottom - cropTop + 1),
416 cropLeft, cropTop);
Andreas Huber31e25082011-01-10 10:38:31 -0800417
418 notifyListener(
419 MEDIA_SET_VIDEO_SIZE,
420 cropRight - cropLeft + 1,
421 cropBottom - cropTop + 1);
422 }
Andreas Huber3831a062010-12-21 10:22:33 -0800423 } else if (what == ACodec::kWhatShutdownCompleted) {
Steve Block3856b092011-10-20 11:56:00 +0100424 ALOGV("%s shutdown completed", audio ? "audio" : "video");
Andreas Huber3831a062010-12-21 10:22:33 -0800425 if (audio) {
426 mAudioDecoder.clear();
427
428 CHECK_EQ((int)mFlushingAudio, (int)SHUTTING_DOWN_DECODER);
429 mFlushingAudio = SHUT_DOWN;
430 } else {
431 mVideoDecoder.clear();
432
433 CHECK_EQ((int)mFlushingVideo, (int)SHUTTING_DOWN_DECODER);
434 mFlushingVideo = SHUT_DOWN;
435 }
436
437 finishFlushIfPossible();
Andreas Huberc92fd242011-08-16 13:48:44 -0700438 } else if (what == ACodec::kWhatError) {
Steve Block29357bc2012-01-06 19:20:56 +0000439 ALOGE("Received error from %s decoder, aborting playback.",
Andreas Huberc92fd242011-08-16 13:48:44 -0700440 audio ? "audio" : "video");
441
442 mRenderer->queueEOS(audio, UNKNOWN_ERROR);
Andreas Huber57788222012-02-21 11:47:18 -0800443 } else if (what == ACodec::kWhatDrainThisBuffer) {
Andreas Huberf9334412010-12-15 15:17:42 -0800444 renderBuffer(audio, codecRequest);
Andreas Huber57788222012-02-21 11:47:18 -0800445 } else {
446 ALOGV("Unhandled codec notification %d.", what);
Andreas Huberf9334412010-12-15 15:17:42 -0800447 }
448
449 break;
450 }
451
452 case kWhatRendererNotify:
453 {
454 int32_t what;
455 CHECK(msg->findInt32("what", &what));
456
457 if (what == Renderer::kWhatEOS) {
458 int32_t audio;
459 CHECK(msg->findInt32("audio", &audio));
460
Andreas Huberc92fd242011-08-16 13:48:44 -0700461 int32_t finalResult;
462 CHECK(msg->findInt32("finalResult", &finalResult));
463
Andreas Huberf9334412010-12-15 15:17:42 -0800464 if (audio) {
465 mAudioEOS = true;
466 } else {
467 mVideoEOS = true;
468 }
469
Andreas Huberc92fd242011-08-16 13:48:44 -0700470 if (finalResult == ERROR_END_OF_STREAM) {
Steve Block3856b092011-10-20 11:56:00 +0100471 ALOGV("reached %s EOS", audio ? "audio" : "video");
Andreas Huberc92fd242011-08-16 13:48:44 -0700472 } else {
Steve Block29357bc2012-01-06 19:20:56 +0000473 ALOGE("%s track encountered an error (%d)",
Andreas Huberc92fd242011-08-16 13:48:44 -0700474 audio ? "audio" : "video", finalResult);
475
476 notifyListener(
477 MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, finalResult);
478 }
Andreas Huberf9334412010-12-15 15:17:42 -0800479
480 if ((mAudioEOS || mAudioDecoder == NULL)
481 && (mVideoEOS || mVideoDecoder == NULL)) {
482 notifyListener(MEDIA_PLAYBACK_COMPLETE, 0, 0);
483 }
Andreas Huber43c3e6c2011-01-05 12:17:08 -0800484 } else if (what == Renderer::kWhatPosition) {
485 int64_t positionUs;
486 CHECK(msg->findInt64("positionUs", &positionUs));
487
Andreas Huber3fe62152011-09-16 15:09:22 -0700488 CHECK(msg->findInt64("videoLateByUs", &mVideoLateByUs));
489
Andreas Huber43c3e6c2011-01-05 12:17:08 -0800490 if (mDriver != NULL) {
491 sp<NuPlayerDriver> driver = mDriver.promote();
492 if (driver != NULL) {
493 driver->notifyPosition(positionUs);
Andreas Huber3fe62152011-09-16 15:09:22 -0700494
495 driver->notifyFrameStats(
496 mNumFramesTotal, mNumFramesDropped);
Andreas Huber43c3e6c2011-01-05 12:17:08 -0800497 }
498 }
Andreas Huber3fe62152011-09-16 15:09:22 -0700499 } else if (what == Renderer::kWhatFlushComplete) {
Andreas Huberf9334412010-12-15 15:17:42 -0800500 CHECK_EQ(what, (int32_t)Renderer::kWhatFlushComplete);
501
502 int32_t audio;
503 CHECK(msg->findInt32("audio", &audio));
504
Steve Block3856b092011-10-20 11:56:00 +0100505 ALOGV("renderer %s flush completed.", audio ? "audio" : "video");
James Dongf57b4ea2012-07-20 13:38:36 -0700506 } else if (what == Renderer::kWhatVideoRenderingStart) {
507 notifyListener(MEDIA_INFO, MEDIA_INFO_RENDERING_START, 0);
Andreas Huberf9334412010-12-15 15:17:42 -0800508 }
509 break;
510 }
511
512 case kWhatMoreDataQueued:
513 {
514 break;
515 }
516
Andreas Huber1aef2112011-01-04 14:01:29 -0800517 case kWhatReset:
518 {
Steve Block3856b092011-10-20 11:56:00 +0100519 ALOGV("kWhatReset");
Andreas Huber1aef2112011-01-04 14:01:29 -0800520
Andreas Huberb58ce9f2011-11-28 16:27:35 -0800521 if (mRenderer != NULL) {
522 // There's an edge case where the renderer owns all output
523 // buffers and is paused, therefore the decoder will not read
524 // more input data and will never encounter the matching
525 // discontinuity. To avoid this, we resume the renderer.
526
527 if (mFlushingAudio == AWAITING_DISCONTINUITY
528 || mFlushingVideo == AWAITING_DISCONTINUITY) {
529 mRenderer->resume();
530 }
531 }
532
Andreas Huber1aef2112011-01-04 14:01:29 -0800533 if (mFlushingAudio != NONE || mFlushingVideo != NONE) {
534 // We're currently flushing, postpone the reset until that's
535 // completed.
536
Andreas Huberea9d51b2011-11-30 09:53:40 -0800537 ALOGV("postponing reset mFlushingAudio=%d, mFlushingVideo=%d",
538 mFlushingAudio, mFlushingVideo);
Andreas Huber1aef2112011-01-04 14:01:29 -0800539
540 mResetPostponed = true;
541 break;
542 }
543
544 if (mAudioDecoder == NULL && mVideoDecoder == NULL) {
545 finishReset();
546 break;
547 }
548
Andreas Huber6e3d3112011-11-28 12:36:11 -0800549 mTimeDiscontinuityPending = true;
550
Andreas Huber1aef2112011-01-04 14:01:29 -0800551 if (mAudioDecoder != NULL) {
552 flushDecoder(true /* audio */, true /* needShutdown */);
553 }
554
555 if (mVideoDecoder != NULL) {
556 flushDecoder(false /* audio */, true /* needShutdown */);
557 }
558
559 mResetInProgress = true;
560 break;
561 }
562
Andreas Huber43c3e6c2011-01-05 12:17:08 -0800563 case kWhatSeek:
564 {
565 int64_t seekTimeUs;
566 CHECK(msg->findInt64("seekTimeUs", &seekTimeUs));
567
Steve Block3856b092011-10-20 11:56:00 +0100568 ALOGV("kWhatSeek seekTimeUs=%lld us (%.2f secs)",
Andreas Huber43c3e6c2011-01-05 12:17:08 -0800569 seekTimeUs, seekTimeUs / 1E6);
570
571 mSource->seekTo(seekTimeUs);
572
573 if (mDriver != NULL) {
574 sp<NuPlayerDriver> driver = mDriver.promote();
575 if (driver != NULL) {
576 driver->notifySeekComplete();
577 }
578 }
579
580 break;
581 }
582
Andreas Huberb4082222011-01-20 15:23:04 -0800583 case kWhatPause:
584 {
585 CHECK(mRenderer != NULL);
586 mRenderer->pause();
587 break;
588 }
589
590 case kWhatResume:
591 {
592 CHECK(mRenderer != NULL);
593 mRenderer->resume();
594 break;
595 }
596
Andreas Huberf9334412010-12-15 15:17:42 -0800597 default:
598 TRESPASS();
599 break;
600 }
601}
602
Andreas Huber3831a062010-12-21 10:22:33 -0800603void NuPlayer::finishFlushIfPossible() {
604 if (mFlushingAudio != FLUSHED && mFlushingAudio != SHUT_DOWN) {
605 return;
606 }
607
608 if (mFlushingVideo != FLUSHED && mFlushingVideo != SHUT_DOWN) {
609 return;
610 }
611
Steve Block3856b092011-10-20 11:56:00 +0100612 ALOGV("both audio and video are flushed now.");
Andreas Huber3831a062010-12-21 10:22:33 -0800613
Andreas Huber6e3d3112011-11-28 12:36:11 -0800614 if (mTimeDiscontinuityPending) {
615 mRenderer->signalTimeDiscontinuity();
616 mTimeDiscontinuityPending = false;
617 }
Andreas Huber3831a062010-12-21 10:22:33 -0800618
Andreas Huber22fc52f2011-01-05 16:24:27 -0800619 if (mAudioDecoder != NULL) {
Andreas Huber3831a062010-12-21 10:22:33 -0800620 mAudioDecoder->signalResume();
621 }
622
Andreas Huber22fc52f2011-01-05 16:24:27 -0800623 if (mVideoDecoder != NULL) {
Andreas Huber3831a062010-12-21 10:22:33 -0800624 mVideoDecoder->signalResume();
625 }
626
627 mFlushingAudio = NONE;
628 mFlushingVideo = NONE;
Andreas Huber3831a062010-12-21 10:22:33 -0800629
Andreas Huber1aef2112011-01-04 14:01:29 -0800630 if (mResetInProgress) {
Steve Block3856b092011-10-20 11:56:00 +0100631 ALOGV("reset completed");
Andreas Huber1aef2112011-01-04 14:01:29 -0800632
633 mResetInProgress = false;
634 finishReset();
635 } else if (mResetPostponed) {
636 (new AMessage(kWhatReset, id()))->post();
637 mResetPostponed = false;
Andreas Huber22fc52f2011-01-05 16:24:27 -0800638 } else if (mAudioDecoder == NULL || mVideoDecoder == NULL) {
Andreas Huber1aef2112011-01-04 14:01:29 -0800639 postScanSources();
Andreas Huberf9334412010-12-15 15:17:42 -0800640 }
641}
642
Andreas Huber1aef2112011-01-04 14:01:29 -0800643void NuPlayer::finishReset() {
644 CHECK(mAudioDecoder == NULL);
645 CHECK(mVideoDecoder == NULL);
646
Andreas Huber2bfdd422011-10-11 15:24:07 -0700647 ++mScanSourcesGeneration;
648 mScanSourcesPending = false;
649
Andreas Huber1aef2112011-01-04 14:01:29 -0800650 mRenderer.clear();
Andreas Huber2bfdd422011-10-11 15:24:07 -0700651
652 if (mSource != NULL) {
653 mSource->stop();
654 mSource.clear();
655 }
Andreas Huber1aef2112011-01-04 14:01:29 -0800656
Andreas Huber43c3e6c2011-01-05 12:17:08 -0800657 if (mDriver != NULL) {
658 sp<NuPlayerDriver> driver = mDriver.promote();
659 if (driver != NULL) {
660 driver->notifyResetComplete();
661 }
662 }
Andreas Huber1aef2112011-01-04 14:01:29 -0800663}
664
665void NuPlayer::postScanSources() {
666 if (mScanSourcesPending) {
667 return;
668 }
669
670 sp<AMessage> msg = new AMessage(kWhatScanSources, id());
671 msg->setInt32("generation", mScanSourcesGeneration);
672 msg->post();
673
674 mScanSourcesPending = true;
675}
676
Andreas Huber5bc087c2010-12-23 10:27:40 -0800677status_t NuPlayer::instantiateDecoder(bool audio, sp<Decoder> *decoder) {
Andreas Huberf9334412010-12-15 15:17:42 -0800678 if (*decoder != NULL) {
679 return OK;
680 }
681
Andreas Huber5bc087c2010-12-23 10:27:40 -0800682 sp<MetaData> meta = mSource->getFormat(audio);
Andreas Huberf9334412010-12-15 15:17:42 -0800683
Andreas Huber5bc087c2010-12-23 10:27:40 -0800684 if (meta == NULL) {
Andreas Huberf9334412010-12-15 15:17:42 -0800685 return -EWOULDBLOCK;
686 }
687
Andreas Huber3fe62152011-09-16 15:09:22 -0700688 if (!audio) {
689 const char *mime;
690 CHECK(meta->findCString(kKeyMIMEType, &mime));
691 mVideoIsAVC = !strcasecmp(MEDIA_MIMETYPE_VIDEO_AVC, mime);
692 }
693
Andreas Huberf9334412010-12-15 15:17:42 -0800694 sp<AMessage> notify =
695 new AMessage(audio ? kWhatAudioNotify : kWhatVideoNotify,
696 id());
697
Glenn Kasten11731182011-02-08 17:26:17 -0800698 *decoder = audio ? new Decoder(notify) :
699 new Decoder(notify, mNativeWindow);
Andreas Huberf9334412010-12-15 15:17:42 -0800700 looper()->registerHandler(*decoder);
701
Andreas Huber5bc087c2010-12-23 10:27:40 -0800702 (*decoder)->configure(meta);
Andreas Huberf9334412010-12-15 15:17:42 -0800703
Andreas Huber43c3e6c2011-01-05 12:17:08 -0800704 int64_t durationUs;
705 if (mDriver != NULL && mSource->getDuration(&durationUs) == OK) {
706 sp<NuPlayerDriver> driver = mDriver.promote();
707 if (driver != NULL) {
708 driver->notifyDuration(durationUs);
709 }
710 }
711
Andreas Huberf9334412010-12-15 15:17:42 -0800712 return OK;
713}
714
715status_t NuPlayer::feedDecoderInputData(bool audio, const sp<AMessage> &msg) {
716 sp<AMessage> reply;
717 CHECK(msg->findMessage("reply", &reply));
718
Andreas Huber53df1a42010-12-22 10:03:04 -0800719 if ((audio && IsFlushingState(mFlushingAudio))
720 || (!audio && IsFlushingState(mFlushingVideo))) {
Andreas Huberf9334412010-12-15 15:17:42 -0800721 reply->setInt32("err", INFO_DISCONTINUITY);
722 reply->post();
723 return OK;
724 }
725
726 sp<ABuffer> accessUnit;
Andreas Huberf9334412010-12-15 15:17:42 -0800727
Andreas Huber3fe62152011-09-16 15:09:22 -0700728 bool dropAccessUnit;
729 do {
730 status_t err = mSource->dequeueAccessUnit(audio, &accessUnit);
Andreas Huber5bc087c2010-12-23 10:27:40 -0800731
Andreas Huber3fe62152011-09-16 15:09:22 -0700732 if (err == -EWOULDBLOCK) {
733 return err;
734 } else if (err != OK) {
735 if (err == INFO_DISCONTINUITY) {
736 int32_t type;
737 CHECK(accessUnit->meta()->findInt32("discontinuity", &type));
Andreas Huber53df1a42010-12-22 10:03:04 -0800738
Andreas Huber3fe62152011-09-16 15:09:22 -0700739 bool formatChange =
Andreas Huber6e3d3112011-11-28 12:36:11 -0800740 (audio &&
741 (type & ATSParser::DISCONTINUITY_AUDIO_FORMAT))
742 || (!audio &&
743 (type & ATSParser::DISCONTINUITY_VIDEO_FORMAT));
Andreas Huber53df1a42010-12-22 10:03:04 -0800744
Andreas Huber6e3d3112011-11-28 12:36:11 -0800745 bool timeChange = (type & ATSParser::DISCONTINUITY_TIME) != 0;
746
Steve Blockdf64d152012-01-04 20:05:49 +0000747 ALOGI("%s discontinuity (formatChange=%d, time=%d)",
Andreas Huber6e3d3112011-11-28 12:36:11 -0800748 audio ? "audio" : "video", formatChange, timeChange);
Andreas Huber32f3cef2011-03-02 15:34:46 -0800749
Andreas Huber3fe62152011-09-16 15:09:22 -0700750 if (audio) {
751 mSkipRenderingAudioUntilMediaTimeUs = -1;
752 } else {
753 mSkipRenderingVideoUntilMediaTimeUs = -1;
754 }
Andreas Huber32f3cef2011-03-02 15:34:46 -0800755
Andreas Huber6e3d3112011-11-28 12:36:11 -0800756 if (timeChange) {
757 sp<AMessage> extra;
758 if (accessUnit->meta()->findMessage("extra", &extra)
759 && extra != NULL) {
760 int64_t resumeAtMediaTimeUs;
761 if (extra->findInt64(
762 "resume-at-mediatimeUs", &resumeAtMediaTimeUs)) {
Steve Blockdf64d152012-01-04 20:05:49 +0000763 ALOGI("suppressing rendering of %s until %lld us",
Andreas Huber6e3d3112011-11-28 12:36:11 -0800764 audio ? "audio" : "video", resumeAtMediaTimeUs);
Andreas Huber3fe62152011-09-16 15:09:22 -0700765
Andreas Huber6e3d3112011-11-28 12:36:11 -0800766 if (audio) {
767 mSkipRenderingAudioUntilMediaTimeUs =
768 resumeAtMediaTimeUs;
769 } else {
770 mSkipRenderingVideoUntilMediaTimeUs =
771 resumeAtMediaTimeUs;
772 }
Andreas Huber3fe62152011-09-16 15:09:22 -0700773 }
Andreas Huber32f3cef2011-03-02 15:34:46 -0800774 }
775 }
Andreas Huber3fe62152011-09-16 15:09:22 -0700776
Andreas Huber6e3d3112011-11-28 12:36:11 -0800777 mTimeDiscontinuityPending =
778 mTimeDiscontinuityPending || timeChange;
779
780 if (formatChange || timeChange) {
781 flushDecoder(audio, formatChange);
782 } else {
783 // This stream is unaffected by the discontinuity
784
785 if (audio) {
786 mFlushingAudio = FLUSHED;
787 } else {
788 mFlushingVideo = FLUSHED;
789 }
790
791 finishFlushIfPossible();
792
793 return -EWOULDBLOCK;
794 }
Andreas Huber32f3cef2011-03-02 15:34:46 -0800795 }
796
Andreas Huber3fe62152011-09-16 15:09:22 -0700797 reply->setInt32("err", err);
798 reply->post();
799 return OK;
Andreas Huberf9334412010-12-15 15:17:42 -0800800 }
801
Andreas Huber3fe62152011-09-16 15:09:22 -0700802 if (!audio) {
803 ++mNumFramesTotal;
804 }
805
806 dropAccessUnit = false;
807 if (!audio
808 && mVideoLateByUs > 100000ll
809 && mVideoIsAVC
810 && !IsAVCReferenceFrame(accessUnit)) {
811 dropAccessUnit = true;
812 ++mNumFramesDropped;
813 }
814 } while (dropAccessUnit);
Andreas Huberf9334412010-12-15 15:17:42 -0800815
Steve Block3856b092011-10-20 11:56:00 +0100816 // ALOGV("returned a valid buffer of %s data", audio ? "audio" : "video");
Andreas Huberf9334412010-12-15 15:17:42 -0800817
818#if 0
819 int64_t mediaTimeUs;
820 CHECK(accessUnit->meta()->findInt64("timeUs", &mediaTimeUs));
Steve Block3856b092011-10-20 11:56:00 +0100821 ALOGV("feeding %s input buffer at media time %.2f secs",
Andreas Huberf9334412010-12-15 15:17:42 -0800822 audio ? "audio" : "video",
823 mediaTimeUs / 1E6);
824#endif
825
Andreas Huber2d8bedd2012-02-21 14:38:23 -0800826 reply->setBuffer("buffer", accessUnit);
Andreas Huberf9334412010-12-15 15:17:42 -0800827 reply->post();
828
829 return OK;
830}
831
832void NuPlayer::renderBuffer(bool audio, const sp<AMessage> &msg) {
Steve Block3856b092011-10-20 11:56:00 +0100833 // ALOGV("renderBuffer %s", audio ? "audio" : "video");
Andreas Huberf9334412010-12-15 15:17:42 -0800834
835 sp<AMessage> reply;
836 CHECK(msg->findMessage("reply", &reply));
837
Andreas Huber18ac5402011-08-31 15:04:25 -0700838 if (IsFlushingState(audio ? mFlushingAudio : mFlushingVideo)) {
839 // We're currently attempting to flush the decoder, in order
840 // to complete this, the decoder wants all its buffers back,
841 // so we don't want any output buffers it sent us (from before
842 // we initiated the flush) to be stuck in the renderer's queue.
843
Steve Block3856b092011-10-20 11:56:00 +0100844 ALOGV("we're still flushing the %s decoder, sending its output buffer"
Andreas Huber18ac5402011-08-31 15:04:25 -0700845 " right back.", audio ? "audio" : "video");
846
847 reply->post();
848 return;
849 }
850
Andreas Huber2d8bedd2012-02-21 14:38:23 -0800851 sp<ABuffer> buffer;
852 CHECK(msg->findBuffer("buffer", &buffer));
Andreas Huberf9334412010-12-15 15:17:42 -0800853
Andreas Huber32f3cef2011-03-02 15:34:46 -0800854 int64_t &skipUntilMediaTimeUs =
855 audio
856 ? mSkipRenderingAudioUntilMediaTimeUs
857 : mSkipRenderingVideoUntilMediaTimeUs;
858
859 if (skipUntilMediaTimeUs >= 0) {
860 int64_t mediaTimeUs;
861 CHECK(buffer->meta()->findInt64("timeUs", &mediaTimeUs));
862
863 if (mediaTimeUs < skipUntilMediaTimeUs) {
Steve Block3856b092011-10-20 11:56:00 +0100864 ALOGV("dropping %s buffer at time %lld as requested.",
Andreas Huber32f3cef2011-03-02 15:34:46 -0800865 audio ? "audio" : "video",
866 mediaTimeUs);
867
868 reply->post();
869 return;
870 }
871
872 skipUntilMediaTimeUs = -1;
873 }
874
Andreas Huberf9334412010-12-15 15:17:42 -0800875 mRenderer->queueBuffer(audio, buffer, reply);
876}
877
878void NuPlayer::notifyListener(int msg, int ext1, int ext2) {
Andreas Huber43c3e6c2011-01-05 12:17:08 -0800879 if (mDriver == NULL) {
Andreas Huberf9334412010-12-15 15:17:42 -0800880 return;
881 }
882
Andreas Huber43c3e6c2011-01-05 12:17:08 -0800883 sp<NuPlayerDriver> driver = mDriver.promote();
Andreas Huberf9334412010-12-15 15:17:42 -0800884
Andreas Huber43c3e6c2011-01-05 12:17:08 -0800885 if (driver == NULL) {
Andreas Huberf9334412010-12-15 15:17:42 -0800886 return;
887 }
888
Andreas Hubera4af2142011-10-26 15:23:31 -0700889 driver->notifyListener(msg, ext1, ext2);
Andreas Huberf9334412010-12-15 15:17:42 -0800890}
891
Andreas Huber1aef2112011-01-04 14:01:29 -0800892void NuPlayer::flushDecoder(bool audio, bool needShutdown) {
Andreas Huber6e3d3112011-11-28 12:36:11 -0800893 if ((audio && mAudioDecoder == NULL) || (!audio && mVideoDecoder == NULL)) {
Steve Blockdf64d152012-01-04 20:05:49 +0000894 ALOGI("flushDecoder %s without decoder present",
Andreas Huber6e3d3112011-11-28 12:36:11 -0800895 audio ? "audio" : "video");
896 }
897
Andreas Huber1aef2112011-01-04 14:01:29 -0800898 // Make sure we don't continue to scan sources until we finish flushing.
899 ++mScanSourcesGeneration;
Andreas Huber43c3e6c2011-01-05 12:17:08 -0800900 mScanSourcesPending = false;
Andreas Huber1aef2112011-01-04 14:01:29 -0800901
902 (audio ? mAudioDecoder : mVideoDecoder)->signalFlush();
903 mRenderer->flush(audio);
904
905 FlushStatus newStatus =
906 needShutdown ? FLUSHING_DECODER_SHUTDOWN : FLUSHING_DECODER;
907
908 if (audio) {
909 CHECK(mFlushingAudio == NONE
910 || mFlushingAudio == AWAITING_DISCONTINUITY);
911
912 mFlushingAudio = newStatus;
913
914 if (mFlushingVideo == NONE) {
915 mFlushingVideo = (mVideoDecoder != NULL)
916 ? AWAITING_DISCONTINUITY
917 : FLUSHED;
918 }
919 } else {
920 CHECK(mFlushingVideo == NONE
921 || mFlushingVideo == AWAITING_DISCONTINUITY);
922
923 mFlushingVideo = newStatus;
924
925 if (mFlushingAudio == NONE) {
926 mFlushingAudio = (mAudioDecoder != NULL)
927 ? AWAITING_DISCONTINUITY
928 : FLUSHED;
929 }
930 }
931}
932
Andreas Huberf9334412010-12-15 15:17:42 -0800933} // namespace android