| 413 | } |
| 414 | |
| 415 | butil::Status RtmpAACMessage::Create(const RtmpAudioMessage& msg) { |
| 416 | if (msg.codec != FLV_AUDIO_AAC) { |
| 417 | return butil::Status(EINVAL, "codec=%s is not AAC", |
| 418 | FlvAudioCodec2Str(msg.codec)); |
| 419 | } |
| 420 | const uint8_t* p = (const uint8_t*)msg.data.fetch1(); |
| 421 | if (p == NULL) { |
| 422 | return butil::Status(EINVAL, "Not enough data in AudioMessage"); |
| 423 | } |
| 424 | if (*p > FLV_AAC_PACKET_RAW) { |
| 425 | return butil::Status(EINVAL, "Invalid AAC packet_type=%d", (int)*p); |
| 426 | } |
| 427 | this->timestamp = msg.timestamp; |
| 428 | this->rate = msg.rate; |
| 429 | this->bits = msg.bits; |
| 430 | this->type = msg.type; |
| 431 | this->packet_type = (FlvAACPacketType)*p; |
| 432 | msg.data.append_to(&data, msg.data.size() - 1, 1); |
| 433 | return butil::Status::OK(); |
| 434 | } |
| 435 | |
| 436 | AudioSpecificConfig::AudioSpecificConfig() |
| 437 | : aac_object(AAC_OBJECT_UNKNOWN) |