Files
android/proprietary/wvm/include/WVMExtractorImpl.h
Fred Gylys-Colwell 0b7d0f3fe3 Fix pause at end of movie.
The function WVMExtractorImpl::getCachedDurationUs returns the cached buffer
size in microseconds, and sets a status to ERROR_END_OF_STREAM at the end of
the movie.  The AwesomePlayer will pause if the cache is too small and the
status is not EOS.  In bug 6277231, the player would pause just before the EOS
marker would have been seen by the Widevine library.

This change checks the current play time against the total movie duration.  If
there is less than 10 seconds left in the movie, the EOS flag is set.

related-to-bug: 6277231

Change-Id: I8dbf60c82c41df485185f85e72452aab0a6a9686
2012-05-31 16:01:42 -07:00

92 lines
2.3 KiB
C++

/*
* Copyright (C) 2011 Google, Inc. All Rights Reserved
*/
#ifndef WVMEXTRACTOR_H_
#define WVMEXTRACTOR_H_
#include "AndroidConfig.h"
#include "WVStreamControlAPI.h"
#include "WVMInfoListener.h"
#include "WVMExtractor.h"
#include <media/stagefright/DataSource.h>
#include <utils/RefBase.h>
// DLL entry - given a data source, instantiate a WVMExtractor object
namespace android {
WVMLoadableExtractor *GetInstance(sp<DataSource> dataSource);
bool IsWidevineMedia(const sp<DataSource>& dataSource);
class WVMMediaSource;
class WVMFileSource;
class WVMExtractorImpl : public WVMLoadableExtractor {
public:
WVMExtractorImpl(sp<DataSource> dataSource);
virtual size_t countTracks();
virtual sp<MediaSource> getTrack(size_t index);
virtual sp<MetaData> getTrackMetaData(size_t index, uint32_t flags);
virtual sp<MetaData> getMetaData();
virtual int64_t getCachedDurationUs(status_t *finalStatus);
virtual void setAdaptiveStreamingMode(bool adaptive);
bool getAdaptiveStreamingMode() const;
//
// if in CryptoPlugin mode, the extractor doesn't decrypt,
// it just accumulates the ranges of data requiring decryption
// into the MediaBuffer's metadata, the decryption happens
// later via the CryptoPlugin
//
virtual void setCryptoPluginMode(bool cryptoPluginMode);
virtual void setUID(uid_t uid);
static void SocketInfoCallback(int fd, int op, void *context);
static void cleanup();
protected:
virtual ~WVMExtractorImpl();
void Initialize();
private:
status_t readAVCCMetaData(sp<MetaData> videoMetaData);
status_t readESDSMetaData(sp<MetaData> audioMetaData);
sp<WVMMediaSource> mAudioSource;
sp<WVMMediaSource> mVideoSource;
sp<MetaData> mFileMetaData;
sp<WVMFileSource> mFileSource;
sp<DataSource> mDataSource;
sp<WVMInfoListener> mInfoListener;
sp<ClientContext> mClientContext;
bool mHaveMetaData;
bool mUseAdaptiveStreaming;
bool mIsLiveStream;
bool mAdaptivePrefetching;
WVSession *mSession;
int64_t mDuration; // usec.
status_t mSetupStatus;
status_t readMetaData();
const static size_t kStreamCacheSize = 10 * 1024 * 1024;
WVMExtractorImpl(const WVMExtractorImpl &);
WVMExtractorImpl &operator=(const WVMExtractorImpl &);
};
} // namespace android
#endif // WVMEXTRACTOR_H_