37
41
SharedGObject<GstElement> TestSourceMediaManager::ConstructPipeline(const wds::H264VideoFormat &format) {
38
auto config = Utils::Sprintf("videotestsrc ! videoconvert ! video/x-raw,format=I420 ! x264enc ! mpegtsmux ! rtpmp2tpay ! udpsink name=sink host=%s port=%d",
39
remote_address_.c_str(), sink_port1_);
42
auto profile = mcs::video::ExtractH264Profile(format);
43
auto rr = mcs::video::ExtractRateAndResolution(format);
47
ss << Utils::Sprintf("videotestsrc ! video/x-raw,format=I420,framerate=%d/1,width=%d,height=%d,pixel-aspect-ratio=1/1 ! ", rr.framerate, rr.width, rr.height);
48
ss << "x264enc tune=zerolatency byte-stream=true ! ";
49
ss << Utils::Sprintf("video/x-h264,profile=%s ! ", profile.c_str());
50
ss << "mpegtsmux ! rtpmp2tpay ! ";
51
ss << Utils::Sprintf("udpsink name=sink host=%s port=%d", remote_address_.c_str(), sink_port1_);
55
ss << Utils::Sprintf("videoconvert ! video/x-raw,format=I420,framerate=%d/1,pixel-aspect-ratio=1/1 ! ", rr.framerate);
56
ss << Utils::Sprintf("videoscale ! video/x-raw,width=%d,height=%d ! ", rr.width, rr.height);
58
ss << "x264enc byte-stream=true tune=zerolatency interlaced=false ! ";
59
ss << Utils::Sprintf("video/x-h264,profile=%s !", profile.c_str());
60
ss << "mpegtsmux ! rtpmp2tpay ! ";
61
ss << Utils::Sprintf("udpsink name=sink host=%s port=%d", remote_address_.c_str(), sink_port1_);
64
DEBUG("pipeline: %s", ss.str());
41
66
GError *error = nullptr;
42
GstElement *pipeline = gst_parse_launch(config.c_str(), &error);
67
GstElement *pipeline = gst_parse_launch(ss.str().c_str(), &error);
44
WARNING("Failed to setup GStreamer pipeline: %s", error->message);
69
ERROR("Failed to setup GStreamer pipeline: %s", error->message);
45
70
g_error_free(error);