Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 |
| OLD | NEW |