Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(711)

Unified Diff: webrtc/modules/video_coding/main/source/jitter_buffer.cc

Issue 1211353002: Integration of VP9 packetization. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: set ss data if not set Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/video_coding/main/source/jitter_buffer.cc
diff --git a/webrtc/modules/video_coding/main/source/jitter_buffer.cc b/webrtc/modules/video_coding/main/source/jitter_buffer.cc
index 9156cc1a61dba45624bda8c73da4886fce71b242..49c2325d80a852971edb1dff629b9c5a997e27e7 100644
--- a/webrtc/modules/video_coding/main/source/jitter_buffer.cc
+++ b/webrtc/modules/video_coding/main/source/jitter_buffer.cc
@@ -125,6 +125,8 @@ VCMJitterBuffer::VCMJitterBuffer(Clock* clock,
incomplete_frames_(),
last_decoded_state_(),
first_packet_since_reset_(true),
+ last_gof_timestamp_(0),
+ last_gof_valid_(false),
stats_callback_(NULL),
incoming_frame_rate_(0),
incoming_frame_count_(0),
@@ -220,6 +222,7 @@ void VCMJitterBuffer::Start() {
first_packet_since_reset_ = true;
rtt_ms_ = kDefaultRtt;
last_decoded_state_.Reset();
+ last_gof_valid_ = false;
}
void VCMJitterBuffer::Stop() {
@@ -227,6 +230,8 @@ void VCMJitterBuffer::Stop() {
UpdateHistograms();
running_ = false;
last_decoded_state_.Reset();
+ last_gof_valid_ = false;
+
// Make sure all frames are free and reset.
for (FrameList::iterator it = decodable_frames_.begin();
it != decodable_frames_.end(); ++it) {
@@ -257,6 +262,7 @@ void VCMJitterBuffer::Flush() {
decodable_frames_.Reset(&free_frames_);
incomplete_frames_.Reset(&free_frames_);
last_decoded_state_.Reset(); // TODO(mikhal): sync reset.
+ last_gof_valid_ = false;
num_consecutive_old_packets_ = 0;
// Also reset the jitter and delay estimates
jitter_estimate_.Reset();
@@ -586,6 +592,38 @@ VCMFrameBufferEnum VCMJitterBuffer::InsertPacket(const VCMPacket& packet,
return kOldPacket;
}
+ if (packet.codec == kVideoCodecVP9) {
+ // TODO(asapersson): Move this code to appropriate place.
+ // TODO(asapersson): Handle out of order GOF.
+ if (packet.codecSpecificHeader.codecHeader.VP9.flexible_mode) {
+ // TODO(asapersson): Add support for flexible mode.
+ return kGeneralError;
+ }
+ if (packet.codecSpecificHeader.codecHeader.VP9.ss_data_available) {
+ if (!last_gof_valid_ ||
+ IsNewerTimestamp(packet.timestamp, last_gof_timestamp_)) {
+ last_gof_.CopyGofInfoVP9(
+ packet.codecSpecificHeader.codecHeader.VP9.gof);
+ last_gof_timestamp_ = packet.timestamp;
+ last_gof_valid_ = true;
+ }
+ }
+ if (last_gof_valid_ &&
+ !packet.codecSpecificHeader.codecHeader.VP9.flexible_mode) {
+ uint8_t gof_idx = packet.codecSpecificHeader.codecHeader.VP9.gof_idx;
+ if (gof_idx != kNoGofIdx) {
+ if (gof_idx >= last_gof_.num_frames_in_gof) {
+ LOG(LS_WARNING) << "Incorrect gof_idx: " << gof_idx;
+ return kGeneralError;
+ }
+ RTPVideoTypeHeader* hdr = const_cast<RTPVideoTypeHeader*>(
+ &packet.codecSpecificHeader.codecHeader);
+ hdr->VP9.temporal_idx = last_gof_.temporal_idx[gof_idx];
+ hdr->VP9.temporal_up_switch = last_gof_.temporal_up_switch[gof_idx];
+ }
+ }
+ }
+
num_consecutive_old_packets_ = 0;
VCMFrameBuffer* frame;
« no previous file with comments | « webrtc/modules/video_coding/main/source/jitter_buffer.h ('k') | webrtc/modules/video_coding/main/source/session_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698