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

Side by Side Diff: media/cast/test/sender.cc

Issue 388663003: Cast: Reshuffle files under media/cast (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: missing includes Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/cast/test/receiver.cc ('k') | media/cast/test/simulator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // Test application that simulates a cast sender - Data can be either generated 5 // Test application that simulates a cast sender - Data can be either generated
6 // or read from a file. 6 // or read from a file.
7 7
8 #include <queue> 8 #include <queue>
9 9
10 #include "base/at_exit.h" 10 #include "base/at_exit.h"
(...skipping 12 matching lines...) Expand all
23 #include "media/base/video_frame.h" 23 #include "media/base/video_frame.h"
24 #include "media/cast/cast_config.h" 24 #include "media/cast/cast_config.h"
25 #include "media/cast/cast_environment.h" 25 #include "media/cast/cast_environment.h"
26 #include "media/cast/cast_sender.h" 26 #include "media/cast/cast_sender.h"
27 #include "media/cast/logging/encoding_event_subscriber.h" 27 #include "media/cast/logging/encoding_event_subscriber.h"
28 #include "media/cast/logging/log_serializer.h" 28 #include "media/cast/logging/log_serializer.h"
29 #include "media/cast/logging/logging_defines.h" 29 #include "media/cast/logging/logging_defines.h"
30 #include "media/cast/logging/proto/raw_events.pb.h" 30 #include "media/cast/logging/proto/raw_events.pb.h"
31 #include "media/cast/logging/receiver_time_offset_estimator_impl.h" 31 #include "media/cast/logging/receiver_time_offset_estimator_impl.h"
32 #include "media/cast/logging/stats_event_subscriber.h" 32 #include "media/cast/logging/stats_event_subscriber.h"
33 #include "media/cast/net/cast_transport_defines.h"
34 #include "media/cast/net/cast_transport_sender.h"
35 #include "media/cast/net/udp_transport.h"
33 #include "media/cast/test/fake_media_source.h" 36 #include "media/cast/test/fake_media_source.h"
34 #include "media/cast/test/utility/default_config.h" 37 #include "media/cast/test/utility/default_config.h"
35 #include "media/cast/test/utility/input_builder.h" 38 #include "media/cast/test/utility/input_builder.h"
36 #include "media/cast/transport/cast_transport_defines.h"
37 #include "media/cast/transport/cast_transport_sender.h"
38 #include "media/cast/transport/transport/udp_transport.h"
39 39
40 namespace { 40 namespace {
41 static const int kAudioChannels = 2; 41 static const int kAudioChannels = 2;
42 static const int kAudioSamplingFrequency = 48000; 42 static const int kAudioSamplingFrequency = 48000;
43 43
44 // The max allowed size of serialized log. 44 // The max allowed size of serialized log.
45 const int kMaxSerializedLogBytes = 10 * 1000 * 1000; 45 const int kMaxSerializedLogBytes = 10 * 1000 * 1000;
46 46
47 // Flags for this program: 47 // Flags for this program:
48 // 48 //
(...skipping 15 matching lines...) Expand all
64 64
65 media::cast::AudioSenderConfig GetAudioSenderConfig() { 65 media::cast::AudioSenderConfig GetAudioSenderConfig() {
66 media::cast::AudioSenderConfig audio_config; 66 media::cast::AudioSenderConfig audio_config;
67 67
68 audio_config.rtcp_c_name = "audio_sender@a.b.c.d"; 68 audio_config.rtcp_c_name = "audio_sender@a.b.c.d";
69 69
70 audio_config.use_external_encoder = false; 70 audio_config.use_external_encoder = false;
71 audio_config.frequency = kAudioSamplingFrequency; 71 audio_config.frequency = kAudioSamplingFrequency;
72 audio_config.channels = kAudioChannels; 72 audio_config.channels = kAudioChannels;
73 audio_config.bitrate = 0; // Use Opus auto-VBR mode. 73 audio_config.bitrate = 0; // Use Opus auto-VBR mode.
74 audio_config.codec = media::cast::transport::CODEC_AUDIO_OPUS; 74 audio_config.codec = media::cast::CODEC_AUDIO_OPUS;
75 audio_config.ssrc = 1; 75 audio_config.ssrc = 1;
76 audio_config.incoming_feedback_ssrc = 2; 76 audio_config.incoming_feedback_ssrc = 2;
77 audio_config.rtp_payload_type = 127; 77 audio_config.rtp_payload_type = 127;
78 // TODO(miu): The default in cast_defines.h is 100. Should this be 100, and 78 // TODO(miu): The default in cast_defines.h is 100. Should this be 100, and
79 // should receiver.cc's config also be 100? 79 // should receiver.cc's config also be 100?
80 audio_config.target_playout_delay = base::TimeDelta::FromMilliseconds(300); 80 audio_config.target_playout_delay = base::TimeDelta::FromMilliseconds(300);
81 return audio_config; 81 return audio_config;
82 } 82 }
83 83
84 media::cast::VideoSenderConfig GetVideoSenderConfig() { 84 media::cast::VideoSenderConfig GetVideoSenderConfig() {
85 media::cast::VideoSenderConfig video_config; 85 media::cast::VideoSenderConfig video_config;
86 86
87 video_config.rtcp_c_name = "video_sender@a.b.c.d"; 87 video_config.rtcp_c_name = "video_sender@a.b.c.d";
88 video_config.use_external_encoder = false; 88 video_config.use_external_encoder = false;
89 89
90 // Resolution. 90 // Resolution.
91 video_config.width = 1280; 91 video_config.width = 1280;
92 video_config.height = 720; 92 video_config.height = 720;
93 video_config.max_frame_rate = 30; 93 video_config.max_frame_rate = 30;
94 94
95 // Bitrates. 95 // Bitrates.
96 video_config.max_bitrate = 2500000; 96 video_config.max_bitrate = 2500000;
97 video_config.min_bitrate = 100000; 97 video_config.min_bitrate = 100000;
98 video_config.start_bitrate = video_config.min_bitrate; 98 video_config.start_bitrate = video_config.min_bitrate;
99 99
100 // Codec. 100 // Codec.
101 video_config.codec = media::cast::transport::CODEC_VIDEO_VP8; 101 video_config.codec = media::cast::CODEC_VIDEO_VP8;
102 video_config.max_number_of_video_buffers_used = 1; 102 video_config.max_number_of_video_buffers_used = 1;
103 video_config.number_of_encode_threads = 2; 103 video_config.number_of_encode_threads = 2;
104 104
105 // Quality options. 105 // Quality options.
106 video_config.min_qp = 4; 106 video_config.min_qp = 4;
107 video_config.max_qp = 40; 107 video_config.max_qp = 40;
108 108
109 // SSRCs and payload type. Don't change them. 109 // SSRCs and payload type. Don't change them.
110 video_config.ssrc = 11; 110 video_config.ssrc = 11;
111 video_config.incoming_feedback_ssrc = 12; 111 video_config.incoming_feedback_ssrc = 12;
112 video_config.rtp_payload_type = 96; 112 video_config.rtp_payload_type = 96;
113 // TODO(miu): The default in cast_defines.h is 100. Should this be 100, and 113 // TODO(miu): The default in cast_defines.h is 100. Should this be 100, and
114 // should receiver.cc's config also be 100? 114 // should receiver.cc's config also be 100?
115 video_config.target_playout_delay = base::TimeDelta::FromMilliseconds(300); 115 video_config.target_playout_delay = base::TimeDelta::FromMilliseconds(300);
116 return video_config; 116 return video_config;
117 } 117 }
118 118
119 void UpdateCastTransportStatus( 119 void UpdateCastTransportStatus(
120 media::cast::transport::CastTransportStatus status) { 120 media::cast::CastTransportStatus status) {
121 VLOG(1) << "Transport status: " << status; 121 VLOG(1) << "Transport status: " << status;
122 } 122 }
123 123
124 void LogRawEvents( 124 void LogRawEvents(
125 const scoped_refptr<media::cast::CastEnvironment>& cast_environment, 125 const scoped_refptr<media::cast::CastEnvironment>& cast_environment,
126 const std::vector<media::cast::PacketEvent>& packet_events) { 126 const std::vector<media::cast::PacketEvent>& packet_events) {
127 VLOG(1) << "Got packet events from transport, size: " << packet_events.size(); 127 VLOG(1) << "Got packet events from transport, size: " << packet_events.size();
128 for (std::vector<media::cast::PacketEvent>::const_iterator it = 128 for (std::vector<media::cast::PacketEvent>::const_iterator it =
129 packet_events.begin(); 129 packet_events.begin();
130 it != packet_events.end(); 130 it != packet_events.end();
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 &override_fps)){ 301 &override_fps)){
302 override_fps = 0; 302 override_fps = 0;
303 } 303 }
304 base::FilePath source_path = cmd->GetSwitchValuePath(kSwitchSourceFile); 304 base::FilePath source_path = cmd->GetSwitchValuePath(kSwitchSourceFile);
305 if (!source_path.empty()) { 305 if (!source_path.empty()) {
306 LOG(INFO) << "Source: " << source_path.value(); 306 LOG(INFO) << "Source: " << source_path.value();
307 fake_media_source->SetSourceFile(source_path, override_fps); 307 fake_media_source->SetSourceFile(source_path, override_fps);
308 } 308 }
309 309
310 // CastTransportSender initialization. 310 // CastTransportSender initialization.
311 scoped_ptr<media::cast::transport::CastTransportSender> transport_sender = 311 scoped_ptr<media::cast::CastTransportSender> transport_sender =
312 media::cast::transport::CastTransportSender::Create( 312 media::cast::CastTransportSender::Create(
313 NULL, // net log. 313 NULL, // net log.
314 cast_environment->Clock(), 314 cast_environment->Clock(),
315 remote_endpoint, 315 remote_endpoint,
316 base::Bind(&UpdateCastTransportStatus), 316 base::Bind(&UpdateCastTransportStatus),
317 base::Bind(&LogRawEvents, cast_environment), 317 base::Bind(&LogRawEvents, cast_environment),
318 base::TimeDelta::FromSeconds(1), 318 base::TimeDelta::FromSeconds(1),
319 io_message_loop.message_loop_proxy()); 319 io_message_loop.message_loop_proxy());
320 320
321 // CastSender initialization. 321 // CastSender initialization.
322 scoped_ptr<media::cast::CastSender> cast_sender = 322 scoped_ptr<media::cast::CastSender> cast_sender =
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 base::Passed(&audio_stats_subscriber), 393 base::Passed(&audio_stats_subscriber),
394 base::Passed(&offset_estimator)), 394 base::Passed(&offset_estimator)),
395 base::TimeDelta::FromSeconds(logging_duration_seconds)); 395 base::TimeDelta::FromSeconds(logging_duration_seconds));
396 396
397 fake_media_source->Start(cast_sender->audio_frame_input(), 397 fake_media_source->Start(cast_sender->audio_frame_input(),
398 cast_sender->video_frame_input()); 398 cast_sender->video_frame_input());
399 399
400 io_message_loop.Run(); 400 io_message_loop.Run();
401 return 0; 401 return 0;
402 } 402 }
OLDNEW
« no previous file with comments | « media/cast/test/receiver.cc ('k') | media/cast/test/simulator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698