summaryrefslogtreecommitdiff
path: root/chromium/media/cast/encoding/vpx_encoder.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/media/cast/encoding/vpx_encoder.cc')
-rw-r--r--chromium/media/cast/encoding/vpx_encoder.cc25
1 files changed, 14 insertions, 11 deletions
diff --git a/chromium/media/cast/encoding/vpx_encoder.cc b/chromium/media/cast/encoding/vpx_encoder.cc
index 0ad738f47c5..2de5bd6c728 100644
--- a/chromium/media/cast/encoding/vpx_encoder.cc
+++ b/chromium/media/cast/encoding/vpx_encoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,6 +10,9 @@
#include "media/cast/common/sender_encoded_frame.h"
#include "media/cast/constants.h"
#include "third_party/libvpx/source/libvpx/vpx/vp8cx.h"
+#include "third_party/openscreen/src/cast/streaming/encoded_frame.h"
+
+using Dependency = openscreen::cast::EncodedFrame::Dependency;
namespace media {
namespace cast {
@@ -212,27 +215,27 @@ void VpxEncoder::Encode(scoped_refptr<media::VideoFrame> video_frame,
vpx_image_t vpx_image;
vpx_image_t* const result = vpx_img_wrap(
&vpx_image, vpx_format, frame_size.width(), frame_size.height(), 1,
- video_frame->data(VideoFrame::kYPlane));
+ video_frame->writable_data(VideoFrame::kYPlane));
DCHECK_EQ(result, &vpx_image);
switch (vpx_format) {
case VPX_IMG_FMT_I420:
vpx_image.planes[VPX_PLANE_Y] =
- video_frame->visible_data(VideoFrame::kYPlane);
+ video_frame->GetWritableVisibleData(VideoFrame::kYPlane);
vpx_image.planes[VPX_PLANE_U] =
- video_frame->visible_data(VideoFrame::kUPlane);
+ video_frame->GetWritableVisibleData(VideoFrame::kUPlane);
vpx_image.planes[VPX_PLANE_V] =
- video_frame->visible_data(VideoFrame::kVPlane);
+ video_frame->GetWritableVisibleData(VideoFrame::kVPlane);
vpx_image.stride[VPX_PLANE_Y] = video_frame->stride(VideoFrame::kYPlane);
vpx_image.stride[VPX_PLANE_U] = video_frame->stride(VideoFrame::kUPlane);
vpx_image.stride[VPX_PLANE_V] = video_frame->stride(VideoFrame::kVPlane);
break;
case VPX_IMG_FMT_NV12:
vpx_image.planes[VPX_PLANE_Y] =
- video_frame->visible_data(VideoFrame::kYPlane);
+ video_frame->GetWritableVisibleData(VideoFrame::kYPlane);
// In libvpx, the UV plane of NV12 frames is represented by two planes
// with the same stride, shifted by one byte.
vpx_image.planes[VPX_PLANE_U] =
- video_frame->visible_data(VideoFrame::kUVPlane);
+ video_frame->GetWritableVisibleData(VideoFrame::kUVPlane);
vpx_image.planes[VPX_PLANE_V] = vpx_image.planes[VPX_PLANE_U] + 1;
vpx_image.stride[VPX_PLANE_Y] = video_frame->stride(VideoFrame::kYPlane);
vpx_image.stride[VPX_PLANE_U] = video_frame->stride(VideoFrame::kUVPlane);
@@ -285,10 +288,10 @@ void VpxEncoder::Encode(scoped_refptr<media::VideoFrame> video_frame,
continue;
if (pkt->data.frame.flags & VPX_FRAME_IS_KEY) {
// TODO(hubbe): Replace "dependency" with a "bool is_key_frame".
- encoded_frame->dependency = EncodedFrame::KEY;
+ encoded_frame->dependency = Dependency::kKeyFrame;
encoded_frame->referenced_frame_id = encoded_frame->frame_id;
} else {
- encoded_frame->dependency = EncodedFrame::DEPENDENT;
+ encoded_frame->dependency = Dependency::kDependent;
// Frame dependencies could theoretically be relaxed by looking for the
// VPX_FRAME_IS_DROPPABLE flag, but in recent testing (Oct 2014), this
// flag never seems to be set.
@@ -338,10 +341,10 @@ void VpxEncoder::Encode(scoped_refptr<media::VideoFrame> video_frame,
<< ", lossiness: " << encoded_frame->lossiness
<< " (quantizer chosen by the encoder was " << quantizer << ')';
- if (encoded_frame->dependency == EncodedFrame::KEY) {
+ if (encoded_frame->dependency == Dependency::kKeyFrame) {
key_frame_requested_ = false;
}
- if (encoded_frame->dependency == EncodedFrame::KEY) {
+ if (encoded_frame->dependency == Dependency::kKeyFrame) {
encoding_speed_acc_.Reset(kHighestEncodingSpeed, video_frame->timestamp());
} else {
// Equivalent encoding speed considering both cpu_used setting and