<commit_before>/**
 Copyright 2014 Google Inc. All rights reserved.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

package com.google.android.libraries.mediaframework.layeredvideo;

import android.util.Log;
import android.view.LayoutInflater;
import android.view.SurfaceHolder;
import android.widget.FrameLayout;

import com.google.android.libraries.mediaframework.R;
import com.google.android.libraries.mediaframework.exoplayerextensions.ExoplayerWrapper;

/**
 * Creates a view which can render video.
 */
public class VideoSurfaceLayer implements Layer {

  /**
   * Whether the video starts playing as soon as the surface is created.
   */
  private boolean autoplay;

  /**
   * The {@link LayerManager} whcih is responsible for creating this layer's view and adding it to
   * the video player.
   */
  private LayerManager layerManager;

  /**
   * When a size change occurs, change the size of the surface view.
   */
  private ExoplayerWrapper.PlaybackListener playbackListener
      = new ExoplayerWrapper.PlaybackListener() {
    @Override
    public void onStateChanged(boolean playWhenReady, int playbackState) {

    }

    @Override
    public void onError(Exception e) {
      Log.d(VideoSurfaceLayer.class.getSimpleName(), e.getMessage());
    }

    @Override
    public void onVideoSizeChanged(int width, int height, float pixelWidthAspectRatio) {
      surfaceView.setVideoWidthHeightRatio(
          height == 0 ? 1 : (width * pixelWidthAspectRatio) / height);<commit_msg>Fixes #49 by removing bad log message.<commit_after>/**
 Copyright 2014 Google Inc. All rights reserved.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

package com.google.android.libraries.mediaframework.layeredvideo;

import android.view.LayoutInflater;
import android.view.SurfaceHolder;
import android.widget.FrameLayout;

import com.google.android.libraries.mediaframework.R;
import com.google.android.libraries.mediaframework.exoplayerextensions.ExoplayerWrapper;

/**
 * Creates a view which can render video.
 */
public class VideoSurfaceLayer implements Layer {

  /**
   * Whether the video starts playing as soon as the surface is created.
   */
  private boolean autoplay;

  /**
   * The {@link LayerManager} whcih is responsible for creating this layer's view and adding it to
   * the video player.
   */
  private LayerManager layerManager;

  /**
   * When a size change occurs, change the size of the surface view.
   */
  private ExoplayerWrapper.PlaybackListener playbackListener
      = new ExoplayerWrapper.PlaybackListener() {
    @Override
    public void onStateChanged(boolean playWhenReady, int playbackState) {
      // Do nothing. VideoSurfaceLayer doesn't care about state changes.
    }

    @Override
    public void onError(Exception e) {
      // Do nothing. VideoSurfaceLayer doesn't care about errors here.
    }

    @Override
    public void onVideoSizeChanged(int width, int height, float pixelWidthAspectRatio) {
      surfaceView.setVideoWidthHeightRatio(
          height == 0 ? 1 : (width * pixelWidthAspectRatio) / height);
{'fraction_non_alphanumeric': 0.07311028500619579, 'fraction_numerical': 0.005452292441140025, 'mean_word_length': 3.8685162846803376, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6993463', 'n_tokens_mistral': 1071, 'n_tokens_neox': 1021, 'n_words': 407}