Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Beginner
13 Views

VideoEncoderInterface相关问题

1,VideoEncoderInterface类中的EncodeOneFrame这个方法会被自动调用吗?

2,我采用4.2的sdk开发,自定义编码器,程序会直接崩溃掉。代码如下:

void OWTController::publish(function<void(int ret)> callback)
{
	//自定义采集
	if (!local_stream.get()) {
		Resolution resolution;
		resolution.width = 1920;
		resolution.height = 1080;
		int fps = 30;

		lcsp.reset(new LocalCustomizedStreamParameters(false, true));
		lcsp->Resolution(resolution.width, resolution.height);
		lcsp->Fps(fps);
		lcsp->Bitrate(4000);
		
		encoder.reset(new H264VideoEncoder(1920,1080));
		encoder->InitEncoderContext(resolution, fps, lcsp->Bitrate(), VideoCodec::kH264);
		local_stream = LocalStream::Create(lcsp,encoder.get());
	}

	pc->Publish(remote_peer_id,
		local_stream,
		[=](std::shared_ptr<P2PPublication> publication) {
			this->publication = publication;
			callback(1);
		},
		[=](std::unique_ptr<Exception> ex) {
			callback(0);
			printf("connect server failed! %s :", ex->Message().c_str());
		});
}

在执行publish方法推流后就会弹 Debug Error 的弹框。实在查不出问题在哪。

版主能帮忙指点下吗?

Tags (2)
0 Kudos