| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/cast/sender/fake_software_video_encoder.h" | 5 #include "media/cast/sender/fake_software_video_encoder.h" |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "media/base/video_frame.h" | 9 #include "media/base/video_frame.h" |
| 10 #include "media/cast/net/cast_transport_config.h" | 10 #include "media/cast/net/cast_transport_config.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 FakeSoftwareVideoEncoder::~FakeSoftwareVideoEncoder() {} | 26 FakeSoftwareVideoEncoder::~FakeSoftwareVideoEncoder() {} |
| 27 | 27 |
| 28 void FakeSoftwareVideoEncoder::Initialize() {} | 28 void FakeSoftwareVideoEncoder::Initialize() {} |
| 29 | 29 |
| 30 void FakeSoftwareVideoEncoder::Encode( | 30 void FakeSoftwareVideoEncoder::Encode( |
| 31 const scoped_refptr<media::VideoFrame>& video_frame, | 31 const scoped_refptr<media::VideoFrame>& video_frame, |
| 32 const base::TimeTicks& reference_time, | 32 const base::TimeTicks& reference_time, |
| 33 EncodedFrame* encoded_frame) { | 33 EncodedFrame* encoded_frame) { |
| 34 DCHECK(encoded_frame); | 34 DCHECK(encoded_frame); |
| 35 | 35 |
| 36 if (video_frame->visible_rect().size() != last_frame_size_) { |
| 37 next_frame_is_key_ = true; |
| 38 last_frame_size_ = video_frame->visible_rect().size(); |
| 39 } |
| 40 |
| 36 encoded_frame->frame_id = frame_id_++; | 41 encoded_frame->frame_id = frame_id_++; |
| 37 if (next_frame_is_key_) { | 42 if (next_frame_is_key_) { |
| 38 encoded_frame->dependency = EncodedFrame::KEY; | 43 encoded_frame->dependency = EncodedFrame::KEY; |
| 39 encoded_frame->referenced_frame_id = encoded_frame->frame_id; | 44 encoded_frame->referenced_frame_id = encoded_frame->frame_id; |
| 40 next_frame_is_key_ = false; | 45 next_frame_is_key_ = false; |
| 41 } else { | 46 } else { |
| 42 encoded_frame->dependency = EncodedFrame::DEPENDENT; | 47 encoded_frame->dependency = EncodedFrame::DEPENDENT; |
| 43 encoded_frame->referenced_frame_id = encoded_frame->frame_id - 1; | 48 encoded_frame->referenced_frame_id = encoded_frame->frame_id - 1; |
| 44 } | 49 } |
| 45 encoded_frame->rtp_timestamp = | 50 encoded_frame->rtp_timestamp = |
| (...skipping 20 matching lines...) Expand all Loading... |
| 66 } | 71 } |
| 67 | 72 |
| 68 void FakeSoftwareVideoEncoder::LatestFrameIdToReference(uint32 frame_id) { | 73 void FakeSoftwareVideoEncoder::LatestFrameIdToReference(uint32 frame_id) { |
| 69 frame_id_to_reference_ = frame_id; | 74 frame_id_to_reference_ = frame_id; |
| 70 } | 75 } |
| 71 | 76 |
| 72 } // namespace cast | 77 } // namespace cast |
| 73 } // namespace media | 78 } // namespace media |
| 74 | 79 |
| 75 #endif | 80 #endif |
| OLD | NEW |