mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-26 20:25:34 +08:00
[feat] use decode thread to decode frame
This commit is contained in:
@@ -32,6 +32,9 @@ IceTransportController::~IceTransportController() {
|
|||||||
if (task_queue_encode_) {
|
if (task_queue_encode_) {
|
||||||
task_queue_encode_->ClearTasks();
|
task_queue_encode_->ClearTasks();
|
||||||
}
|
}
|
||||||
|
if (task_queue_decode_) {
|
||||||
|
task_queue_decode_->ClearTasks();
|
||||||
|
}
|
||||||
|
|
||||||
user_data_ = nullptr;
|
user_data_ = nullptr;
|
||||||
video_codec_inited_ = false;
|
video_codec_inited_ = false;
|
||||||
@@ -323,6 +326,8 @@ int IceTransportController::OnReceiveDataRtpPacket(const char* data,
|
|||||||
|
|
||||||
void IceTransportController::OnReceiveCompleteFrame(
|
void IceTransportController::OnReceiveCompleteFrame(
|
||||||
const ReceivedFrame& received_frame) {
|
const ReceivedFrame& received_frame) {
|
||||||
|
task_queue_decode_->PostTask([this, received_frame]() mutable {
|
||||||
|
if (video_decoder_) {
|
||||||
int num_frame_returned = video_decoder_->Decode(
|
int num_frame_returned = video_decoder_->Decode(
|
||||||
received_frame, [this](DecodedFrame decoded_frame) {
|
received_frame, [this](DecodedFrame decoded_frame) {
|
||||||
if (on_receive_video_) {
|
if (on_receive_video_) {
|
||||||
@@ -331,14 +336,19 @@ void IceTransportController::OnReceiveCompleteFrame(
|
|||||||
x_video_frame.width = decoded_frame.Width();
|
x_video_frame.width = decoded_frame.Width();
|
||||||
x_video_frame.height = decoded_frame.Height();
|
x_video_frame.height = decoded_frame.Height();
|
||||||
x_video_frame.size = decoded_frame.Size();
|
x_video_frame.size = decoded_frame.Size();
|
||||||
x_video_frame.captured_timestamp = decoded_frame.CapturedTimestamp();
|
x_video_frame.captured_timestamp =
|
||||||
x_video_frame.received_timestamp = decoded_frame.ReceivedTimestamp();
|
decoded_frame.CapturedTimestamp();
|
||||||
x_video_frame.decoded_timestamp = decoded_frame.DecodedTimestamp();
|
x_video_frame.received_timestamp =
|
||||||
|
decoded_frame.ReceivedTimestamp();
|
||||||
|
x_video_frame.decoded_timestamp =
|
||||||
|
decoded_frame.DecodedTimestamp();
|
||||||
on_receive_video_(&x_video_frame, remote_user_id_.data(),
|
on_receive_video_(&x_video_frame, remote_user_id_.data(),
|
||||||
remote_user_id_.size(), user_data_);
|
remote_user_id_.size(), user_data_);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void IceTransportController::OnReceiveCompleteAudio(const char* data,
|
void IceTransportController::OnReceiveCompleteAudio(const char* data,
|
||||||
size_t size) {
|
size_t size) {
|
||||||
|
|||||||
Reference in New Issue
Block a user