|
1 diff --git a/dom/camera/GonkCameraSource.cpp b/dom/camera/GonkCameraSource.cpp |
|
2 --- a/dom/camera/GonkCameraSource.cpp |
|
3 +++ b/dom/camera/GonkCameraSource.cpp |
|
4 @@ -492,21 +492,17 @@ status_t GonkCameraSource::init( |
|
5 mMeta = new MetaData; |
|
6 mMeta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_VIDEO_RAW); |
|
7 mMeta->setInt32(kKeyColorFormat, mColorFormat); |
|
8 mMeta->setInt32(kKeyWidth, mVideoSize.width); |
|
9 mMeta->setInt32(kKeyHeight, mVideoSize.height); |
|
10 mMeta->setInt32(kKeyStride, mVideoSize.width); |
|
11 mMeta->setInt32(kKeySliceHeight, mVideoSize.height); |
|
12 mMeta->setInt32(kKeyFrameRate, mVideoFrameRate); |
|
13 - mMeta->setInt32(kKeyHFR, hfr); |
|
14 |
|
15 - if (want3D) { |
|
16 - mMeta->setInt32(kKey3D, !0); |
|
17 - } |
|
18 return OK; |
|
19 } |
|
20 |
|
21 GonkCameraSource::~GonkCameraSource() { |
|
22 if (mStarted) { |
|
23 stop(); |
|
24 } else if (mInitCheck == OK) { |
|
25 // Camera is initialized but because start() is never called, |
|
26 diff --git a/dom/camera/GonkRecorder.cpp b/dom/camera/GonkRecorder.cpp |
|
27 --- a/dom/camera/GonkRecorder.cpp |
|
28 +++ b/dom/camera/GonkRecorder.cpp |
|
29 @@ -716,56 +716,16 @@ status_t GonkRecorder::start() { |
|
30 mStarted = true; |
|
31 } |
|
32 |
|
33 return status; |
|
34 } |
|
35 |
|
36 sp<MediaSource> GonkRecorder::createAudioSource() { |
|
37 |
|
38 - bool tunneledSource = false; |
|
39 - const char *tunnelMime; |
|
40 - { |
|
41 - AudioParameter param; |
|
42 - String8 key("tunneled-input-formats"); |
|
43 - param.add( key, String8("get") ); |
|
44 - String8 valueStr = AudioSystem::getParameters( 0, param.toString()); |
|
45 - AudioParameter result(valueStr); |
|
46 - int value; |
|
47 - if ( mAudioEncoder == AUDIO_ENCODER_AMR_NB && |
|
48 - result.getInt(String8("AMR"),value) == NO_ERROR ) { |
|
49 - tunneledSource = true; |
|
50 - tunnelMime = MEDIA_MIMETYPE_AUDIO_AMR_NB; |
|
51 - } |
|
52 - else if ( mAudioEncoder == AUDIO_ENCODER_QCELP && |
|
53 - result.getInt(String8("QCELP"),value) == NO_ERROR ) { |
|
54 - tunneledSource = true; |
|
55 - tunnelMime = MEDIA_MIMETYPE_AUDIO_QCELP; |
|
56 - } |
|
57 - else if ( mAudioEncoder == AUDIO_ENCODER_EVRC && |
|
58 - result.getInt(String8("EVRC"),value) == NO_ERROR ) { |
|
59 - tunneledSource = true; |
|
60 - tunnelMime = MEDIA_MIMETYPE_AUDIO_EVRC; |
|
61 - } |
|
62 - } |
|
63 - |
|
64 - if ( tunneledSource ) { |
|
65 - sp<AudioSource> audioSource = NULL; |
|
66 - sp<MetaData> meta = new MetaData; |
|
67 - meta->setInt32(kKeyChannelCount, mAudioChannels); |
|
68 - meta->setInt32(kKeySampleRate, mSampleRate); |
|
69 - meta->setInt32(kKeyBitRate, mAudioBitRate); |
|
70 - if (mAudioTimeScale > 0) { |
|
71 - meta->setInt32(kKeyTimeScale, mAudioTimeScale); |
|
72 - } |
|
73 - meta->setCString( kKeyMIMEType, tunnelMime ); |
|
74 - audioSource = new AudioSource( mAudioSource, meta); |
|
75 - return audioSource->initCheck( ) == OK ? audioSource : NULL; |
|
76 - } |
|
77 - |
|
78 sp<AudioSource> audioSource = |
|
79 new AudioSource( |
|
80 mAudioSource, |
|
81 mSampleRate, |
|
82 mAudioChannels); |
|
83 |
|
84 status_t err = audioSource->initCheck(); |
|
85 |
|
86 @@ -1226,56 +1186,33 @@ status_t GonkRecorder::setupVideoEncoder |
|
87 |
|
88 default: |
|
89 CHECK(!"Should not be here, unsupported video encoding."); |
|
90 break; |
|
91 } |
|
92 |
|
93 sp<MetaData> meta = cameraSource->getFormat(); |
|
94 |
|
95 - int32_t width, height, stride, sliceHeight, colorFormat, hfr, is3D; |
|
96 + int32_t width, height, stride, sliceHeight, colorFormat; |
|
97 CHECK(meta->findInt32(kKeyWidth, &width)); |
|
98 CHECK(meta->findInt32(kKeyHeight, &height)); |
|
99 CHECK(meta->findInt32(kKeyStride, &stride)); |
|
100 CHECK(meta->findInt32(kKeySliceHeight, &sliceHeight)); |
|
101 CHECK(meta->findInt32(kKeyColorFormat, &colorFormat)); |
|
102 - CHECK(meta->findInt32(kKeyHFR, &hfr)); |
|
103 - |
|
104 - if(hfr) { |
|
105 - mMaxFileDurationUs = mMaxFileDurationUs * (hfr/mFrameRate); |
|
106 - } |
|
107 - |
|
108 |
|
109 enc_meta->setInt32(kKeyWidth, width); |
|
110 enc_meta->setInt32(kKeyHeight, height); |
|
111 enc_meta->setInt32(kKeyIFramesInterval, mIFramesIntervalSec); |
|
112 enc_meta->setInt32(kKeyStride, stride); |
|
113 enc_meta->setInt32(kKeySliceHeight, sliceHeight); |
|
114 enc_meta->setInt32(kKeyColorFormat, colorFormat); |
|
115 - enc_meta->setInt32(kKeyHFR, hfr); |
|
116 if (mVideoTimeScale > 0) { |
|
117 enc_meta->setInt32(kKeyTimeScale, mVideoTimeScale); |
|
118 } |
|
119 |
|
120 - char mDeviceName[100]; |
|
121 - property_get("ro.board.platform",mDeviceName,"0"); |
|
122 - if(!strncmp(mDeviceName, "msm7627a", 8)) { |
|
123 - if(hfr && (width * height > 432*240)) { |
|
124 - LOGE("HFR mode is supported only upto WQVGA resolution"); |
|
125 - return INVALID_OPERATION; |
|
126 - } |
|
127 - } |
|
128 - else { |
|
129 - if(hfr && ((mVideoEncoder != VIDEO_ENCODER_H264) || (width * height > 800*480))) { |
|
130 - LOGE("HFR mode is supported only upto WVGA and H264 codec."); |
|
131 - return INVALID_OPERATION; |
|
132 - } |
|
133 - } |
|
134 - |
|
135 - |
|
136 /* |
|
137 * can set profile from the app as a parameter. |
|
138 * For the mean time, set from shell |
|
139 */ |
|
140 |
|
141 char value[PROPERTY_VALUE_MAX]; |
|
142 bool customProfile = false; |
|
143 |
|
144 @@ -1322,19 +1259,16 @@ status_t GonkRecorder::setupVideoEncoder |
|
145 } |
|
146 |
|
147 if (mVideoEncoderProfile != -1) { |
|
148 enc_meta->setInt32(kKeyVideoProfile, mVideoEncoderProfile); |
|
149 } |
|
150 if (mVideoEncoderLevel != -1) { |
|
151 enc_meta->setInt32(kKeyVideoLevel, mVideoEncoderLevel); |
|
152 } |
|
153 - if (meta->findInt32(kKey3D, &is3D)) { |
|
154 - enc_meta->setInt32(kKey3D, is3D); |
|
155 - } |
|
156 |
|
157 uint32_t encoder_flags = 0; |
|
158 if (mIsMetaDataStoredInVideoBuffers) { |
|
159 LOGW("Camera source supports metadata mode, create OMXCodec for metadata"); |
|
160 encoder_flags |= OMXCodec::kHardwareCodecsOnly; |
|
161 encoder_flags |= OMXCodec::kStoreMetaDataInVideoBuffers; |
|
162 encoder_flags |= OMXCodec::kOnlySubmitOneInputBufferAtOneTime; |
|
163 } |