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

Side by Side Diff: chrome/renderer/media/cast_rtp_stream.cc

Issue 1034433002: Cast: Prefer VP8 over H.264 for hardware encoder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | « no previous file | 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 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 144
145 std::vector<CastRtpParams> SupportedAudioParams() { 145 std::vector<CastRtpParams> SupportedAudioParams() {
146 // TODO(hclam): Fill in more codecs here. 146 // TODO(hclam): Fill in more codecs here.
147 std::vector<CastRtpParams> supported_params; 147 std::vector<CastRtpParams> supported_params;
148 supported_params.push_back(CastRtpParams(DefaultOpusPayload())); 148 supported_params.push_back(CastRtpParams(DefaultOpusPayload()));
149 return supported_params; 149 return supported_params;
150 } 150 }
151 151
152 std::vector<CastRtpParams> SupportedVideoParams() { 152 std::vector<CastRtpParams> SupportedVideoParams() {
153 std::vector<CastRtpParams> supported_params; 153 std::vector<CastRtpParams> supported_params;
154 if (IsHardwareH264EncodingSupported()) 154 // Prefer VP8 over H.264 for hardware encoder.
155 supported_params.push_back(CastRtpParams(DefaultH264Payload())); 155 if (IsHardwareVP8EncodingSupported()) {
156 supported_params.push_back(CastRtpParams(DefaultVp8Payload())); 156 supported_params.push_back(CastRtpParams(DefaultVp8Payload()));
miu 2015/03/27 20:41:06 It's fine to prefer the VP8 HW encoder, but I thin
157 } else {
158 if (IsHardwareH264EncodingSupported())
159 supported_params.push_back(CastRtpParams(DefaultH264Payload()));
160 supported_params.push_back(CastRtpParams(DefaultVp8Payload()));
161 }
157 return supported_params; 162 return supported_params;
158 } 163 }
159 164
160 bool ToAudioSenderConfig(const CastRtpParams& params, 165 bool ToAudioSenderConfig(const CastRtpParams& params,
161 AudioSenderConfig* config) { 166 AudioSenderConfig* config) {
162 config->ssrc = params.payload.ssrc; 167 config->ssrc = params.payload.ssrc;
163 config->receiver_ssrc = params.payload.feedback_ssrc; 168 config->receiver_ssrc = params.payload.feedback_ssrc;
164 if (config->ssrc == config->receiver_ssrc) 169 if (config->ssrc == config->receiver_ssrc)
165 return false; 170 return false;
166 config->min_playout_delay = 171 config->min_playout_delay =
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 void CastRtpStream::DidEncounterError(const std::string& message) { 568 void CastRtpStream::DidEncounterError(const std::string& message) {
564 DVLOG(1) << "CastRtpStream::DidEncounterError(" << message << ") = " 569 DVLOG(1) << "CastRtpStream::DidEncounterError(" << message << ") = "
565 << (IsAudio() ? "audio" : "video"); 570 << (IsAudio() ? "audio" : "video");
566 // Save the WeakPtr first because the error callback might delete this object. 571 // Save the WeakPtr first because the error callback might delete this object.
567 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); 572 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr();
568 error_callback_.Run(message); 573 error_callback_.Run(message);
569 content::RenderThread::Get()->GetTaskRunner()->PostTask( 574 content::RenderThread::Get()->GetTaskRunner()->PostTask(
570 FROM_HERE, 575 FROM_HERE,
571 base::Bind(&CastRtpStream::Stop, ptr)); 576 base::Bind(&CastRtpStream::Stop, ptr));
572 } 577 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698