aboutsummaryrefslogtreecommitdiff
path: root/webrtc/modules/rtp_rtcp/source/rtp_format_vp9.h
diff options
context:
space:
mode:
authorChih-hung Hsieh <chh@google.com>2015-12-01 17:07:48 +0000
committerandroid-build-merger <android-build-merger@google.com>2015-12-01 17:07:48 +0000
commita4acd9d6bc9b3b033d7d274316e75ee067df8d20 (patch)
tree672a185b294789cf991f385c3e395dd63bea9063 /webrtc/modules/rtp_rtcp/source/rtp_format_vp9.h
parent3681b90ba4fe7a27232dd3e27897d5d7ed9d651c (diff)
parentfe8b4a657979b49e1701bd92f6d5814a99e0b2be (diff)
downloadwebrtc-a4acd9d6bc9b3b033d7d274316e75ee067df8d20.tar.gz
Merge changes I7bbf776e,I1b827825
am: fe8b4a6579 * commit 'fe8b4a657979b49e1701bd92f6d5814a99e0b2be': (7237 commits) WIP: Changes after merge commit 'cb3f9bd' Make the nonlinear beamformer steerable Utilize bitrate above codec max to protect video. Enable VP9 internal resize by default. Filter overlapping RTP header extensions. Make VCMEncodedFrameCallback const. MediaCodecVideoEncoder: Add number of quality resolution downscales to Encoded callback. Remove redudant encoder rate calls. Create isolate files for nonparallel tests. Register header extensions in RtpRtcpObserver to avoid log spam. Make an enum class out of NetEqDecoder, and hide the neteq_decoders_ table ACM: Move NACK functionality inside NetEq Fix chromium-style warnings in webrtc/sound/. Create a 'webrtc_nonparallel_tests' target. Update scalability structure data according to updates in the RTP payload profile. audio_coding: rename interface -> include Rewrote perform_action_on_all_files to be parallell. Update reference indices according to updates in the RTP payload profile. Disable P2PTransport...TestFailoverControlledSide on Memcheck pass clangcl compile options to ignore warnings in gflags.cc ...
Diffstat (limited to 'webrtc/modules/rtp_rtcp/source/rtp_format_vp9.h')
-rw-r--r--webrtc/modules/rtp_rtcp/source/rtp_format_vp9.h108
1 files changed, 108 insertions, 0 deletions
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_format_vp9.h b/webrtc/modules/rtp_rtcp/source/rtp_format_vp9.h
new file mode 100644
index 0000000000..abce7e7791
--- /dev/null
+++ b/webrtc/modules/rtp_rtcp/source/rtp_format_vp9.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2015 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 file contains the declaration of the VP9 packetizer class.
+// A packetizer object is created for each encoded video frame. The
+// constructor is called with the payload data and size.
+//
+// After creating the packetizer, the method NextPacket is called
+// repeatedly to get all packets for the frame. The method returns
+// false as long as there are more packets left to fetch.
+//
+
+#ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_VP9_H_
+#define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_VP9_H_
+
+#include <queue>
+#include <string>
+
+#include "webrtc/base/constructormagic.h"
+#include "webrtc/modules/interface/module_common_types.h"
+#include "webrtc/modules/rtp_rtcp/source/rtp_format.h"
+#include "webrtc/typedefs.h"
+
+namespace webrtc {
+
+class RtpPacketizerVp9 : public RtpPacketizer {
+ public:
+ RtpPacketizerVp9(const RTPVideoHeaderVP9& hdr, size_t max_payload_length);
+
+ virtual ~RtpPacketizerVp9();
+
+ ProtectionType GetProtectionType() override;
+
+ StorageType GetStorageType(uint32_t retransmission_settings) override;
+
+ std::string ToString() override;
+
+ // The payload data must be one encoded VP9 frame.
+ void SetPayloadData(const uint8_t* payload,
+ size_t payload_size,
+ const RTPFragmentationHeader* fragmentation) override;
+
+ // Gets the next payload with VP9 payload header.
+ // |buffer| is a pointer to where the output will be written.
+ // |bytes_to_send| is an output variable that will contain number of bytes
+ // written to buffer.
+ // |last_packet| is true for the last packet of the frame, false otherwise
+ // (i.e. call the function again to get the next packet).
+ // Returns true on success, false otherwise.
+ bool NextPacket(uint8_t* buffer,
+ size_t* bytes_to_send,
+ bool* last_packet) override;
+
+ typedef struct {
+ size_t payload_start_pos;
+ size_t size;
+ bool layer_begin;
+ bool layer_end;
+ } PacketInfo;
+ typedef std::queue<PacketInfo> PacketInfoQueue;
+
+ private:
+ // Calculates all packet sizes and loads info to packet queue.
+ void GeneratePackets();
+
+ // Writes the payload descriptor header and copies payload to the |buffer|.
+ // |packet_info| determines which part of the payload to write.
+ // |bytes_to_send| contains the number of written bytes to the buffer.
+ // Returns true on success, false otherwise.
+ bool WriteHeaderAndPayload(const PacketInfo& packet_info,
+ uint8_t* buffer,
+ size_t* bytes_to_send) const;
+
+ // Writes payload descriptor header to |buffer|.
+ // Returns true on success, false otherwise.
+ bool WriteHeader(const PacketInfo& packet_info,
+ uint8_t* buffer,
+ size_t* header_length) const;
+
+ const RTPVideoHeaderVP9 hdr_;
+ const size_t max_payload_length_; // The max length in bytes of one packet.
+ const uint8_t* payload_; // The payload data to be packetized.
+ size_t payload_size_; // The size in bytes of the payload data.
+ PacketInfoQueue packets_;
+
+ RTC_DISALLOW_COPY_AND_ASSIGN(RtpPacketizerVp9);
+};
+
+
+class RtpDepacketizerVp9 : public RtpDepacketizer {
+ public:
+ virtual ~RtpDepacketizerVp9() {}
+
+ bool Parse(ParsedPayload* parsed_payload,
+ const uint8_t* payload,
+ size_t payload_length) override;
+};
+
+} // namespace webrtc
+#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_VP9_H_