| 170 | } |
| 171 | |
| 172 | void Compute(OpKernelContext* context) override { |
| 173 | // Get and verify the input data. |
| 174 | OP_REQUIRES( |
| 175 | context, context->num_inputs() == 1, |
| 176 | errors::InvalidArgument("EncodeAudio requires exactly one input.")); |
| 177 | const Tensor& contents = context->input(0); |
| 178 | OP_REQUIRES(context, TensorShapeUtils::IsMatrix(contents.shape()), |
| 179 | errors::InvalidArgument( |
| 180 | "sampled_audio must be a rank 2 tensor but got shape ", |
| 181 | contents.shape().DebugString())); |
| 182 | OP_REQUIRES( |
| 183 | context, contents.NumElements() <= std::numeric_limits<int32>::max(), |
| 184 | errors::InvalidArgument( |
| 185 | "sampled_audio cannot have more than 2^31 entries. Shape = ", |
| 186 | contents.shape().DebugString())); |
| 187 | |
| 188 | Encode(context, contents, file_format_, bits_per_second_, |
| 189 | samples_per_second_); |
| 190 | } |
| 191 | |
| 192 | private: |
| 193 | string file_format_; |
nothing calls this directly
no test coverage detected