Name Description Size
ContainerWriter.h ContainerWriter packs encoded track data into a specific media container. 2619
EncodedFrame.h 2372
MediaEncoder.cpp 29603
MediaEncoder.h MediaEncoder is the framework of encoding module, it controls and manages procedures between ContainerWriter and TrackEncoder. ContainerWriter packs the encoded track data with a specific container (e.g. ogg, webm). AudioTrackEncoder and VideoTrackEncoder are subclasses of TrackEncoder, and are responsible for encoding raw data coming from MediaTrackGraph. MediaEncoder solves threading issues by doing message passing to a TaskQueue (the "encoder thread") as passed in to the constructor. Each MediaStreamTrack to be recorded is set up with a MediaTrackListener. Typically there are a non-direct track listeners for audio, direct listeners for video, and there is always a non-direct listener on each track for time-keeping. The listeners forward data to their corresponding TrackEncoders on the encoder thread. The MediaEncoder listens to events from all TrackEncoders, and in turn signals events to interested parties. Typically a MediaRecorder::Session. The event that there's data available in the TrackEncoders is what typically drives the extraction and muxing of data. MediaEncoder is designed to be a passive component, neither does it own or is in charge of managing threads. Instead this is done by its owner. For example, usage from MediaRecorder of this component would be: 1) Create an encoder with a valid MIME type. => encoder = MediaEncoder::CreateEncoder(aMIMEType); It then creates a ContainerWriter according to the MIME type 2) Connect a MediaEncoderListener to be notified when the MediaEncoder has been initialized and when there's data available. => encoder->RegisterListener(listener); 3) Connect the sources to be recorded. Either through: => encoder->ConnectAudioNode(node); or => encoder->ConnectMediaStreamTrack(track); These should not be mixed. When connecting MediaStreamTracks there is support for at most one of each kind. 4) When the MediaEncoderListener is notified that the MediaEncoder has data available, we can encode data. This also encodes metadata on its first invocation. => encoder->GetEncodedData(...); 5) To stop encoding, there are multiple options: 5.1) Stop() for a graceful stop. => encoder->Stop(); 5.2) Cancel() for an immediate stop, if you don't need the data currently buffered. => encoder->Cancel(); 5.3) When all input tracks end, the MediaEncoder will automatically stop and shut down. 9688
Muxer.cpp 7952
Muxer.h 2771
OpusTrackEncoder.cpp 16340
OpusTrackEncoder.h Get the samplerate of the data to be fed to the Opus encoder. This might be different from the input samplerate if resampling occurs. 2630
TrackEncoder.cpp 25097
TrackEncoder.h Called when the TrackEncoder's underlying encoder has been successfully initialized and there's non-null data ready to be encoded. 15636
TrackMetadataBase.h 2495
VP8TrackEncoder.cpp 19444
VP8TrackEncoder.h VP8TrackEncoder implements VideoTrackEncoder by using the libvpx library. We implement a realtime and variable frame rate encoder. In order to achieve that, there is a frame-drop encoding policy implemented in GetEncodedTrack. 3700 1279