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

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

Issue 965093002: [Cast] Crash fix for certain vp8 video frame resize attempts. (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 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/vp8_encoder.h" 5 #include "media/cast/sender/vp8_encoder.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "media/base/video_frame.h" 8 #include "media/base/video_frame.h"
9 #include "media/cast/cast_defines.h" 9 #include "media/cast/cast_defines.h"
10 #include "media/cast/net/cast_transport_config.h" 10 #include "media/cast/net/cast_transport_config.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // the old size, in terms of area, the existing encoder instance can 73 // the old size, in terms of area, the existing encoder instance can
74 // continue. Otherwise, completely tear-down and re-create a new encoder to 74 // continue. Otherwise, completely tear-down and re-create a new encoder to
75 // avoid a shutdown crash. 75 // avoid a shutdown crash.
76 if (frame_size.GetArea() <= gfx::Size(config_.g_w, config_.g_h).GetArea() && 76 if (frame_size.GetArea() <= gfx::Size(config_.g_w, config_.g_h).GetArea() &&
77 !use_multiple_video_buffers_) { 77 !use_multiple_video_buffers_) {
78 DVLOG(1) << "Continuing to use existing encoder at smaller frame size: " 78 DVLOG(1) << "Continuing to use existing encoder at smaller frame size: "
79 << gfx::Size(config_.g_w, config_.g_h).ToString() << " --> " 79 << gfx::Size(config_.g_w, config_.g_h).ToString() << " --> "
80 << frame_size.ToString(); 80 << frame_size.ToString();
81 config_.g_w = frame_size.width(); 81 config_.g_w = frame_size.width();
82 config_.g_h = frame_size.height(); 82 config_.g_h = frame_size.height();
83 CHECK_EQ(vpx_codec_enc_config_set(&encoder_, &config_), VPX_CODEC_OK) 83 if (vpx_codec_enc_config_set(&encoder_, &config_) == VPX_CODEC_OK)
84 << "Failed to update frame size in encoder config."; 84 return;
85 return; 85 DVLOG(1) << "libvp8 rejected the attempt to use a smaller frame size in "
Alpha Left Google 2015/02/28 01:08:36 nit: libvpx.
miu 2015/02/28 02:10:15 Done.
86 "the current instance.";
86 } 87 }
87 88
88 DVLOG(1) << "Destroying/Re-Creating encoder for larger frame size: " 89 DVLOG(1) << "Destroying/Re-Creating encoder for larger frame size: "
89 << gfx::Size(config_.g_w, config_.g_h).ToString() << " --> " 90 << gfx::Size(config_.g_w, config_.g_h).ToString() << " --> "
90 << frame_size.ToString(); 91 << frame_size.ToString();
91 vpx_codec_destroy(&encoder_); 92 vpx_codec_destroy(&encoder_);
92 } else { 93 } else {
93 DVLOG(1) << "Creating encoder for the first frame; size: " 94 DVLOG(1) << "Creating encoder for the first frame; size: "
94 << frame_size.ToString(); 95 << frame_size.ToString();
95 } 96 }
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 } 470 }
470 } 471 }
471 472
472 void Vp8Encoder::GenerateKeyFrame() { 473 void Vp8Encoder::GenerateKeyFrame() {
473 DCHECK(thread_checker_.CalledOnValidThread()); 474 DCHECK(thread_checker_.CalledOnValidThread());
474 key_frame_requested_ = true; 475 key_frame_requested_ = true;
475 } 476 }
476 477
477 } // namespace cast 478 } // namespace cast
478 } // namespace media 479 } // namespace media
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