Skip to content

Commit

Permalink
Refactor encoding/decoding pipeline.
Browse files Browse the repository at this point in the history
* Add sample format and channels to MediaInfo struct.
* Move MediaInfo, RTPInfo, ProcessorType structs into a single file.
* Abstract audio/video enc/dec from Input/OutputProcessor.
* Abstract basic enc/dec FFmpeg API into Coder class.
* Rename variables to follow cpp code guideline.
  • Loading branch information
zevarito committed May 22, 2018
1 parent fb5a464 commit 6d21295
Show file tree
Hide file tree
Showing 12 changed files with 442 additions and 598 deletions.
2 changes: 1 addition & 1 deletion erizo/src/erizo/media/ExternalInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ void ExternalInput::receiveLoop() {
AVPacket orig_pkt = avpacket_;
if (needTranscoding_) {
if (avpacket_.stream_index == video_stream_index_) { // packet is video
inCodec_.decodeVideo(avpacket_.data, avpacket_.size, decodedBuffer_.get(), bufflen_, &gotDecodedFrame);
inCodec_.decodeVideoBuffer(avpacket_.data, avpacket_.size, decodedBuffer_.get(), bufflen_, &gotDecodedFrame);
RawDataPacket packetR;
if (gotDecodedFrame) {
packetR.data = decodedBuffer_.get();
Expand Down
36 changes: 36 additions & 0 deletions erizo/src/erizo/media/MediaInfo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#ifndef ERIZO_SRC_ERIZO_MEDIA_MEDIAINFO_H_
#define ERIZO_SRC_ERIZO_MEDIA_MEDIAINFO_H_

extern "C" {
#include <libavcodec/avcodec.h>
}

#include <string>
#include "codecs/Codecs.h"

namespace erizo {

struct RTPInfo {
enum AVCodecID codec;
unsigned int ssrc;
unsigned int PT;
};

enum ProcessorType {
RTP_ONLY, AVF, PACKAGE_ONLY
};

struct MediaInfo {
std::string url;
bool hasVideo;
bool hasAudio;
ProcessorType processorType;
RTPInfo rtpVideoInfo;
RTPInfo rtpAudioInfo;
VideoCodecInfo videoCodec;
AudioCodecInfo audioCodec;
};

} // namespace erizo

#endif // ERIZO_SRC_ERIZO_MEDIA_MEDIAINFO_H_
Loading

0 comments on commit 6d21295

Please sign in to comment.