OLD | NEW |
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 #include "chrome/renderer/media/cast_rtp_stream.h" | 5 #include "chrome/renderer/media/cast_rtp_stream.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 CastRtpPayloadParams payload; | 63 CastRtpPayloadParams payload; |
64 payload.payload_type = 96; | 64 payload.payload_type = 96; |
65 payload.max_latency_ms = media::cast::kDefaultRtpMaxDelayMs; | 65 payload.max_latency_ms = media::cast::kDefaultRtpMaxDelayMs; |
66 payload.ssrc = 11; | 66 payload.ssrc = 11; |
67 payload.feedback_ssrc = 12; | 67 payload.feedback_ssrc = 12; |
68 payload.clock_rate = media::cast::kVideoFrequency; | 68 payload.clock_rate = media::cast::kVideoFrequency; |
69 payload.max_bitrate = 2000; | 69 payload.max_bitrate = 2000; |
70 payload.min_bitrate = 50; | 70 payload.min_bitrate = 50; |
71 payload.channels = 1; | 71 payload.channels = 1; |
72 payload.max_frame_rate = media::cast::kDefaultMaxFrameRate; | 72 payload.max_frame_rate = media::cast::kDefaultMaxFrameRate; |
73 payload.width = 1280; | |
74 payload.height = 720; | |
75 payload.codec_name = kCodecNameVp8; | 73 payload.codec_name = kCodecNameVp8; |
76 return payload; | 74 return payload; |
77 } | 75 } |
78 | 76 |
79 CastRtpPayloadParams DefaultH264Payload() { | 77 CastRtpPayloadParams DefaultH264Payload() { |
80 CastRtpPayloadParams payload; | 78 CastRtpPayloadParams payload; |
81 // TODO(hshi): set different ssrc/rtpPayloadType values for H264 and VP8 | 79 // TODO(hshi): set different ssrc/rtpPayloadType values for H264 and VP8 |
82 // once b/13696137 is fixed. | 80 // once b/13696137 is fixed. |
83 payload.payload_type = 96; | 81 payload.payload_type = 96; |
84 payload.max_latency_ms = media::cast::kDefaultRtpMaxDelayMs; | 82 payload.max_latency_ms = media::cast::kDefaultRtpMaxDelayMs; |
85 payload.ssrc = 11; | 83 payload.ssrc = 11; |
86 payload.feedback_ssrc = 12; | 84 payload.feedback_ssrc = 12; |
87 payload.clock_rate = media::cast::kVideoFrequency; | 85 payload.clock_rate = media::cast::kVideoFrequency; |
88 payload.max_bitrate = 2000; | 86 payload.max_bitrate = 2000; |
89 payload.min_bitrate = 50; | 87 payload.min_bitrate = 50; |
90 payload.channels = 1; | 88 payload.channels = 1; |
91 payload.max_frame_rate = media::cast::kDefaultMaxFrameRate; | 89 payload.max_frame_rate = media::cast::kDefaultMaxFrameRate; |
92 payload.width = 1280; | |
93 payload.height = 720; | |
94 payload.codec_name = kCodecNameH264; | 90 payload.codec_name = kCodecNameH264; |
95 return payload; | 91 return payload; |
96 } | 92 } |
97 | 93 |
98 bool IsHardwareVP8EncodingSupported() { | 94 bool IsHardwareVP8EncodingSupported() { |
99 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 95 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
100 if (cmd_line->HasSwitch(switches::kDisableCastStreamingHWEncoding)) { | 96 if (cmd_line->HasSwitch(switches::kDisableCastStreamingHWEncoding)) { |
101 DVLOG(1) << "Disabled hardware VP8 support for Cast Streaming."; | 97 DVLOG(1) << "Disabled hardware VP8 support for Cast Streaming."; |
102 return false; | 98 return false; |
103 } | 99 } |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 CastRtpPayloadParams::CastRtpPayloadParams() | 449 CastRtpPayloadParams::CastRtpPayloadParams() |
454 : payload_type(0), | 450 : payload_type(0), |
455 max_latency_ms(0), | 451 max_latency_ms(0), |
456 min_latency_ms(0), | 452 min_latency_ms(0), |
457 ssrc(0), | 453 ssrc(0), |
458 feedback_ssrc(0), | 454 feedback_ssrc(0), |
459 clock_rate(0), | 455 clock_rate(0), |
460 max_bitrate(0), | 456 max_bitrate(0), |
461 min_bitrate(0), | 457 min_bitrate(0), |
462 channels(0), | 458 channels(0), |
463 max_frame_rate(0.0), | 459 max_frame_rate(0.0) { |
464 width(0), | 460 } |
465 height(0) {} | |
466 | 461 |
467 CastRtpPayloadParams::~CastRtpPayloadParams() {} | 462 CastRtpPayloadParams::~CastRtpPayloadParams() {} |
468 | 463 |
469 CastRtpParams::CastRtpParams() {} | 464 CastRtpParams::CastRtpParams() {} |
470 | 465 |
471 CastRtpParams::~CastRtpParams() {} | 466 CastRtpParams::~CastRtpParams() {} |
472 | 467 |
473 CastRtpStream::CastRtpStream(const blink::WebMediaStreamTrack& track, | 468 CastRtpStream::CastRtpStream(const blink::WebMediaStreamTrack& track, |
474 const scoped_refptr<CastSession>& session) | 469 const scoped_refptr<CastSession>& session) |
475 : track_(track), cast_session_(session), weak_factory_(this) {} | 470 : track_(track), cast_session_(session), weak_factory_(this) {} |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 void CastRtpStream::DidEncounterError(const std::string& message) { | 563 void CastRtpStream::DidEncounterError(const std::string& message) { |
569 DVLOG(1) << "CastRtpStream::DidEncounterError(" << message << ") = " | 564 DVLOG(1) << "CastRtpStream::DidEncounterError(" << message << ") = " |
570 << (IsAudio() ? "audio" : "video"); | 565 << (IsAudio() ? "audio" : "video"); |
571 // Save the WeakPtr first because the error callback might delete this object. | 566 // Save the WeakPtr first because the error callback might delete this object. |
572 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); | 567 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); |
573 error_callback_.Run(message); | 568 error_callback_.Run(message); |
574 content::RenderThread::Get()->GetTaskRunner()->PostTask( | 569 content::RenderThread::Get()->GetTaskRunner()->PostTask( |
575 FROM_HERE, | 570 FROM_HERE, |
576 base::Bind(&CastRtpStream::Stop, ptr)); | 571 base::Bind(&CastRtpStream::Stop, ptr)); |
577 } | 572 } |
OLD | NEW |