| Index: webrtc/common_types.cc
 | 
| diff --git a/webrtc/common_types.cc b/webrtc/common_types.cc
 | 
| index 5cbc452db33f82735092fd28460a56859f70e982..9af53af8df462ebff181813024da522dba4c7b80 100644
 | 
| --- a/webrtc/common_types.cc
 | 
| +++ b/webrtc/common_types.cc
 | 
| @@ -207,4 +207,47 @@ uint32_t BitrateAllocation::GetSpatialLayerSum(size_t spatial_index) const {
 | 
|    return sum;
 | 
|  }
 | 
|  
 | 
| +std::string BitrateAllocation::ToString() const {
 | 
| +  if (sum_ == 0)
 | 
| +    return "BitrateAllocation [ [] ]";
 | 
| +
 | 
| +  std::ostringstream oss;
 | 
| +  oss << "BitrateAllocation [";
 | 
| +  uint32_t spatial_cumulator = 0;
 | 
| +  for (int si = 0; si < kMaxSpatialLayers; ++si) {
 | 
| +    RTC_DCHECK_LE(spatial_cumulator, sum_);
 | 
| +    if (spatial_cumulator == sum_)
 | 
| +      break;
 | 
| +
 | 
| +    const uint32_t layer_sum = GetSpatialLayerSum(si);
 | 
| +    if (layer_sum == sum_) {
 | 
| +      oss << " [";
 | 
| +    } else {
 | 
| +      if (si > 0)
 | 
| +        oss << ",";
 | 
| +      oss << std::endl << "  [";
 | 
| +    }
 | 
| +    spatial_cumulator += layer_sum;
 | 
| +
 | 
| +    uint32_t temporal_cumulator = 0;
 | 
| +    for (int ti = 0; ti < kMaxTemporalStreams; ++ti) {
 | 
| +      RTC_DCHECK_LE(temporal_cumulator, layer_sum);
 | 
| +      if (temporal_cumulator == layer_sum)
 | 
| +        break;
 | 
| +
 | 
| +      if (ti > 0)
 | 
| +        oss << ", ";
 | 
| +
 | 
| +      uint32_t bitrate = bitrates_[si][ti];
 | 
| +      oss << bitrate;
 | 
| +      temporal_cumulator += bitrate;
 | 
| +    }
 | 
| +    oss << "]";
 | 
| +  }
 | 
| +
 | 
| +  RTC_DCHECK_EQ(spatial_cumulator, sum_);
 | 
| +  oss << " ]";
 | 
| +  return oss.str();
 | 
| +}
 | 
| +
 | 
|  }  // namespace webrtc
 | 
| 
 |