Chromium Code Reviews| 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..b86dd617d81afab9f106191c567fa58e43f61c0c 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(); |
| @@ -621,6 +627,33 @@ VCMFrameBufferEnum VCMJitterBuffer::InsertPacket(const VCMPacket& packet, |
| } |
| } |
| + if (packet.codec == kVideoCodecVP9) { |
| + // TODO(asapersson): Move this code? |
| + if (packet.codecSpecificHeader.codecHeader.VP9.ssDataAvailable) { |
| + if (first_packet_since_reset_ || |
| + IsNewerTimestamp(packet.timestamp, last_gof_timestamp_)) { |
| + last_gof_.CopyGofInfoVP9( |
| + packet.codecSpecificHeader.codecHeader.VP9.gof); |
|
stefan-webrtc
2015/07/09 14:49:00
This gof info is necessary to know if a frame is d
åsapersson
2015/07/29 12:10:13
Decoding state looks at frame's TL, etc. Shouldn't
|
| + last_gof_timestamp_ = packet.timestamp; |
| + last_gof_valid_ = true; |
| + } |
| + } |
| + if (last_gof_valid_ && |
| + !packet.codecSpecificHeader.codecHeader.VP9.flexibleMode) { |
| + uint8_t gof_idx = packet.codecSpecificHeader.codecHeader.VP9.gofIdx; |
| + if (gof_idx != kNoGofIdx) { |
| + if (gof_idx >= last_gof_.numFramesInGof) { |
| + return kGeneralError; |
| + } |
| + RTPVideoTypeHeader* hdr = const_cast<RTPVideoTypeHeader*>( |
| + &packet.codecSpecificHeader.codecHeader); |
| + hdr->VP9.temporalIdx = last_gof_.temporalIdx[gof_idx]; |
| + hdr->VP9.temporalUpSwitch = last_gof_.temporalUpSwitch[gof_idx]; |
| + } |
| + } |
| + // TODO(asapersson): Handle out of order GOF. |
| + } |
| + |
| VCMFrameBufferStateEnum previous_state = frame->GetState(); |
| // Insert packet. |
| FrameData frame_data; |