From 3a7423909164538a047a0bd93ae0dfbb575ba2dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Mon, 8 Oct 2018 11:13:58 +0200 Subject: [PATCH] Fix compilation issues on media_transport_interface.h Include api/video/encoded_image.h, and move constructors and destructors to .cc file. Bug: webrtc:9719 Change-Id: Ibecdc1151bf672155d3c09e13749ac39c921c3aa Reviewed-on: https://webrtc-review.googlesource.com/c/104560 Reviewed-by: Karl Wiberg Commit-Queue: Niels Moller Cr-Commit-Position: refs/heads/master@{#25044} --- api/BUILD.gn | 2 ++ api/media_transport_interface.cc | 52 ++++++++++++++++++++++++++++++++ api/media_transport_interface.h | 19 ++++-------- 3 files changed, 60 insertions(+), 13 deletions(-) create mode 100644 api/media_transport_interface.cc diff --git a/api/BUILD.gn b/api/BUILD.gn index 5b21334fe9..5fdebc9140 100644 --- a/api/BUILD.gn +++ b/api/BUILD.gn @@ -63,6 +63,7 @@ rtc_static_library("libjingle_peerconnection_api") { "jsepicecandidate.cc", "jsepicecandidate.h", "jsepsessiondescription.h", + "media_transport_interface.cc", "media_transport_interface.h", "mediaconstraintsinterface.cc", "mediaconstraintsinterface.h", @@ -109,6 +110,7 @@ rtc_static_library("libjingle_peerconnection_api") { "audio_codecs:audio_codecs_api", "transport:bitrate_settings", "transport:network_control", + "video:encoded_image", "video:video_frame", "//third_party/abseil-cpp/absl/types:optional", diff --git a/api/media_transport_interface.cc b/api/media_transport_interface.cc new file mode 100644 index 0000000000..13bc98297f --- /dev/null +++ b/api/media_transport_interface.cc @@ -0,0 +1,52 @@ +/* + * Copyright 2018 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +// This is EXPERIMENTAL interface for media transport. +// +// The goal is to refactor WebRTC code so that audio and video frames +// are sent / received through the media transport interface. This will +// enable different media transport implementations, including QUIC-based +// media transport. + +#include "api/media_transport_interface.h" + +namespace webrtc { + +MediaTransportEncodedAudioFrame::MediaTransportEncodedAudioFrame( + int sampling_rate_hz, + int starting_sample_index, + int samples_per_channel, + int sequence_number, + FrameType frame_type, + uint8_t payload_type, + std::vector encoded_data) + : sampling_rate_hz_(sampling_rate_hz), + starting_sample_index_(starting_sample_index), + samples_per_channel_(samples_per_channel), + sequence_number_(sequence_number), + frame_type_(frame_type), + payload_type_(payload_type), + encoded_data_(std::move(encoded_data)) {} + +MediaTransportEncodedAudioFrame::~MediaTransportEncodedAudioFrame() = default; + +MediaTransportEncodedVideoFrame::MediaTransportEncodedVideoFrame( + int64_t frame_id, + std::vector referenced_frame_ids, + VideoCodecType codec_type, + const webrtc::EncodedImage& encoded_image) + : codec_type_(codec_type), + encoded_image_(encoded_image), + frame_id_(frame_id), + referenced_frame_ids_(std::move(referenced_frame_ids)) {} + +MediaTransportEncodedVideoFrame::~MediaTransportEncodedVideoFrame() = default; + +} // namespace webrtc diff --git a/api/media_transport_interface.h b/api/media_transport_interface.h index 2c88cd4ce6..154fe4a825 100644 --- a/api/media_transport_interface.h +++ b/api/media_transport_interface.h @@ -23,6 +23,7 @@ #include #include "api/rtcerror.h" +#include "api/video/encoded_image.h" #include "common_types.h" // NOLINT(build/include) namespace rtc { @@ -75,14 +76,9 @@ class MediaTransportEncodedAudioFrame { uint8_t payload_type, // Vector with opaque encoded data. - std::vector encoded_data) - : sampling_rate_hz_(sampling_rate_hz), - starting_sample_index_(starting_sample_index), - samples_per_channel_(samples_per_channel), - sequence_number_(sequence_number), - frame_type_(frame_type), - payload_type_(payload_type), - encoded_data_(std::move(encoded_data)) {} + std::vector encoded_data); + + ~MediaTransportEncodedAudioFrame(); // Getters. int sampling_rate_hz() const { return sampling_rate_hz_; } @@ -130,11 +126,8 @@ class MediaTransportEncodedVideoFrame { MediaTransportEncodedVideoFrame(int64_t frame_id, std::vector referenced_frame_ids, VideoCodecType codec_type, - const webrtc::EncodedImage& encoded_image) - : codec_type_(codec_type), - encoded_image_(encoded_image), - frame_id_(frame_id), - referenced_frame_ids_(std::move(referenced_frame_ids)) {} + const webrtc::EncodedImage& encoded_image); + ~MediaTransportEncodedVideoFrame(); VideoCodecType codec_type() const { return codec_type_; } const webrtc::EncodedImage& encoded_image() const { return encoded_image_; }