调用顺序
MediaRecorder.java
+- android_media_MediaRecorder.cpp
+- MediaRecorder.cpp
+- MediaPlayerService.cpp
+- MediaRecorderClient.cpp
+- StagefrightRecorder.cpp
重要的类
* MediaWriter
+- MPEG4Writer
* MediaSource
+- CameraSource
数据流向
Camera
|
| CameraListener#postDataTimestamp(raw frame)
|
\ /
CameraSource(MediaSource)
|
| read(raw frame)
|
\ /
OMXCodec Encoder(MediaSource)
|
| read(encoded frame)
|
\ /
MPEG4Writer(MediaWriter)
|
| mux
|
\ /
MP4 File
CameraSource 帧队列
List<sp<IMemory> > mFrames; // 帧
List<int64_t> mFrameTimes; // 帖的相对时间戳
- read 消费者线程
- dataCallbackTimestamp 生产者线程