标签:
编码那一块
\pizza\frameworks\av\media\libstagefright\wifi-display\source\Converter.h
// Utility class that receives media access units and converts them into
// media access unit of a different format.
// Right now this‘ll convert raw video into H.264 and raw audio into AAC.
struct Converter : public AHandler {
Converter(
const sp<AMessage> ¬ify,
const sp<ALooper> &codecLooper,
const sp<AMessage> &format,
bool usePCMAudio,
bool isRecordingScreen);bool mIsRecordingScreen;
pizza\frameworks\av\media\libstagefright\wifi-display\source\Converter.cpp
Converter::Converter(
const sp<AMessage> ¬ify,
const sp<ALooper> &codecLooper,
const sp<AMessage> &format,
bool usePCMAudio,
bool isRecordingScreen)
: mInitCheck(NO_INIT),
mNotify(notify),
mCodecLooper(codecLooper),
mInputFormat(format),
mIsVideo(false),
mIsPCMAudio(usePCMAudio),
mNeedToManuallyPrependSPSPPS(false),
mDoMoreWorkPending(false)
#if ENABLE_SILENCE_DETECTION
,mFirstSilentFrameUs(-1ll)
,mInSilentMode(false)
#endif
{
AString mime;
CHECK(mInputFormat->findString("mime", &mime));
mIsRecordingScreen = isRecordingScreen;
if (!strncasecmp("video/", mime.c_str(), 6)) {
mIsVideo = true;
}CHECK(!usePCMAudio || !mIsVideo);
mInitCheck = initEncoder();
if (mInitCheck != OK) {
if (mEncoder != NULL) {
mEncoder->release();
mEncoder.clear();
}
}
}void Converter::shutdownAsync() {
ALOGV("shutdown");
if(!mIsRecordingScreen)
{
(new AMessage(kWhatShutdown, id()))->post();
return;
}#if 1 //{
if (mEncoder != NULL) {
mEncoder->release();
mEncoder.clear();
}
#endif //}
}
void MediaPuller::onMessageReceived(const sp<AMessage> &msg) {
switch (msg->what()) {
case kWhatStart:
{
status_t err;
if (mIsAudio) {
// This atrocity causes AudioSource to deliver absolute
// systemTime() based timestamps (off by 1 us).
sp<MetaData> params = new MetaData;
params->setInt64(kKeyTime, 1ll);
err = mSource->start(params.get());
} else {
sp<MetaData> params = new MetaData;// 是不是将关键帧设置了只有三个
params->setInt32(kKeyNumBuffers,3 );
err = mSource->start(params.get());
}
pizza\frameworks\av\media\libstagefright\wifi-display\source\PlaybackSession.h
android4.2 WifiDisplay远程显示修改为保存文件
标签:
原文地址:http://www.cnblogs.com/pengxinglove/p/5551156.html