| OLD | NEW | 
|---|
| 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 // TODO (pwestin): add a link to the design document describing the generic | 5 // TODO (pwestin): add a link to the design document describing the generic | 
| 6 // protocol and the VP8 specific details. | 6 // protocol and the VP8 specific details. | 
| 7 #include "media/cast/video_sender/codecs/vp8/vp8_encoder.h" | 7 #include "media/cast/video_sender/codecs/vp8/vp8_encoder.h" | 
| 8 | 8 | 
| 9 #include <vector> | 9 #include <vector> | 
| 10 | 10 | 
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 170   } else { | 170   } else { | 
| 171     // Reference all acked frames (buffers). | 171     // Reference all acked frames (buffers). | 
| 172     latest_frame_id_to_reference = GetLatestFrameIdToReference(); | 172     latest_frame_id_to_reference = GetLatestFrameIdToReference(); | 
| 173     GetCodecReferenceFlags(&flags); | 173     GetCodecReferenceFlags(&flags); | 
| 174     buffer_to_update = GetNextBufferToUpdate(); | 174     buffer_to_update = GetNextBufferToUpdate(); | 
| 175     GetCodecUpdateFlags(buffer_to_update, &flags); | 175     GetCodecUpdateFlags(buffer_to_update, &flags); | 
| 176   } | 176   } | 
| 177 | 177 | 
| 178   // Note: The duration does not reflect the real time between frames. This is | 178   // Note: The duration does not reflect the real time between frames. This is | 
| 179   // done to keep the encoder happy. | 179   // done to keep the encoder happy. | 
|  | 180   // | 
|  | 181   // TODO(miu): This is a semi-hack.  We should consider using | 
|  | 182   // |video_frame->timestamp()| instead. | 
| 180   uint32 duration = kVideoFrequency / cast_config_.max_frame_rate; | 183   uint32 duration = kVideoFrequency / cast_config_.max_frame_rate; | 
| 181   if (vpx_codec_encode(encoder_.get(), | 184   if (vpx_codec_encode(encoder_.get(), | 
| 182                        raw_image_, | 185                        raw_image_, | 
| 183                        timestamp_, | 186                        timestamp_, | 
| 184                        duration, | 187                        duration, | 
| 185                        flags, | 188                        flags, | 
| 186                        VPX_DL_REALTIME)) { | 189                        VPX_DL_REALTIME)) { | 
| 187     return false; | 190     return false; | 
| 188   } | 191   } | 
| 189   timestamp_ += duration; | 192   timestamp_ += duration; | 
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 396   float scale_parameter = 0.5; | 399   float scale_parameter = 0.5; | 
| 397   uint32 target_pct = optimal_buffer_size_ms * scale_parameter * | 400   uint32 target_pct = optimal_buffer_size_ms * scale_parameter * | 
| 398                       cast_config_.max_frame_rate / 10; | 401                       cast_config_.max_frame_rate / 10; | 
| 399 | 402 | 
| 400   // Don't go below 3 times the per frame bandwidth. | 403   // Don't go below 3 times the per frame bandwidth. | 
| 401   return std::max(target_pct, kMinIntra); | 404   return std::max(target_pct, kMinIntra); | 
| 402 } | 405 } | 
| 403 | 406 | 
| 404 }  // namespace cast | 407 }  // namespace cast | 
| 405 }  // namespace media | 408 }  // namespace media | 
| OLD | NEW | 
|---|