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

Side by Side Diff: media/cast/video_sender/fake_software_video_encoder.cc

Issue 289083002: Cast: Add tests for clocks being slow/fast (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 6 years, 7 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 unified diff | Download patch
« no previous file with comments | « media/cast/test/utility/udp_proxy.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/video_sender/fake_software_video_encoder.h" 5 #include "media/cast/video_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/cast/transport/cast_transport_config.h" 9 #include "media/cast/transport/cast_transport_config.h"
10 10
(...skipping 12 matching lines...) Expand all
23 23
24 void FakeSoftwareVideoEncoder::Initialize() {} 24 void FakeSoftwareVideoEncoder::Initialize() {}
25 25
26 bool FakeSoftwareVideoEncoder::Encode( 26 bool FakeSoftwareVideoEncoder::Encode(
27 const scoped_refptr<media::VideoFrame>& video_frame, 27 const scoped_refptr<media::VideoFrame>& video_frame,
28 transport::EncodedVideoFrame* encoded_image) { 28 transport::EncodedVideoFrame* encoded_image) {
29 encoded_image->codec = transport::kFakeSoftwareVideo; 29 encoded_image->codec = transport::kFakeSoftwareVideo;
30 encoded_image->key_frame = next_frame_is_key_; 30 encoded_image->key_frame = next_frame_is_key_;
31 next_frame_is_key_ = false; 31 next_frame_is_key_ = false;
32 encoded_image->frame_id = frame_id_++; 32 encoded_image->frame_id = frame_id_++;
33 encoded_image->last_referenced_frame_id = frame_id_to_reference_; 33 encoded_image->last_referenced_frame_id = encoded_image->frame_id - 1;
34 34
35 base::DictionaryValue values; 35 base::DictionaryValue values;
36 values.Set("key", base::Value::CreateBooleanValue(encoded_image->key_frame)); 36 values.Set("key", base::Value::CreateBooleanValue(encoded_image->key_frame));
37 values.Set("id", base::Value::CreateIntegerValue(encoded_image->frame_id)); 37 values.Set("id", base::Value::CreateIntegerValue(encoded_image->frame_id));
38 values.Set("ref", base::Value::CreateIntegerValue( 38 values.Set("ref", base::Value::CreateIntegerValue(
39 encoded_image->last_referenced_frame_id)); 39 encoded_image->last_referenced_frame_id));
40 base::JSONWriter::Write(&values, &encoded_image->data); 40 base::JSONWriter::Write(&values, &encoded_image->data);
41 return true; 41 return true;
42 } 42 }
43 43
44 void FakeSoftwareVideoEncoder::UpdateRates(uint32 new_bitrate) { 44 void FakeSoftwareVideoEncoder::UpdateRates(uint32 new_bitrate) {
45 // TODO(hclam): Implement bitrate control. 45 // TODO(hclam): Implement bitrate control.
46 } 46 }
47 47
48 void FakeSoftwareVideoEncoder::GenerateKeyFrame() { 48 void FakeSoftwareVideoEncoder::GenerateKeyFrame() {
49 next_frame_is_key_ = true; 49 next_frame_is_key_ = true;
50 } 50 }
51 51
52 void FakeSoftwareVideoEncoder::LatestFrameIdToReference(uint32 frame_id) { 52 void FakeSoftwareVideoEncoder::LatestFrameIdToReference(uint32 frame_id) {
53 frame_id_to_reference_ = frame_id; 53 frame_id_to_reference_ = frame_id;
54 } 54 }
55 55
56 } // namespace cast 56 } // namespace cast
57 } // namespace media 57 } // namespace media
58 58
59 #endif 59 #endif
OLDNEW
« no previous file with comments | « media/cast/test/utility/udp_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698