1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/camera/update2.patch Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,163 @@ 1.4 +diff --git a/dom/camera/GonkCameraSource.cpp b/dom/camera/GonkCameraSource.cpp 1.5 +--- a/dom/camera/GonkCameraSource.cpp 1.6 ++++ b/dom/camera/GonkCameraSource.cpp 1.7 +@@ -492,21 +492,17 @@ status_t GonkCameraSource::init( 1.8 + mMeta = new MetaData; 1.9 + mMeta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_VIDEO_RAW); 1.10 + mMeta->setInt32(kKeyColorFormat, mColorFormat); 1.11 + mMeta->setInt32(kKeyWidth, mVideoSize.width); 1.12 + mMeta->setInt32(kKeyHeight, mVideoSize.height); 1.13 + mMeta->setInt32(kKeyStride, mVideoSize.width); 1.14 + mMeta->setInt32(kKeySliceHeight, mVideoSize.height); 1.15 + mMeta->setInt32(kKeyFrameRate, mVideoFrameRate); 1.16 +- mMeta->setInt32(kKeyHFR, hfr); 1.17 + 1.18 +- if (want3D) { 1.19 +- mMeta->setInt32(kKey3D, !0); 1.20 +- } 1.21 + return OK; 1.22 + } 1.23 + 1.24 + GonkCameraSource::~GonkCameraSource() { 1.25 + if (mStarted) { 1.26 + stop(); 1.27 + } else if (mInitCheck == OK) { 1.28 + // Camera is initialized but because start() is never called, 1.29 +diff --git a/dom/camera/GonkRecorder.cpp b/dom/camera/GonkRecorder.cpp 1.30 +--- a/dom/camera/GonkRecorder.cpp 1.31 ++++ b/dom/camera/GonkRecorder.cpp 1.32 +@@ -716,56 +716,16 @@ status_t GonkRecorder::start() { 1.33 + mStarted = true; 1.34 + } 1.35 + 1.36 + return status; 1.37 + } 1.38 + 1.39 + sp<MediaSource> GonkRecorder::createAudioSource() { 1.40 + 1.41 +- bool tunneledSource = false; 1.42 +- const char *tunnelMime; 1.43 +- { 1.44 +- AudioParameter param; 1.45 +- String8 key("tunneled-input-formats"); 1.46 +- param.add( key, String8("get") ); 1.47 +- String8 valueStr = AudioSystem::getParameters( 0, param.toString()); 1.48 +- AudioParameter result(valueStr); 1.49 +- int value; 1.50 +- if ( mAudioEncoder == AUDIO_ENCODER_AMR_NB && 1.51 +- result.getInt(String8("AMR"),value) == NO_ERROR ) { 1.52 +- tunneledSource = true; 1.53 +- tunnelMime = MEDIA_MIMETYPE_AUDIO_AMR_NB; 1.54 +- } 1.55 +- else if ( mAudioEncoder == AUDIO_ENCODER_QCELP && 1.56 +- result.getInt(String8("QCELP"),value) == NO_ERROR ) { 1.57 +- tunneledSource = true; 1.58 +- tunnelMime = MEDIA_MIMETYPE_AUDIO_QCELP; 1.59 +- } 1.60 +- else if ( mAudioEncoder == AUDIO_ENCODER_EVRC && 1.61 +- result.getInt(String8("EVRC"),value) == NO_ERROR ) { 1.62 +- tunneledSource = true; 1.63 +- tunnelMime = MEDIA_MIMETYPE_AUDIO_EVRC; 1.64 +- } 1.65 +- } 1.66 +- 1.67 +- if ( tunneledSource ) { 1.68 +- sp<AudioSource> audioSource = NULL; 1.69 +- sp<MetaData> meta = new MetaData; 1.70 +- meta->setInt32(kKeyChannelCount, mAudioChannels); 1.71 +- meta->setInt32(kKeySampleRate, mSampleRate); 1.72 +- meta->setInt32(kKeyBitRate, mAudioBitRate); 1.73 +- if (mAudioTimeScale > 0) { 1.74 +- meta->setInt32(kKeyTimeScale, mAudioTimeScale); 1.75 +- } 1.76 +- meta->setCString( kKeyMIMEType, tunnelMime ); 1.77 +- audioSource = new AudioSource( mAudioSource, meta); 1.78 +- return audioSource->initCheck( ) == OK ? audioSource : NULL; 1.79 +- } 1.80 +- 1.81 + sp<AudioSource> audioSource = 1.82 + new AudioSource( 1.83 + mAudioSource, 1.84 + mSampleRate, 1.85 + mAudioChannels); 1.86 + 1.87 + status_t err = audioSource->initCheck(); 1.88 + 1.89 +@@ -1226,56 +1186,33 @@ status_t GonkRecorder::setupVideoEncoder 1.90 + 1.91 + default: 1.92 + CHECK(!"Should not be here, unsupported video encoding."); 1.93 + break; 1.94 + } 1.95 + 1.96 + sp<MetaData> meta = cameraSource->getFormat(); 1.97 + 1.98 +- int32_t width, height, stride, sliceHeight, colorFormat, hfr, is3D; 1.99 ++ int32_t width, height, stride, sliceHeight, colorFormat; 1.100 + CHECK(meta->findInt32(kKeyWidth, &width)); 1.101 + CHECK(meta->findInt32(kKeyHeight, &height)); 1.102 + CHECK(meta->findInt32(kKeyStride, &stride)); 1.103 + CHECK(meta->findInt32(kKeySliceHeight, &sliceHeight)); 1.104 + CHECK(meta->findInt32(kKeyColorFormat, &colorFormat)); 1.105 +- CHECK(meta->findInt32(kKeyHFR, &hfr)); 1.106 +- 1.107 +- if(hfr) { 1.108 +- mMaxFileDurationUs = mMaxFileDurationUs * (hfr/mFrameRate); 1.109 +- } 1.110 +- 1.111 + 1.112 + enc_meta->setInt32(kKeyWidth, width); 1.113 + enc_meta->setInt32(kKeyHeight, height); 1.114 + enc_meta->setInt32(kKeyIFramesInterval, mIFramesIntervalSec); 1.115 + enc_meta->setInt32(kKeyStride, stride); 1.116 + enc_meta->setInt32(kKeySliceHeight, sliceHeight); 1.117 + enc_meta->setInt32(kKeyColorFormat, colorFormat); 1.118 +- enc_meta->setInt32(kKeyHFR, hfr); 1.119 + if (mVideoTimeScale > 0) { 1.120 + enc_meta->setInt32(kKeyTimeScale, mVideoTimeScale); 1.121 + } 1.122 + 1.123 +- char mDeviceName[100]; 1.124 +- property_get("ro.board.platform",mDeviceName,"0"); 1.125 +- if(!strncmp(mDeviceName, "msm7627a", 8)) { 1.126 +- if(hfr && (width * height > 432*240)) { 1.127 +- LOGE("HFR mode is supported only upto WQVGA resolution"); 1.128 +- return INVALID_OPERATION; 1.129 +- } 1.130 +- } 1.131 +- else { 1.132 +- if(hfr && ((mVideoEncoder != VIDEO_ENCODER_H264) || (width * height > 800*480))) { 1.133 +- LOGE("HFR mode is supported only upto WVGA and H264 codec."); 1.134 +- return INVALID_OPERATION; 1.135 +- } 1.136 +- } 1.137 +- 1.138 +- 1.139 + /* 1.140 + * can set profile from the app as a parameter. 1.141 + * For the mean time, set from shell 1.142 + */ 1.143 + 1.144 + char value[PROPERTY_VALUE_MAX]; 1.145 + bool customProfile = false; 1.146 + 1.147 +@@ -1322,19 +1259,16 @@ status_t GonkRecorder::setupVideoEncoder 1.148 + } 1.149 + 1.150 + if (mVideoEncoderProfile != -1) { 1.151 + enc_meta->setInt32(kKeyVideoProfile, mVideoEncoderProfile); 1.152 + } 1.153 + if (mVideoEncoderLevel != -1) { 1.154 + enc_meta->setInt32(kKeyVideoLevel, mVideoEncoderLevel); 1.155 + } 1.156 +- if (meta->findInt32(kKey3D, &is3D)) { 1.157 +- enc_meta->setInt32(kKey3D, is3D); 1.158 +- } 1.159 + 1.160 + uint32_t encoder_flags = 0; 1.161 + if (mIsMetaDataStoredInVideoBuffers) { 1.162 + LOGW("Camera source supports metadata mode, create OMXCodec for metadata"); 1.163 + encoder_flags |= OMXCodec::kHardwareCodecsOnly; 1.164 + encoder_flags |= OMXCodec::kStoreMetaDataInVideoBuffers; 1.165 + encoder_flags |= OMXCodec::kOnlySubmitOneInputBufferAtOneTime; 1.166 + }